Skip to content

Commit

Permalink
Configuration option strictRules.disallowedLooseComparsion
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMystikJonas authored and ondrejmirtes committed Sep 21, 2022
1 parent 431b3d6 commit 23e5f37
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -62,6 +62,7 @@ You can disable rules using configuration parameters:
```neon
parameters:
strictRules:
disallowedLooseComparison: false
booleansInConditions: false
uselessCast: false
requireParentConstructorCall: false
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -7,7 +7,7 @@
],
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.8.3"
"phpstan/phpstan": "^1.8.6"
},
"require-dev": {
"nikic/php-parser": "^4.13.0",
Expand Down
28 changes: 15 additions & 13 deletions rules.neon
Expand Up @@ -16,6 +16,7 @@ parameters:
illegalConstructorMethodCall: %featureToggles.bleedingEdge%
strictRules:
allRules: true
disallowedLooseComparison: [%strictRules.allRules%, %featureToggles.bleedingEdge%]
booleansInConditions: %strictRules.allRules%
uselessCast: %strictRules.allRules%
requireParentConstructorCall: %strictRules.allRules%
Expand All @@ -30,23 +31,24 @@ parameters:

parametersSchema:
strictRules: structure([
allRules: bool(),
booleansInConditions: bool()
uselessCast: bool()
requireParentConstructorCall: bool()
disallowedConstructs: bool()
overwriteVariablesWithLoop: bool()
closureUsesThis: bool()
matchingInheritedMethodNames: bool()
numericOperandsInArithmeticOperators: bool()
strictCalls: bool()
switchConditionsMatchingType: bool()
noVariableVariables: bool()
allRules: anyOf(bool(), arrayOf(bool())),
disallowedLooseComparison: anyOf(bool(), arrayOf(bool())),
booleansInConditions: anyOf(bool(), arrayOf(bool()))
uselessCast: anyOf(bool(), arrayOf(bool()))
requireParentConstructorCall: anyOf(bool(), arrayOf(bool()))
disallowedConstructs: anyOf(bool(), arrayOf(bool()))
overwriteVariablesWithLoop: anyOf(bool(), arrayOf(bool()))
closureUsesThis: anyOf(bool(), arrayOf(bool()))
matchingInheritedMethodNames: anyOf(bool(), arrayOf(bool()))
numericOperandsInArithmeticOperators: anyOf(bool(), arrayOf(bool()))
strictCalls: anyOf(bool(), arrayOf(bool()))
switchConditionsMatchingType: anyOf(bool(), arrayOf(bool()))
noVariableVariables: anyOf(bool(), arrayOf(bool()))
])

conditionalTags:
PHPStan\Rules\DisallowedConstructs\DisallowedLooseComparisonRule:
phpstan.rules.rule: %featureToggles.bleedingEdge%
phpstan.rules.rule: %strictRules.disallowedLooseComparison%
PHPStan\Rules\BooleansInConditions\BooleanInBooleanAndRule:
phpstan.rules.rule: %strictRules.booleansInConditions%
PHPStan\Rules\BooleansInConditions\BooleanInBooleanNotRule:
Expand Down

0 comments on commit 23e5f37

Please sign in to comment.