Skip to content

Commit 8665b24

Browse files
committed
refactor: renamed SpecificationException to DissatisfiedSpecification
1 parent 2ed72c8 commit 8665b24

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to `laravel-specification-pattern` will be documented in thi
66

77
### Changed
88

9+
- Renamed `SpecificationException` to `DissatisfiedSpecification`.
910
- Marked the following classes as final:
1011
- `AndSpecification`.
1112
- `NotSpecification`.

src/SpecificationException.php renamed to src/DissatisfiedSpecification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
use Exception;
88

9-
class SpecificationException extends Exception
9+
final class DissatisfiedSpecification extends Exception
1010
{
1111
}

src/VerboseSpecification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public function message(): string
3939
/**
4040
* @param TCandidate $candidate
4141
*
42-
* @throws SpecificationException
42+
* @throws DissatisfiedSpecification
4343
*/
4444
public function isSatisfiedBy(mixed $candidate): bool
4545
{
4646
if ($this->origin->isSatisfiedBy($candidate)) {
4747
return true;
4848
}
4949

50-
throw new SpecificationException($this->message);
50+
throw new DissatisfiedSpecification($this->message);
5151
}
5252
}

tests/VerboseExceptionTest.php renamed to tests/VerboseSpecificationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Maartenpaauw\Specifications\Tests;
66

7-
use Maartenpaauw\Specifications\SpecificationException;
7+
use Maartenpaauw\Specifications\DissatisfiedSpecification;
88
use Maartenpaauw\Specifications\Tests\Dummy\LengthSpecification;
99
use Maartenpaauw\Specifications\VerboseSpecification;
1010

11-
class VerboseExceptionTest extends TestCase
11+
class VerboseSpecificationTest extends TestCase
1212
{
1313
/** @var VerboseSpecification<string> */
1414
private VerboseSpecification $specification;
@@ -26,7 +26,7 @@ protected function setUp(): void
2626
public function it_should_throw_an_exception_with_an_empty_message_when_the_specification_is_not_satisfied(): void
2727
{
2828
// Assert
29-
$this->expectException(SpecificationException::class);
29+
$this->expectException(DissatisfiedSpecification::class);
3030
$this->expectExceptionMessage('');
3131

3232
// Act
@@ -37,7 +37,7 @@ public function it_should_throw_an_exception_with_an_empty_message_when_the_spec
3737
public function it_should_be_possible_to_customize_the_exception_message(): void
3838
{
3939
// Assert
40-
$this->expectException(SpecificationException::class);
40+
$this->expectException(DissatisfiedSpecification::class);
4141
$this->expectExceptionMessage('The given string is longer than 12 characters!');
4242

4343
// Act

0 commit comments

Comments
 (0)