Commit 1bebee23 authored by Jan Kuchař's avatar Jan Kuchař

typo

parent 0696ddde
Pipeline #14335 passed with stages
in 1 minute and 21 seconds
......@@ -38,7 +38,7 @@ abstract class Enum
* Builds enumeration from its scalar value.
* @param string|int $scalar
* @return static
* @throws MissingValueValueException if there is no value for given scalar
* @throws MissingValueDeclarationException if there is no value for given scalar
*/
public static function fromScalar($scalar): Enum
{
......
......@@ -3,7 +3,7 @@
namespace Grifart\Enum\Internal;
use Grifart\Enum\Enum;
use Grifart\Enum\MissingValueValueException;
use Grifart\Enum\MissingValueDeclarationException;
final class Meta
{
......@@ -79,12 +79,12 @@ final class Meta
/**
* @param int|string $scalar
* @throws MissingValueValueException if there is no value for given scalar
* @throws MissingValueDeclarationException if there is no value for given scalar
*/
public function getValueForScalar($scalar): Enum
{
if (!isset($this->scalarToValue[$scalar])) {
throw new MissingValueValueException("There is no value for enum '{$this->class}' and scalar value '$scalar'.");
throw new MissingValueDeclarationException("There is no value for enum '{$this->class}' and scalar value '$scalar'.");
}
return $this->scalarToValue[$scalar];
}
......
......@@ -14,4 +14,4 @@ namespace Grifart\Enum;
final class UsageException extends \LogicException {}
abstract class RuntimeException extends \RuntimeException {}
final class MissingValueValueException extends RuntimeException {}
\ No newline at end of file
final class MissingValueDeclarationException extends RuntimeException {}
\ No newline at end of file
<?php declare(strict_types=1);
use Grifart\Enum\MissingValueValueException;
use Grifart\Enum\MissingValueDeclarationException;
require __DIR__ . '/../bootstrap.php';
......@@ -17,6 +17,6 @@ class Enum1 extends \Grifart\Enum\Enum
function () {
Enum1::fromScalar('non-existing');
},
MissingValueValueException::class,
MissingValueDeclarationException::class,
"There is no value for enum 'Enum1' and scalar value 'non-existing'."
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment