| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 | public function __construct( | 
| 26 | 26 | protected Finder $finder, | 
| 27 | 27 | protected readonly bool $debug = false, | 
| 28 | -    ) { | |
| 28 | +    ){ | |
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | 31 | /** | 
| @@ -37,13 +37,13 @@ discard block | ||
| 37 | 37 | */ | 
| 38 | 38 | protected function availableReflections(): \Generator | 
| 39 | 39 |      { | 
| 40 | -        foreach ($this->finder->getIterator() as $file) { | |
| 40 | +        foreach ($this->finder->getIterator() as $file){ | |
| 41 | 41 | $reflection = new ReflectionFile((string)$file); | 
| 42 | 42 | |
| 43 | -            if ($reflection->hasIncludes()) { | |
| 43 | +            if ($reflection->hasIncludes()){ | |
| 44 | 44 | // We are not analyzing files which has includes, it's not safe to require such reflections | 
| 45 | 45 | $this->getLogger()->warning( | 
| 46 | -                    \sprintf('File `%s` has includes and excluded from analysis', (string) $file), | |
| 46 | +                    \sprintf('File `%s` has includes and excluded from analysis', (string)$file), | |
| 47 | 47 | ['file' => $file] | 
| 48 | 48 | ); | 
| 49 | 49 | |
| @@ -66,8 +66,8 @@ discard block | ||
| 66 | 66 | */ | 
| 67 | 67 | protected function classReflection(string $class): \ReflectionClass | 
| 68 | 68 |      { | 
| 69 | -        $loader = static function ($class) { | |
| 70 | -            if ($class === LocatorException::class) { | |
| 69 | +        $loader = static function ($class){ | |
| 70 | +            if ($class === LocatorException::class){ | |
| 71 | 71 | return; | 
| 72 | 72 | } | 
| 73 | 73 | |
| @@ -77,12 +77,12 @@ discard block | ||
| 77 | 77 | //To suspend class dependency exception | 
| 78 | 78 | \spl_autoload_register($loader); | 
| 79 | 79 | |
| 80 | -        try { | |
| 80 | +        try{ | |
| 81 | 81 | //In some cases reflection can thrown an exception if class invalid or can not be loaded, | 
| 82 | 82 | //we are going to handle such exception and convert it soft exception | 
| 83 | 83 | return new \ReflectionClass($class); | 
| 84 | -        } catch (\Throwable $e) { | |
| 85 | -            if ($e instanceof LocatorException && $e->getPrevious() != null) { | |
| 84 | +        }catch (\Throwable $e){ | |
| 85 | +            if ($e instanceof LocatorException && $e->getPrevious() != null){ | |
| 86 | 86 | $e = $e->getPrevious(); | 
| 87 | 87 | } | 
| 88 | 88 | |
| @@ -97,8 +97,8 @@ discard block | ||
| 97 | 97 | ['error' => $e] | 
| 98 | 98 | ); | 
| 99 | 99 | |
| 100 | - throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); | |
| 101 | -        } finally { | |
| 100 | + throw new LocatorException($e->getMessage(), (int)$e->getCode(), $e); | |
| 101 | +        }finally{ | |
| 102 | 102 | \spl_autoload_unregister($loader); | 
| 103 | 103 | } | 
| 104 | 104 | } | 
| @@ -116,7 +116,7 @@ discard block | ||
| 116 | 116 | protected function enumReflection(string $enum): \ReflectionEnum | 
| 117 | 117 |      { | 
| 118 | 118 |          $loader = static function (string $enum): void { | 
| 119 | -            if ($enum === LocatorException::class) { | |
| 119 | +            if ($enum === LocatorException::class){ | |
| 120 | 120 | return; | 
| 121 | 121 | } | 
| 122 | 122 | |
| @@ -126,12 +126,12 @@ discard block | ||
| 126 | 126 | //To suspend class dependency exception | 
| 127 | 127 | \spl_autoload_register($loader); | 
| 128 | 128 | |
| 129 | -        try { | |
| 129 | +        try{ | |
| 130 | 130 | //In some enum reflection can thrown an exception if enum invalid or can not be loaded, | 
| 131 | 131 | //we are going to handle such exception and convert it soft exception | 
| 132 | 132 | return new \ReflectionEnum($enum); | 
| 133 | -        } catch (\Throwable $e) { | |
| 134 | -            if ($e instanceof LocatorException && $e->getPrevious() != null) { | |
| 133 | +        }catch (\Throwable $e){ | |
| 134 | +            if ($e instanceof LocatorException && $e->getPrevious() != null){ | |
| 135 | 135 | $e = $e->getPrevious(); | 
| 136 | 136 | } | 
| 137 | 137 | |
| @@ -146,8 +146,8 @@ discard block | ||
| 146 | 146 | ['error' => $e] | 
| 147 | 147 | ); | 
| 148 | 148 | |
| 149 | - throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); | |
| 150 | -        } finally { | |
| 149 | + throw new LocatorException($e->getMessage(), (int)$e->getCode(), $e); | |
| 150 | +        }finally{ | |
| 151 | 151 | \spl_autoload_unregister($loader); | 
| 152 | 152 | } | 
| 153 | 153 | } | 
| @@ -37,10 +37,12 @@ discard block | ||
| 37 | 37 | */ | 
| 38 | 38 | protected function availableReflections(): \Generator | 
| 39 | 39 |      { | 
| 40 | -        foreach ($this->finder->getIterator() as $file) { | |
| 40 | + foreach ($this->finder->getIterator() as $file) | |
| 41 | +        { | |
| 41 | 42 | $reflection = new ReflectionFile((string)$file); | 
| 42 | 43 | |
| 43 | -            if ($reflection->hasIncludes()) { | |
| 44 | + if ($reflection->hasIncludes()) | |
| 45 | +            { | |
| 44 | 46 | // We are not analyzing files which has includes, it's not safe to require such reflections | 
| 45 | 47 | $this->getLogger()->warning( | 
| 46 | 48 |                      \sprintf('File `%s` has includes and excluded from analysis', (string) $file), | 
| @@ -66,8 +68,10 @@ discard block | ||
| 66 | 68 | */ | 
| 67 | 69 | protected function classReflection(string $class): \ReflectionClass | 
| 68 | 70 |      { | 
| 69 | -        $loader = static function ($class) { | |
| 70 | -            if ($class === LocatorException::class) { | |
| 71 | + $loader = static function ($class) | |
| 72 | +        { | |
| 73 | + if ($class === LocatorException::class) | |
| 74 | +            { | |
| 71 | 75 | return; | 
| 72 | 76 | } | 
| 73 | 77 | |
| @@ -77,12 +81,16 @@ discard block | ||
| 77 | 81 | //To suspend class dependency exception | 
| 78 | 82 | \spl_autoload_register($loader); | 
| 79 | 83 | |
| 80 | -        try { | |
| 84 | + try | |
| 85 | +        { | |
| 81 | 86 | //In some cases reflection can thrown an exception if class invalid or can not be loaded, | 
| 82 | 87 | //we are going to handle such exception and convert it soft exception | 
| 83 | 88 | return new \ReflectionClass($class); | 
| 84 | -        } catch (\Throwable $e) { | |
| 85 | -            if ($e instanceof LocatorException && $e->getPrevious() != null) { | |
| 89 | + } | |
| 90 | + catch (\Throwable $e) | |
| 91 | +        { | |
| 92 | + if ($e instanceof LocatorException && $e->getPrevious() != null) | |
| 93 | +            { | |
| 86 | 94 | $e = $e->getPrevious(); | 
| 87 | 95 | } | 
| 88 | 96 | |
| @@ -98,7 +106,9 @@ discard block | ||
| 98 | 106 | ); | 
| 99 | 107 | |
| 100 | 108 | throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); | 
| 101 | -        } finally { | |
| 109 | + } | |
| 110 | + finally | |
| 111 | +        { | |
| 102 | 112 | \spl_autoload_unregister($loader); | 
| 103 | 113 | } | 
| 104 | 114 | } | 
| @@ -116,7 +126,8 @@ discard block | ||
| 116 | 126 | protected function enumReflection(string $enum): \ReflectionEnum | 
| 117 | 127 |      { | 
| 118 | 128 |          $loader = static function (string $enum): void { | 
| 119 | -            if ($enum === LocatorException::class) { | |
| 129 | + if ($enum === LocatorException::class) | |
| 130 | +            { | |
| 120 | 131 | return; | 
| 121 | 132 | } | 
| 122 | 133 | |
| @@ -126,12 +137,16 @@ discard block | ||
| 126 | 137 | //To suspend class dependency exception | 
| 127 | 138 | \spl_autoload_register($loader); | 
| 128 | 139 | |
| 129 | -        try { | |
| 140 | + try | |
| 141 | +        { | |
| 130 | 142 | //In some enum reflection can thrown an exception if enum invalid or can not be loaded, | 
| 131 | 143 | //we are going to handle such exception and convert it soft exception | 
| 132 | 144 | return new \ReflectionEnum($enum); | 
| 133 | -        } catch (\Throwable $e) { | |
| 134 | -            if ($e instanceof LocatorException && $e->getPrevious() != null) { | |
| 145 | + } | |
| 146 | + catch (\Throwable $e) | |
| 147 | +        { | |
| 148 | + if ($e instanceof LocatorException && $e->getPrevious() != null) | |
| 149 | +            { | |
| 135 | 150 | $e = $e->getPrevious(); | 
| 136 | 151 | } | 
| 137 | 152 | |
| @@ -147,7 +162,9 @@ discard block | ||
| 147 | 162 | ); | 
| 148 | 163 | |
| 149 | 164 | throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); | 
| 150 | -        } finally { | |
| 165 | + } | |
| 166 | + finally | |
| 167 | +        { | |
| 151 | 168 | \spl_autoload_unregister($loader); | 
| 152 | 169 | } | 
| 153 | 170 | } | 
| @@ -20,5 +20,5 @@ | ||
| 20 | 20 | * | 
| 21 | 21 | * @return array<class-string, ReflectionEnum> | 
| 22 | 22 | */ | 
| 23 | - public function getEnums(object|string|null $target = null): array; | |
| 23 | + public function getEnums(object | string | null $target = null): array; | |
| 24 | 24 | } | 
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | public function __construct( | 
| 17 | 17 | private readonly EnumsInterface $enums, | 
| 18 | 18 | private readonly ScopedEnumsInterface $scopedEnums, | 
| 19 | -    ) { | |
| 19 | +    ){ | |
| 20 | 20 | } | 
| 21 | 21 | |
| 22 | 22 | /** | 
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 |  { | 
| 17 | 17 | public function __construct( | 
| 18 | 18 | private readonly Tokenizer $tokenizer | 
| 19 | -    ) { | |
| 19 | +    ){ | |
| 20 | 20 | } | 
| 21 | 21 | |
| 22 | 22 | /** | 
| @@ -16,5 +16,5 @@ | ||
| 16 | 16 | * | 
| 17 | 17 | * @return \ReflectionEnum[] | 
| 18 | 18 | */ | 
| 19 | - public function getScopedEnums(string $scope, object|string|null $target = null): array; | |
| 19 | + public function getScopedEnums(string $scope, object | string | null $target = null): array; | |
| 20 | 20 | } | 
| @@ -101,16 +101,16 @@ | ||
| 101 | 101 | |
| 102 | 102 | public function isLoadClassesEnabled(): bool | 
| 103 | 103 |      { | 
| 104 | - return (bool) ($this->config['load']['classes'] ?? true); | |
| 104 | + return (bool)($this->config['load']['classes'] ?? true); | |
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | 107 | public function isLoadEnumsEnabled(): bool | 
| 108 | 108 |      { | 
| 109 | - return (bool) ($this->config['load']['enums'] ?? false); | |
| 109 | + return (bool)($this->config['load']['enums'] ?? false); | |
| 110 | 110 | } | 
| 111 | 111 | |
| 112 | 112 | public function isLoadInterfacesEnabled(): bool | 
| 113 | 113 |      { | 
| 114 | - return (bool) ($this->config['load']['interfaces'] ?? false); | |
| 114 | + return (bool)($this->config['load']['interfaces'] ?? false); | |
| 115 | 115 | } | 
| 116 | 116 | } | 
| @@ -8,10 +8,10 @@ | ||
| 8 | 8 |  { | 
| 9 | 9 | public function __construct( | 
| 10 | 10 | private readonly Tokenizer $tokenizer | 
| 11 | -    ) { | |
| 11 | +    ){ | |
| 12 | 12 | } | 
| 13 | 13 | |
| 14 | - public function getScopedEnums(string $scope, object|string|null $target = null): array | |
| 14 | + public function getScopedEnums(string $scope, object | string | null $target = null): array | |
| 15 | 15 |      { | 
| 16 | 16 | return $this->tokenizer->scopedEnumLocator($scope)->getEnums($target); | 
| 17 | 17 | } | 
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | */ | 
| 17 | 17 | public function invoke(TokenizationListenerInterface $listener, iterable $classes): void | 
| 18 | 18 |      { | 
| 19 | -        foreach ($classes as $class) { | |
| 19 | +        foreach ($classes as $class){ | |
| 20 | 20 | $listener->listen($class); | 
| 21 | 21 | } | 
| 22 | 22 | } | 
| @@ -16,7 +16,8 @@ | ||
| 16 | 16 | */ | 
| 17 | 17 | public function invoke(TokenizationListenerInterface $listener, iterable $classes): void | 
| 18 | 18 |      { | 
| 19 | -        foreach ($classes as $class) { | |
| 19 | + foreach ($classes as $class) | |
| 20 | +        { | |
| 20 | 21 | $listener->listen($class); | 
| 21 | 22 | } | 
| 22 | 23 | } | 
| @@ -21,5 +21,5 @@ | ||
| 21 | 21 | * results. | 
| 22 | 22 | * @return array<class-string, ReflectionClass> | 
| 23 | 23 | */ | 
| 24 | - public function getInterfaces(string|null $target = null): array; | |
| 24 | + public function getInterfaces(string | null $target = null): array; | |
| 25 | 25 | } |