Fix phpstan/phpstan#13705: Adding elements to empty array in while loop does not result in array being recognized as potentially non-empty for in_array
#27301
Annotations
1 error and 2 warnings
|
Run infection
Process completed with exit code 1.
|
|
Complete job
Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830, actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830, actions/cache@v4, shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1, step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e. Actions will be forced to run with Node.js 24 by default starting June 2nd, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
|
|
Run infection:
src/Analyser/TypeSpecifier.php#L296
Escaped Mutant for Mutator "PHPStan\Infection\TrueTruthyFalseFalseyTypeSpecifierContextMutator":
@@ @@
// being false means count < $left), specifyTypesForCountFuncCall would
// incorrectly narrow the array because "count not in sizeType" is stricter
// than "count < some value in sizeType range".
- if (!($context->falsey() && $leftType instanceof IntegerRangeType)) {
+ if (!($context->false() && $leftType instanceof IntegerRangeType)) {
$specifiedTypes = $this->specifyTypesForCountFuncCall($expr->right, $argType, $sizeType, $context, $scope, $expr);
if ($specifiedTypes !== null) {
$result = $result->unionWith($specifiedTypes);
|
Loading