Skip to content

Commit 89641e5

Browse files
committed
fix static analysis job with PHP 7.4
1 parent 5d8709e commit 89641e5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Rules/Functions/PrintfPlaceholder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\Rules\Functions;
44

5+
use PHPStan\ShouldNotHappenException;
56
use PHPStan\Type\ErrorType;
67
use PHPStan\Type\IntegerType;
78
use PHPStan\Type\Type;
@@ -33,6 +34,10 @@ public function doesArgumentTypeMatchPlaceholder(Type $argumentType): bool
3334
case 'string':
3435
case 'mixed':
3536
return true;
37+
// Without this PHPStan with PHP 7.4 reports "...should return bool but return statement is missing."
38+
// Presumably, because promoted properties are turned into regular properties and the phpdoc isn't applied to the property.
39+
default:
40+
throw new ShouldNotHappenException('Unexpected type ' . $this->acceptingType);
3641
}
3742
}
3843

0 commit comments

Comments
 (0)