Skip to content

Commit 639d46a

Browse files
committed
Add return typehints to toString methods for compatibility with PHPUnit 7
1 parent 3606abc commit 639d46a

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

PhpUnit/ConfigurationValuesAreInvalidConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function evaluate($other, $description = '', $returnResult = false)
4141
$this->fail($other, $description);
4242
}
4343

44-
public function toString()
44+
public function toString(): string
4545
{
4646
$toString = 'is invalid for the given configuration';
4747

PhpUnit/ConfigurationValuesAreValidConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function evaluate($other, $description = '', $returnResult = false)
3434
}
3535
}
3636

37-
public function toString()
37+
public function toString(): string
3838
{
3939
return 'is valid for the given configuration';
4040
}

PhpUnit/ProcessedConfigurationEqualsConstraint.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ public function evaluate($other, $description = '', $returnResult = false)
2929
return $constraint->evaluate($processedConfiguration, '', $returnResult);
3030
}
3131

32-
public function toString()
32+
public function toString(): string
3333
{
3434
// won't be used, this constraint only wraps IsEqual
35+
return '';
3536
}
3637
}

Tests/PhpUnit/ProcessedConfigurationEqualsConstraintTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public function to_string_is_not_implemented()
4747
array()
4848
);
4949

50-
$this->assertNull($constraint->toString());
50+
$this->assertEquals('', $constraint->toString());
5151
}
5252
}

0 commit comments

Comments
 (0)