Skip to content

Commit

Permalink
Make Description because empty by default
Browse files Browse the repository at this point in the history
This will reduce redundant code
  • Loading branch information
hgraca committed Oct 1, 2023
1 parent fce550e commit 7752021
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Expression/Description.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Description
/** @var string */
private $description;

public function __construct(string $description, string $because)
public function __construct(string $description, string $because = '')
{
$this->description = $description;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Expressions/DescriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DescriptionTest extends TestCase
{
public function test_it_should_return_description(): void
{
$description = new Description('an example', '');
$description = new Description('an example');
self::assertEquals('an example', $description->toString());
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Rules/ConstraintsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function test_it_should_not_add_to_violation_if_constraint_is_not_violate
$trueExpression = new class() implements Expression {
public function describe(ClassDescription $theClass, string $because = ''): Description
{
return new Description('', '');
return new Description('');
}

public function evaluate(ClassDescription $theClass, Violations $violations, string $because = ''): void
Expand Down

0 comments on commit 7752021

Please sign in to comment.