Skip to content

Commit dfb2e11

Browse files
committed
Minor fixes
1 parent ed6f16d commit dfb2e11

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

src/ConstantExtractor.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
use ReflectionException;
99
use Yokai\EnumBundle\Exception\CannotExtractConstantsException;
1010

11-
final class ConstantExtractor
11+
/**
12+
* @internal
13+
*
14+
* @author Yann Eugoné <[email protected]>
15+
*/
16+
class ConstantExtractor
1217
{
1318
public function extract(string $pattern): array
1419
{
@@ -26,7 +31,7 @@ private function filter(array $constants, string $regexp, string $pattern): arra
2631
$matchingNames = preg_grep($regexp, array_keys($constants));
2732

2833
if (count($matchingNames) === 0) {
29-
throw CannotExtractConstantsException::noConstantMathingPattern($pattern);
34+
throw CannotExtractConstantsException::noConstantMatchingPattern($pattern);
3035
}
3136

3237
return array_values(array_intersect_key($constants, array_flip($matchingNames)));

src/ConstantListEnum.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace Yokai\EnumBundle;
66

7+
/**
8+
* @author Yann Eugoné <[email protected]>
9+
*/
710
class ConstantListEnum extends ConfigurableEnum
811
{
912
/**

src/ConstantListTranslatedEnum.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use Symfony\Contracts\Translation\TranslatorInterface;
88

9+
/**
10+
* @author Yann Eugoné <[email protected]>
11+
*/
912
class ConstantListTranslatedEnum extends ConfigurableTranslatedEnum
1013
{
1114
/**

src/EnumRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function get(string $name): EnumInterface
5151
*
5252
* @return bool
5353
*/
54-
public function has($name): bool
54+
public function has(string $name): bool
5555
{
5656
return isset($this->enums[$name]);
5757
}

src/Exception/CannotExtractConstantsException.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
use InvalidArgumentException;
88

9-
final class CannotExtractConstantsException extends InvalidArgumentException
9+
/**
10+
* @author Yann Eugoné <[email protected]>
11+
*/
12+
class CannotExtractConstantsException extends InvalidArgumentException
1013
{
1114
public static function invalidPattern(string $pattern): self
1215
{
@@ -25,7 +28,7 @@ public static function classHasNoPublicConstant(string $class): self
2528
return new self("Class $class has no public constant.");
2629
}
2730

28-
public static function noConstantMathingPattern(string $pattern): self
31+
public static function noConstantMatchingPattern(string $pattern): self
2932
{
3033
return new self("Pattern $pattern matches no constant.");
3134
}

0 commit comments

Comments
 (0)