@@ -59,14 +59,14 @@ public function check(Expr $expr, Scope $scope, string $operatorDescription, cal
59
59
$ type = $ this ->treatPhpDocTypesAsCertain
60
60
? $ scope ->getType ($ expr ->var )
61
61
: $ scope ->getNativeType ($ expr ->var );
62
- $ dimType = $ this ->treatPhpDocTypesAsCertain
63
- ? $ scope ->getType ($ expr ->dim )
64
- : $ scope ->getNativeType ($ expr ->dim );
65
- $ hasOffsetValue = $ type ->hasOffsetValueType ($ dimType );
66
62
if (!$ type ->isOffsetAccessible ()->yes ()) {
67
63
return $ error ?? $ this ->checkUndefined ($ expr ->var , $ scope , $ operatorDescription );
68
64
}
69
65
66
+ $ dimType = $ this ->treatPhpDocTypesAsCertain
67
+ ? $ scope ->getType ($ expr ->dim )
68
+ : $ scope ->getNativeType ($ expr ->dim );
69
+ $ hasOffsetValue = $ type ->hasOffsetValueType ($ dimType );
70
70
if ($ hasOffsetValue ->no ()) {
71
71
if (!$ this ->checkAdvancedIsset ) {
72
72
return null ;
@@ -82,7 +82,7 @@ public function check(Expr $expr, Scope $scope, string $operatorDescription, cal
82
82
)->build ();
83
83
}
84
84
85
- // If offset is cannot be null, store this error message and see if one of the earlier offsets is.
85
+ // If offset cannot be null, store this error message and see if one of the earlier offsets is.
86
86
// E.g. $array['a']['b']['c'] ?? null; is a valid coalesce if a OR b or C might be null.
87
87
if ($ hasOffsetValue ->yes () || $ scope ->hasExpressionType ($ expr )->yes ()) {
88
88
if (!$ this ->checkAdvancedIsset ) {
0 commit comments