Skip to content

Commit 53818d6

Browse files
committed
Fix container exception class name
1 parent f8d530e commit 53818d6

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/Container/ConfigContainer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace FastForward\Config\Container;
1717

1818
use FastForward\Config\ConfigInterface;
19-
use FastForward\Config\Exception\ContainerNotFoundExceptionInterface;
19+
use FastForward\Config\Exception\ContainerNotFoundException;
2020
use Psr\Container\ContainerInterface;
2121

2222
/**
@@ -63,13 +63,13 @@ public function has(string $id): bool
6363
*
6464
* If the ID matches the container itself or the config class, it SHALL return itself.
6565
* Otherwise, it SHALL retrieve the value from the configuration.
66-
* If the key is not found, it MUST throw a ContainerNotFoundExceptionInterface.
66+
* If the key is not found, it MUST throw a ContainerNotFoundException.
6767
*
6868
* @param string $id identifier of the entry to retrieve
6969
*
7070
* @return mixed the value associated with the identifier
7171
*
72-
* @throws ContainerNotFoundExceptionInterface if the identifier is not found
72+
* @throws ContainerNotFoundException if the identifier is not found
7373
*/
7474
public function get(string $id)
7575
{
@@ -81,7 +81,7 @@ public function get(string $id)
8181
return $this->config->get($id);
8282
}
8383

84-
throw ContainerNotFoundExceptionInterface::forKey($id);
84+
throw ContainerNotFoundException::forKey($id);
8585
}
8686

8787
/**

src/Exception/ContainerNotFoundExceptionInterface.php renamed to src/Exception/ContainerNotFoundException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
use Psr\Container\NotFoundExceptionInterface;
1919

2020
/**
21-
* Class ContainerNotFoundExceptionInterface.
21+
* Class ContainerNotFoundException.
2222
*
2323
* Exception thrown when a configuration key is not found in the container.
2424
* This class MUST implement the PSR-11 NotFoundExceptionInterface.
2525
*/
26-
final class ContainerNotFoundExceptionInterface extends \Exception implements NotFoundExceptionInterface
26+
final class ContainerNotFoundException extends \Exception implements NotFoundExceptionInterface
2727
{
2828
/**
2929
* Creates a new exception instance for a missing configuration key.

tests/Container/ConfigContainerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use FastForward\Config\ArrayConfig;
1919
use FastForward\Config\ConfigInterface;
2020
use FastForward\Config\Container\ConfigContainer;
21-
use FastForward\Config\Exception\ContainerNotFoundExceptionInterface;
21+
use FastForward\Config\Exception\ContainerNotFoundException;
2222
use PHPUnit\Framework\Attributes\CoversClass;
2323
use PHPUnit\Framework\Attributes\Test;
2424
use PHPUnit\Framework\Attributes\UsesClass;
@@ -29,7 +29,7 @@
2929
*/
3030
#[CoversClass(ConfigContainer::class)]
3131
#[UsesClass(ArrayConfig::class)]
32-
#[UsesClass(ContainerNotFoundExceptionInterface::class)]
32+
#[UsesClass(ContainerNotFoundException::class)]
3333
final class ConfigContainerTest extends TestCase
3434
{
3535
#[Test]
@@ -90,7 +90,7 @@ public function testGetReturnsConfigValueForKey(): void
9090
#[Test]
9191
public function testGetThrowsExceptionForUnknownKey(): void
9292
{
93-
$this->expectException(ContainerNotFoundExceptionInterface::class);
93+
$this->expectException(ContainerNotFoundException::class);
9494

9595
$config = new ArrayConfig();
9696
$container = new ConfigContainer($config);

tests/Exception/ContainerNotFoundExceptionInterfaceTest.php renamed to tests/Exception/ContainerNotFoundExceptionTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace FastForward\Config\Tests\Exception;
1717

18-
use FastForward\Config\Exception\ContainerNotFoundExceptionInterface;
18+
use FastForward\Config\Exception\ContainerNotFoundException;
1919
use PHPUnit\Framework\Attributes\CoversClass;
2020
use PHPUnit\Framework\Attributes\Test;
2121
use PHPUnit\Framework\TestCase;
@@ -24,17 +24,17 @@
2424
/**
2525
* @internal
2626
*/
27-
#[CoversClass(ContainerNotFoundExceptionInterface::class)]
28-
final class ContainerNotFoundExceptionInterfaceTest extends TestCase
27+
#[CoversClass(ContainerNotFoundException::class)]
28+
final class ContainerNotFoundExceptionTest extends TestCase
2929
{
3030
#[Test]
3131
public function testForKeyReturnsExpectedMessage(): void
3232
{
3333
$key = uniqid('missing_', true);
3434

35-
$exception = ContainerNotFoundExceptionInterface::forKey($key);
35+
$exception = ContainerNotFoundException::forKey($key);
3636

37-
self::assertInstanceOf(ContainerNotFoundExceptionInterface::class, $exception);
37+
self::assertInstanceOf(ContainerNotFoundException::class, $exception);
3838
self::assertInstanceOf(NotFoundExceptionInterface::class, $exception);
3939
self::assertSame(\sprintf('Config key "%s" not found.', $key), $exception->getMessage());
4040
}

0 commit comments

Comments
 (0)