-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
phpstan/phpstan-src
#3045Labels
Description
Feature request
https://3v4l.org/b3Vem
As we can see here, there are two types of isOffsetAccessible->no
. Whether it throws a fatal error in isset/coalesce/empty ($scope->isUndefinedExpressionAllowed
) or not.
I think we can improve NonexistentOffsetInArrayDimFetchRule
by separating these.
Also, a lot of people are not aware why StrictMixedType
throws an error with the code below, maybe we can add some information in the document
/** @var mixed $mixed */
isset($mixed['foo']);
Goal
https://phpstan.org/r/1087a148-ae5b-477f-9003-215fefc3437f
No error in line 7, 21
Throw error in 12
Design
- Add method something like
isOffsetAccessThrowsFatalError(): TernaryLogic
(want a better naming...) to Types - Return TernaryLogic::Yes for
isOffsetAccessThrowsFatalError
in MixedType/StrictMixedType if object type is subtracted
Related issues
These issues should be closed after documented
- recursive traversal of data: array|mixed (level=9) #7229
- Cannot access offset on mixed when using
isset()
#8388 - Null coalesce operator on nested array returns unexpected error #8069
The test should be reverted after this is implemented
Array access with json_decode
mixed problems
- Specifiy
json_decode
default return type phpstan-src#1283 - [Types] Add JsonDecodeDynamicReturnTypeExtension phpstan-nette#89
Did PHPStan help you today? Did it make you happy in any way?
PHPStan on PHPStan finds error while developing PHPStan 😄
LastDragon-ru