We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+--------------------------------------------------------------+ | Line | test.php | +--------------------------------------------------------------+ | 23 | Unreachable statement - code above always terminates. | +--------------------------------------------------------------+
➡️ https://phpstan.org/r/053b9b77-618e-4af2-8105-c2a572945565
<?php declare(strict_types = 1); $fun = function (): array { return [ ['group_id' => 'a', 'user_id' => 'id1'], ['group_id' => 'a', 'user_id' => 'id2'], ['group_id' => 'a', 'user_id' => 'id3'], ['group_id' => 'b', 'user_id' => 'id4'], ['group_id' => 'b', 'user_id' => 'id5'], ['group_id' => 'b', 'user_id' => 'id6'], ]; }; $orders = $fun(); $result = []; foreach ($orders as $order) { // no error trigger with this statement // if (isset($result[$order['group_id']])) { if (isset($result[$order['group_id']]['users'])) { $result[$order['group_id']]['users'][] = $order['user_id']; continue; } $result[$order['group_id']] = [ 'users' => [ $order['user_id'], ], ]; }
[OK] No errors
The text was updated successfully, but these errors were encountered:
@Alban-io After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
@@ @@ -23: Unreachable statement - code above always terminates. +No errors
Sorry, something went wrong.
phpstan/phpstan-src@c17a331
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
Bug report
Code snippet that reproduces the problem
➡️ https://phpstan.org/r/053b9b77-618e-4af2-8105-c2a572945565
Expected output
The text was updated successfully, but these errors were encountered: