Skip to content

Commit 477f53a

Browse files
committed
Error identifiers
1 parent 872bc91 commit 477f53a

File tree

39 files changed

+85
-42
lines changed

39 files changed

+85
-42
lines changed

src/Rules/BooleansInConditions/BooleanInBooleanAndRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function processNode(Node $node, Scope $scope): array
3838
$messages[] = RuleErrorBuilder::message(sprintf(
3939
'Only booleans are allowed in &&, %s given on the left side.',
4040
$leftType->describe(VerbosityLevel::typeOnly())
41-
))->build();
41+
))->identifier('booleanAnd.leftNotBoolean')->build();
4242
}
4343

4444
$rightScope = $node->getRightScope();
@@ -47,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array
4747
$messages[] = RuleErrorBuilder::message(sprintf(
4848
'Only booleans are allowed in &&, %s given on the right side.',
4949
$rightType->describe(VerbosityLevel::typeOnly())
50-
))->build();
50+
))->identifier('booleanAnd.rightNotBoolean')->build();
5151
}
5252

5353
return $messages;

src/Rules/BooleansInConditions/BooleanInBooleanNotRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function processNode(Node $node, Scope $scope): array
4141
RuleErrorBuilder::message(sprintf(
4242
'Only booleans are allowed in a negated boolean, %s given.',
4343
$expressionType->describe(VerbosityLevel::typeOnly())
44-
))->build(),
44+
))->identifier('booleanNot.exprNotBoolean')->build(),
4545
];
4646
}
4747

src/Rules/BooleansInConditions/BooleanInBooleanOrRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function processNode(Node $node, Scope $scope): array
3838
$messages[] = RuleErrorBuilder::message(sprintf(
3939
'Only booleans are allowed in ||, %s given on the left side.',
4040
$leftType->describe(VerbosityLevel::typeOnly())
41-
))->build();
41+
))->identifier('booleanOr.leftNotBoolean')->build();
4242
}
4343

4444
$rightScope = $node->getRightScope();
@@ -47,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array
4747
$messages[] = RuleErrorBuilder::message(sprintf(
4848
'Only booleans are allowed in ||, %s given on the right side.',
4949
$rightType->describe(VerbosityLevel::typeOnly())
50-
))->build();
50+
))->identifier('booleanOr.rightNotBoolean')->build();
5151
}
5252

5353
return $messages;

src/Rules/BooleansInConditions/BooleanInElseIfConditionRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function processNode(Node $node, Scope $scope): array
4141
RuleErrorBuilder::message(sprintf(
4242
'Only booleans are allowed in an elseif condition, %s given.',
4343
$conditionExpressionType->describe(VerbosityLevel::typeOnly())
44-
))->build(),
44+
))->identifier('elseif.condNotBoolean')->build(),
4545
];
4646
}
4747

src/Rules/BooleansInConditions/BooleanInIfConditionRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function processNode(Node $node, Scope $scope): array
4141
RuleErrorBuilder::message(sprintf(
4242
'Only booleans are allowed in an if condition, %s given.',
4343
$conditionExpressionType->describe(VerbosityLevel::typeOnly())
44-
))->build(),
44+
))->identifier('if.condNotBoolean')->build(),
4545
];
4646
}
4747

src/Rules/BooleansInConditions/BooleanInTernaryOperatorRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function processNode(Node $node, Scope $scope): array
4545
RuleErrorBuilder::message(sprintf(
4646
'Only booleans are allowed in a ternary operator condition, %s given.',
4747
$conditionExpressionType->describe(VerbosityLevel::typeOnly())
48-
))->build(),
48+
))->identifier('ternary.condNotBoolean')->build(),
4949
];
5050
}
5151

src/Rules/Cast/UselessCastRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function processNode(Node $node, Scope $scope): array
6262
'Casting to %s something that\'s already %s.',
6363
$castType->describe(VerbosityLevel::typeOnly()),
6464
$expressionType->describe(VerbosityLevel::typeOnly())
65-
)))->build(),
65+
)))->identifier('cast.useless')->build(),
6666
];
6767
}
6868

src/Rules/Classes/RequireParentConstructCallRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function processNode(Node $node, Scope $scope): array
6060
'%s::__construct() does not call parent constructor from %s.',
6161
$classReflection->getName(),
6262
$parentClass->getName()
63-
))->build(),
63+
))->identifier('constructor.missingParentCall')->build(),
6464
];
6565
}
6666

src/Rules/DisallowedConstructs/DisallowedBacktickRule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function processNode(Node $node, Scope $scope): array
2323
{
2424
return [
2525
RuleErrorBuilder::message('Backtick operator is not allowed. Use shell_exec() instead.')
26+
->identifier('backtick.notAllowed')
2627
->build(),
2728
];
2829
}

src/Rules/DisallowedConstructs/DisallowedEmptyRule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function processNode(Node $node, Scope $scope): array
2323
{
2424
return [
2525
RuleErrorBuilder::message('Construct empty() is not allowed. Use more strict comparison.')
26+
->identifier('empty.notAllowed')
2627
->build(),
2728
];
2829
}

0 commit comments

Comments
 (0)