diff --git a/README.md b/README.md index 0a0b3397..246c0c84 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ You can disable rules using configuration parameters: ```neon parameters: strictRules: + disallowedLooseComparison: false booleansInConditions: false uselessCast: false requireParentConstructorCall: false diff --git a/composer.json b/composer.json index 3f7d80ca..11dff8e4 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/rules.neon b/rules.neon index f7fa3e14..7dadfaaa 100644 --- a/rules.neon +++ b/rules.neon @@ -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% @@ -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: