Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 235b34e

Browse files
committed
chore: improved comparable assertion naming
1 parent bcbca3c commit 235b34e

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Rule/GreaterThan.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace ProgrammatorDev\YetAnotherPhpValidator\Rule;
44

55
use ProgrammatorDev\YetAnotherPhpValidator\Exception\GreaterThanException;
6-
use ProgrammatorDev\YetAnotherPhpValidator\Rule\Util\AssertComparisonTrait;
6+
use ProgrammatorDev\YetAnotherPhpValidator\Rule\Util\AssertComparableTrait;
77

88
class GreaterThan extends AbstractRule implements RuleInterface
99
{
10-
use AssertComparisonTrait;
10+
use AssertComparableTrait;
1111

1212
private string $message;
1313

@@ -25,7 +25,7 @@ public function __construct(
2525
public function assert(mixed $value, string $name): void
2626
{
2727
// Assert if constraint and value can be compared
28-
$this->assertComparison($this->constraint, $value, GreaterThanException::class);
28+
$this->assertComparable($this->constraint, $value, GreaterThanException::class);
2929

3030
if (!($value > $this->constraint)) {
3131
throw new GreaterThanException(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace ProgrammatorDev\YetAnotherPhpValidator\Rule\Util;
44

5-
trait AssertComparisonTrait
5+
trait AssertComparableTrait
66
{
7-
private function assertComparison(mixed $value1, mixed $value2, string $exception): bool
7+
private function assertComparable(mixed $value1, mixed $value2, string $exception): bool
88
{
99
if ($value1 instanceof \DateTimeInterface && $value2 instanceof \DateTimeInterface) {
1010
return true;

src/Test/Util/TestRuleFailureConditionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function testRuleFailureCondition(
1515
mixed $value,
1616
string $expectedException,
1717
string $expectedExceptionMessage
18-
)
18+
): void
1919
{
2020
$this->assertFalse($rule->validate($value));
2121

src/Test/Util/TestRuleSuccessConditionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait TestRuleSuccessConditionTrait
1010
public static abstract function provideSuccessConditionData(): \Generator;
1111

1212
#[DataProvider('provideSuccessConditionData')]
13-
public function testRuleSuccessCondition(RuleInterface $rule, mixed $value)
13+
public function testRuleSuccessCondition(RuleInterface $rule, mixed $value): void
1414
{
1515
$rule->assert($value, 'test');
1616

0 commit comments

Comments
 (0)