Skip to content

Commit 15737f7

Browse files
eliashaeusslerondrejmirtes
authored andcommitted
Enable UnserializeRule only for bleeding edge
1 parent 30cf40c commit 15737f7

5 files changed

Lines changed: 9 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
@@ -14,6 +14,8 @@ conditionalTags:
1414
phpstan.rules.rule: %featureToggles.checkDateIntervalConstructor%
1515
PHPStan\Rules\Functions\SortWithoutEffectRule:
1616
phpstan.rules.rule: %featureToggles.sortWithoutEffect%
17+
PHPStan\Rules\Functions\UnserializeRule:
18+
phpstan.rules.rule: %featureToggles.checkUnserializeFunction%
1719

1820
autowiredAttributeServices:
1921
# registers rules with #[RegisteredRule] attribute
@@ -33,3 +35,7 @@ services:
3335
arguments:
3436
treatPhpDocTypesAsCertain: %treatPhpDocTypesAsCertain%
3537
treatPhpDocTypesAsCertainTip: %tips.treatPhpDocTypesAsCertain%
38+
-
39+
class: PHPStan\Rules\Functions\UnserializeRule
40+
arguments:
41+
checkInsecureUnserialize: %checkInsecureUnserialize%

‎conf/config.neon‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ parameters:
3939
stricterFunctionMap: false
4040
reportPreciseLineForUnusedFunctionParameter: false
4141
checkPrintfParameterTypes: false
42+
checkUnserializeFunction: false
4243
internalTag: false
4344
newStaticInAbstractClassStaticMethod: false
4445
checkExtensionsForComparisonOperators: false

‎conf/parametersSchema.neon‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ parametersSchema:
3636
stricterFunctionMap: bool()
3737
reportPreciseLineForUnusedFunctionParameter: bool()
3838
checkPrintfParameterTypes: bool()
39+
checkUnserializeFunction: bool()
3940
internalTag: bool()
4041
newStaticInAbstractClassStaticMethod: bool()
4142
checkExtensionsForComparisonOperators: bool()

‎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)