-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report an error instead of a failure when the prerequisites for using…
… the custom comparison function are not met
- Loading branch information
1 parent
6f084fa
commit 6099c5e
Showing
8 changed files
with
301 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/Framework/Exception/ActualValueIsNotAnObjectException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Framework; | ||
|
||
use const PHP_EOL; | ||
|
||
/** | ||
* @internal This class is not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
final class ActualValueIsNotAnObjectException extends Exception | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct( | ||
'Actual value is not an object', | ||
0, | ||
null | ||
); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return $this->getMessage() . PHP_EOL; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/Framework/Exception/ComparisonMethodDoesNotAcceptParameterTypeException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Framework; | ||
|
||
use const PHP_EOL; | ||
use function sprintf; | ||
|
||
/** | ||
* @internal This class is not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
final class ComparisonMethodDoesNotAcceptParameterTypeException extends Exception | ||
{ | ||
public function __construct(string $className, string $methodName, string $type) | ||
{ | ||
parent::__construct( | ||
sprintf( | ||
'%s is not an accepted argument type for comparison method %s::%s().', | ||
$type, | ||
$className, | ||
$methodName | ||
), | ||
0, | ||
null | ||
); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return $this->getMessage() . PHP_EOL; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Framework/Exception/ComparisonMethodDoesNotDeclareBoolReturnTypeException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Framework; | ||
|
||
use const PHP_EOL; | ||
use function sprintf; | ||
|
||
/** | ||
* @internal This class is not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
final class ComparisonMethodDoesNotDeclareBoolReturnTypeException extends Exception | ||
{ | ||
public function __construct(string $className, string $methodName) | ||
{ | ||
parent::__construct( | ||
sprintf( | ||
'Comparison method %s::%s() does not declare bool return type.', | ||
$className, | ||
$methodName | ||
), | ||
0, | ||
null | ||
); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return $this->getMessage() . PHP_EOL; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Framework/Exception/ComparisonMethodDoesNotDeclareExactlyOneParameterException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Framework; | ||
|
||
use const PHP_EOL; | ||
use function sprintf; | ||
|
||
/** | ||
* @internal This class is not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
final class ComparisonMethodDoesNotDeclareExactlyOneParameterException extends Exception | ||
{ | ||
public function __construct(string $className, string $methodName) | ||
{ | ||
parent::__construct( | ||
sprintf( | ||
'Comparison method %s::%s() does not declare exactly one parameter.', | ||
$className, | ||
$methodName | ||
), | ||
0, | ||
null | ||
); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return $this->getMessage() . PHP_EOL; | ||
} | ||
} |
Oops, something went wrong.