Skip to content

Commit 20376d1

Browse files
Enable UnserializeRule only for bleeding edge
1 parent 132a28f commit 20376d1

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎conf/bleedingEdge.neon‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77
stricterFunctionMap: true
88
reportPreciseLineForUnusedFunctionParameter: true
99
checkPrintfParameterTypes: true
10+
checkUnserializeFunction: true
1011
internalTag: true
1112
newStaticInAbstractClassStaticMethod: true
1213
checkExtensionsForComparisonOperators: true

‎conf/config.level5.neon‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ conditionalTags:
1010
phpstan.rules.rule: %featureToggles.checkParameterCastableToNumberFunctions%
1111
PHPStan\Rules\Functions\PrintfParameterTypeRule:
1212
phpstan.rules.rule: %featureToggles.checkPrintfParameterTypes%
13+
PHPStan\Rules\Functions\UnserializeRule:
14+
phpstan.rules.rule: %featureToggles.checkUnserializeFunction%
1315

1416
autowiredAttributeServices:
1517
# registers rules with #[RegisteredRule] attribute
@@ -22,3 +24,7 @@ services:
2224
class: PHPStan\Rules\Functions\PrintfParameterTypeRule
2325
arguments:
2426
checkStrictPrintfPlaceholderTypes: %checkStrictPrintfPlaceholderTypes%
27+
-
28+
class: PHPStan\Rules\Functions\UnserializeRule
29+
arguments:
30+
checkInsecureUnserialize: %checkInsecureUnserialize%

‎conf/config.neon‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ parameters:
3434
stricterFunctionMap: false
3535
reportPreciseLineForUnusedFunctionParameter: false
3636
checkPrintfParameterTypes: false
37+
checkUnserializeFunction: false
3738
internalTag: false
3839
newStaticInAbstractClassStaticMethod: false
3940
checkExtensionsForComparisonOperators: false

‎src/Rules/Functions/UnserializeRule.php‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
use PhpParser\Node\Expr\FuncCall;
77
use PHPStan\Analyser\ArgumentsNormalizer;
88
use PHPStan\Analyser\Scope;
9-
use PHPStan\DependencyInjection\AutowiredParameter;
10-
use PHPStan\DependencyInjection\RegisteredRule;
119
use PHPStan\Php\PhpVersion;
1210
use PHPStan\Reflection\ParametersAcceptorSelector;
1311
use PHPStan\Reflection\ReflectionProvider;
@@ -20,14 +18,12 @@
2018
/**
2119
* @implements Rule<Node\Expr\FuncCall>
2220
*/
23-
#[RegisteredRule(level: 5)]
2421
final class UnserializeRule implements Rule
2522
{
2623

2724
public function __construct(
2825
private readonly PhpVersion $phpVersion,
2926
private readonly ReflectionProvider $reflectionProvider,
30-
#[AutowiredParameter]
3127
private readonly bool $checkInsecureUnserialize,
3228
)
3329
{

0 commit comments

Comments
 (0)