-
-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
Priority: HighAfter critical issues are fixed, handle these before any further issues.After critical issues are fixed, handle these before any further issues.Status: In ProgressThis issue is being worked on and has someone assigned.This issue is being worked on and has someone assigned.Subject: AnalyzerAn issue or PR related to the static analyzer/type checker.An issue or PR related to the static analyzer/type checker.Type: BugAn issue causing unintended or problematic behavior.An issue causing unintended or problematic behavior.
Description
Mago doesn't seem to infer the type from the match
case
$cache = new TestingCache(
tag: match (true) {
is_string($tag) => to_kebab_case($tag),
$tag instanceof UnitEnum => to_kebab_case($tag->name), // this line
default => 'default',
},
clock: $this->container->get(Clock::class)->toPsrClock(),
);
error[possibly-null-property-access]: Attempting to access a property on a possibly `null` value.
┌─ packages/cache/src/Testing/CacheTester.php:28:59
│
28 │ $tag instanceof UnitEnum => to_kebab_case($tag->name),
│ ^^^^ This expression can be `null` here
│
= If this expression is `null` at runtime, PHP will raise a warning and the property access will result in `null`.
= Help: Use the nullsafe operator (`?->`) to safely access the property, or add a check to ensure the value is not `null` (e.g., `if ($obj !== null)`).
Metadata
Metadata
Assignees
Labels
Priority: HighAfter critical issues are fixed, handle these before any further issues.After critical issues are fixed, handle these before any further issues.Status: In ProgressThis issue is being worked on and has someone assigned.This issue is being worked on and has someone assigned.Subject: AnalyzerAn issue or PR related to the static analyzer/type checker.An issue or PR related to the static analyzer/type checker.Type: BugAn issue causing unintended or problematic behavior.An issue causing unintended or problematic behavior.