Skip to content

Commit

Permalink
Everything from Bleeding Edge enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 24, 2024
1 parent 988fab9 commit 914b5e3
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 69 deletions.
26 changes: 5 additions & 21 deletions rules.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ parameters:
checkAlwaysTrueInstanceof: true
checkAlwaysTrueStrictComparison: true
checkAlwaysTrueLooseComparison: true
checkDynamicProperties: %featureToggles.bleedingEdge%
checkDynamicProperties: true
checkExplicitMixedMissingReturn: true
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
reportMaybesInMethodSignatures: true
reportStaticMethodSignatures: true
reportMaybesInPropertyPhpDocTypes: true
reportWrongPhpDocTypeInVarTag: %featureToggles.bleedingEdge%
reportWrongPhpDocTypeInVarTag: true
featureToggles:
illegalConstructorMethodCall: %featureToggles.bleedingEdge%
illegalConstructorMethodCall: true
strictRules:
allRules: true
disallowedLooseComparison: [%strictRules.allRules%, %featureToggles.bleedingEdge%]
disallowedLooseComparison: %strictRules.allRules%
booleansInConditions: %strictRules.allRules%
uselessCast: %strictRules.allRules%
requireParentConstructorCall: %strictRules.allRules%
Expand All @@ -34,7 +34,7 @@ parameters:
dynamicCallOnStaticMethod: %strictRules.allRules%
switchConditionsMatchingType: %strictRules.allRules%
noVariableVariables: %strictRules.allRules%
strictArrayFilter: [%strictRules.allRules%, %featureToggles.bleedingEdge%]
strictArrayFilter: %strictRules.allRules%

parametersSchema:
strictRules: structure([
Expand Down Expand Up @@ -155,16 +155,12 @@ services:

-
class: PHPStan\Rules\BooleansInConditions\BooleanInBooleanAndRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\BooleansInConditions\BooleanInBooleanNotRule

-
class: PHPStan\Rules\BooleansInConditions\BooleanInBooleanOrRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\BooleansInConditions\BooleanInElseIfConditionRule
Expand Down Expand Up @@ -229,33 +225,21 @@ services:

-
class: PHPStan\Rules\Operators\OperandsInArithmeticAdditionRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\Operators\OperandsInArithmeticDivisionRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\Operators\OperandsInArithmeticExponentiationRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\Operators\OperandsInArithmeticModuloRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\Operators\OperandsInArithmeticMultiplicationRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\Operators\OperandsInArithmeticSubtractionRule
arguments:
bleedingEdge: %featureToggles.bleedingEdge%

-
class: PHPStan\Rules\StrictCalls\DynamicCallOnStaticMethodsRule
Expand Down
7 changes: 2 additions & 5 deletions src/Rules/BooleansInConditions/BooleanInBooleanAndRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ class BooleanInBooleanAndRule implements Rule

private BooleanRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(BooleanRuleHelper $helper, bool $bleedingEdge)
public function __construct(BooleanRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -35,7 +32,7 @@ public function processNode(Node $node, Scope $scope): array
{
$originalNode = $node->getOriginalNode();
$messages = [];
$nodeText = $this->bleedingEdge ? $originalNode->getOperatorSigil() : '&&';
$nodeText = $originalNode->getOperatorSigil();
$identifierType = $originalNode instanceof Node\Expr\BinaryOp\BooleanAnd ? 'booleanAnd' : 'logicalAnd';
if (!$this->helper->passesAsBoolean($scope, $originalNode->left)) {
$leftType = $scope->getType($originalNode->left);
Expand Down
7 changes: 2 additions & 5 deletions src/Rules/BooleansInConditions/BooleanInBooleanOrRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ class BooleanInBooleanOrRule implements Rule

private BooleanRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(BooleanRuleHelper $helper, bool $bleedingEdge)
public function __construct(BooleanRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -35,7 +32,7 @@ public function processNode(Node $node, Scope $scope): array
{
$originalNode = $node->getOriginalNode();
$messages = [];
$nodeText = $this->bleedingEdge ? $originalNode->getOperatorSigil() : '||';
$nodeText = $originalNode->getOperatorSigil();
$identifierType = $originalNode instanceof Node\Expr\BinaryOp\BooleanOr ? 'booleanOr' : 'logicalOr';
if (!$this->helper->passesAsBoolean($scope, $originalNode->left)) {
$leftType = $scope->getType($originalNode->left);
Expand Down
7 changes: 2 additions & 5 deletions src/Rules/Operators/OperandsInArithmeticAdditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ class OperandsInArithmeticAdditionRule implements Rule

private OperatorRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(OperatorRuleHelper $helper, bool $bleedingEdge)
public function __construct(OperatorRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -39,7 +36,7 @@ public function processNode(Node $node, Scope $scope): array
if ($node instanceof BinaryOpPlus) {
$left = $node->left;
$right = $node->right;
} elseif ($node instanceof AssignOpPlus && $this->bleedingEdge) {
} elseif ($node instanceof AssignOpPlus) {
$left = $node->var;
$right = $node->expr;
} else {
Expand Down
7 changes: 2 additions & 5 deletions src/Rules/Operators/OperandsInArithmeticDivisionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ class OperandsInArithmeticDivisionRule implements Rule

private OperatorRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(OperatorRuleHelper $helper, bool $bleedingEdge)
public function __construct(OperatorRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -38,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
if ($node instanceof BinaryOpDiv) {
$left = $node->left;
$right = $node->right;
} elseif ($node instanceof AssignOpDiv && $this->bleedingEdge) {
} elseif ($node instanceof AssignOpDiv) {
$left = $node->var;
$right = $node->expr;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ class OperandsInArithmeticExponentiationRule implements Rule

private OperatorRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(OperatorRuleHelper $helper, bool $bleedingEdge)
public function __construct(OperatorRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -38,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
if ($node instanceof BinaryOpPow) {
$left = $node->left;
$right = $node->right;
} elseif ($node instanceof AssignOpPow && $this->bleedingEdge) {
} elseif ($node instanceof AssignOpPow) {
$left = $node->var;
$right = $node->expr;
} else {
Expand Down
7 changes: 2 additions & 5 deletions src/Rules/Operators/OperandsInArithmeticModuloRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ class OperandsInArithmeticModuloRule implements Rule

private OperatorRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(OperatorRuleHelper $helper, bool $bleedingEdge)
public function __construct(OperatorRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -38,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
if ($node instanceof BinaryOpMod) {
$left = $node->left;
$right = $node->right;
} elseif ($node instanceof AssignOpMod && $this->bleedingEdge) {
} elseif ($node instanceof AssignOpMod) {
$left = $node->var;
$right = $node->expr;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ class OperandsInArithmeticMultiplicationRule implements Rule

private OperatorRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(OperatorRuleHelper $helper, bool $bleedingEdge)
public function __construct(OperatorRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -38,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
if ($node instanceof BinaryOpMul) {
$left = $node->left;
$right = $node->right;
} elseif ($node instanceof AssignOpMul && $this->bleedingEdge) {
} elseif ($node instanceof AssignOpMul) {
$left = $node->var;
$right = $node->expr;
} else {
Expand Down
7 changes: 2 additions & 5 deletions src/Rules/Operators/OperandsInArithmeticSubtractionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ class OperandsInArithmeticSubtractionRule implements Rule

private OperatorRuleHelper $helper;

private bool $bleedingEdge;

public function __construct(OperatorRuleHelper $helper, bool $bleedingEdge)
public function __construct(OperatorRuleHelper $helper)
{
$this->helper = $helper;
$this->bleedingEdge = $bleedingEdge;
}

public function getNodeType(): string
Expand All @@ -38,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
if ($node instanceof BinaryOpMinus) {
$left = $node->left;
$right = $node->right;
} elseif ($node instanceof AssignOpMinus && $this->bleedingEdge) {
} elseif ($node instanceof AssignOpMinus) {
$left = $node->var;
$right = $node->expr;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected function getRule(): Rule
new BooleanRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected function getRule(): Rule
new BooleanRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ protected function getRule(): Rule
new OperatorRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected function getRule(): Rule
new OperatorRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected function getRule(): Rule
new OperatorRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected function getRule(): Rule
new OperatorRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected function getRule(): Rule
new OperatorRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ protected function getRule(): Rule
new OperatorRuleHelper(
self::getContainer()->getByType(RuleLevelHelper::class),
),
true,
);
}

Expand Down

0 comments on commit 914b5e3

Please sign in to comment.