Skip to content

Commit cf3fc13

Browse files
committed
PHPStan fix
1 parent 328fcb9 commit cf3fc13

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

src/Testing/TypeInferenceTestCase.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
use PHPStan\Reflection\InitializerExprTypeResolver;
1919
use PHPStan\Reflection\SignatureMap\SignatureMapProvider;
2020
use PHPStan\Rules\Properties\ReadWritePropertiesExtensionProvider;
21-
use PHPStan\ShouldNotHappenException;
2221
use PHPStan\TrinaryLogic;
2322
use PHPStan\Type\ConstantScalarType;
2423
use PHPStan\Type\FileTypeMapper;
2524
use PHPStan\Type\Type;
2625
use PHPStan\Type\VerbosityLevel;
2726
use Symfony\Component\Finder\Finder;
28-
use function array_key_exists;
2927
use function array_map;
3028
use function array_merge;
3129
use function count;
@@ -304,9 +302,6 @@ private static function isFileLintSkipped(string $file): bool
304302
@fclose($f);
305303

306304
if (preg_match('~<?php\\s*\\/\\/\s*lint\s*([^\d\s]+)\s*([^\s]+)\s*~i', $firstLine, $m) === 1) {
307-
if (!array_key_exists(1, $m) || !array_key_exists(2, $m)) {
308-
throw new ShouldNotHappenException();
309-
}
310305
return version_compare(PHP_VERSION, $m[2], $m[1]) === false;
311306
}
312307
}

src/Type/Php/SprintfFunctionDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function getTypeFromFunctionCall(
5555
foreach ($formatType->getConstantStrings() as $constantString) {
5656
// The printf format is %[argnum$][flags][width][.precision]
5757
if (preg_match('/^%([0-9]*\$)?[0-9]*\.?[0-9]*([sbdeEfFgGhHouxX])$/', $constantString->getValue(), $matches) === 1) {
58-
if (array_key_exists(1, $matches) && ($matches[1] !== '')) {
58+
if ($matches[1] !== '') {
5959
// invalid positional argument
6060
if ($matches[1] === '0$') {
6161
return null;

0 commit comments

Comments
 (0)