Vincent Langlet
Vincent Langlet
> If it does, then fine, but very often a regex string is partial like the usecase from PHP CS Fixer above. I thought the use case was to type...
> The problem with `array_push($arr[$i], ...)` is that PHPStan doesn't understand what exactly are you modifying, and leaves `$arr[$i]` alone, so this is the resulting type: [phpstan.org/r/a5f79210-4176-46fc-8fc4-5ea22366bc60](https://phpstan.org/r/a5f79210-4176-46fc-8fc4-5ea22366bc60) (`array()` is an...
> related code for the fix is in [phpstan/phpstan-src@`d1cf59a`/src/Analyser/NodeScopeResolver.php#L794-L860](https://github.com/phpstan/phpstan-src/blob/d1cf59a4ad16ae12ec1305d980142e4d5d2fe234/src/Analyser/NodeScopeResolver.php#L794-L860) I think this is the same issue than https://github.com/phpstan/phpstan/issues/2457#issuecomment-2291085450 So code related might be https://github.com/phpstan/phpstan-src/blob/cb959cb5a784703e81828b92d28a6f4a72251a20/src/Analyser/NodeScopeResolver.php#L2423-L2433 @staabm Something similar to ``` $scope...
The reason seems clear when the condition is splited https://phpstan.org/r/51174f27-bf40-496f-9b1b-9b6204472bf9 This would require something like `string~'0'`...
This is because the int is narrowed to an int range. And the benevolent union is becoming an simple union https://phpstan.org/r/c74aaaae-4d0f-4fe4-b961-4a2950c34bdc I already worked on improving the result for integer...
file_get_contents is not impure, but is invalidated as soon as you're using file_put_content. We can do the same for filesize, PR is https://github.com/phpstan/phpstan-src/pull/3311
> > But when we insert `clearstatcache()` call, the error message does not disappear, but changes to ([phpstan.org/r/aba1966b-be12-4f83-a004-00977b128f19](https://phpstan.org/r/aba1966b-be12-4f83-a004-00977b128f19)): > > I can't reproduce this error locally. I don't run into...
> I have another issue with array_key_exists . I don't know if I must create a new issue. The following code crashes if the array key world doesn't exist [phpstan.org/r/77b815da-653a-477f-92cb-50d04c52eaf4](https://phpstan.org/r/77b815da-653a-477f-92cb-50d04c52eaf4)...
This was flagged as easy fixes, maybe @ondrejmirtes or @staabm you know where I should look into to fix this ? Thanks
This is reported by `strict rules` see https://phpstan.org/r/bf11f498-0319-4702-b1ac-8e6be97cb838 vs https://phpstan.org/r/30c00b38-2c37-4e49-8aac-6fb3c6458bc4 The thing is that the check `canAccessUndefinedProperties` is ``` private function canAccessUndefinedProperties(Scope $scope, Expr $node): bool { return $scope->isUndefinedExpressionAllowed($node) &&...