-
-
Notifications
You must be signed in to change notification settings - Fork 947
Another "Cannot unset offset on array" false positive #7417
Copy link
Copy link
Closed
phpstan/phpstan-src
#1596Labels
Milestone
Description
Bug report
Code snippet that reproduces the problem
/**
* Reads configuration data from the storage.
* @return array|bool
*/
function readThing() {
return ['module' => ['test' => 0]];
}
$extensions = readThing();
$extensions['theme']['test_basetheme'] = 0;
// This is the important part of the test. Themes are ordered alphabetically
// in core.extension so this will come before it's base theme.
$extensions['theme']['test_subtheme'] = 0;
$extensions['theme']['test_subsubtheme'] = 0;
unset($extensions['theme']['test_basetheme']);
unset($extensions['theme']['test_subsubtheme']);
unset($extensions['theme']['test_subtheme']);Expected: No errors
Results in:
Cannot unset offset 'test_basetheme' on array{test_subtheme: 0, test_subsubtheme: 0}.
https://phpstan.org/r/33cd311d-fd19-430a-b3f5-945174682f2a
Did PHPStan help you today? Did it make you happy in any way?
PHPStan made me happy because bit by bit we're using it to improve Drupal. Thanks for all the work on it!
Reactions are currently unavailable