Skip to content

Commit cc473c0

Browse files
committed
Add InvalidArgumentException & Exception
1 parent b96ee2b commit cc473c0

File tree

8 files changed

+54
-6
lines changed

8 files changed

+54
-6
lines changed

src/Component/legacy/spec/Exception/DeleteHandlingExceptionSpec.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
namespace spec\Sylius\Component\Resource\Exception;
1515

1616
use PhpSpec\ObjectBehavior;
17+
use Sylius\Resource\Exception\ExceptionInterface;
18+
use Sylius\Resource\Exception\RuntimeException;
1719

1820
final class DeleteHandlingExceptionSpec extends ObjectBehavior
1921
{
@@ -22,6 +24,16 @@ function it_extends_an_exception(): void
2224
$this->shouldHaveType(\Exception::class);
2325
}
2426

27+
function it_is_a_runtime_exception(): void
28+
{
29+
$this->shouldHaveType(RuntimeException::class);
30+
}
31+
32+
function it_implements_exception_interface(): void
33+
{
34+
$this->shouldImplement(ExceptionInterface::class);
35+
}
36+
2537
function it_has_a_message(): void
2638
{
2739
$this->getMessage()->shouldReturn('Ups, something went wrong during deleting a resource, please try again.');

src/Component/src/Exception/DeleteHandlingException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Sylius\Resource\Exception;
1515

16-
class DeleteHandlingException extends \Exception
16+
class DeleteHandlingException extends RuntimeException
1717
{
1818
protected string $flash;
1919

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Sylius\Resource\Exception;
15+
16+
class Exception extends \Exception implements ExceptionInterface
17+
{
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Sylius\Resource\Exception;
15+
16+
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
17+
{
18+
}

src/Component/src/Exception/UnexpectedTypeException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Sylius\Resource\Exception;
1515

16-
class UnexpectedTypeException extends \InvalidArgumentException
16+
class UnexpectedTypeException extends InvalidArgumentException
1717
{
1818
/**
1919
* @param mixed $value
@@ -23,7 +23,7 @@ public function __construct($value, string $expectedType)
2323
parent::__construct(sprintf(
2424
'Expected argument of type "%s", "%s" given.',
2525
$expectedType,
26-
is_object($value) ? get_class($value) : gettype($value),
26+
get_debug_type($value),
2727
));
2828
}
2929
}

src/Component/src/Exception/UnsupportedMethodException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Sylius\Resource\Exception;
1515

16-
class UnsupportedMethodException extends \Exception
16+
class UnsupportedMethodException extends Exception
1717
{
1818
public function __construct(string $methodName)
1919
{

src/Component/src/Exception/UpdateHandlingException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Sylius\Resource\Exception;
1515

16-
class UpdateHandlingException extends \Exception
16+
class UpdateHandlingException extends Exception
1717
{
1818
protected string $flash;
1919

src/Component/src/Exception/VariantWithNoOptionsValuesException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Sylius\Resource\Exception;
1515

16-
final class VariantWithNoOptionsValuesException extends \Exception
16+
final class VariantWithNoOptionsValuesException extends Exception
1717
{
1818
public function __construct()
1919
{

0 commit comments

Comments
 (0)