@@ -8,27 +8,27 @@ |
||
8 | 8 | |
9 | 9 | return RectorConfig::configure() |
10 | 10 | ->withPaths([ |
11 | - __DIR__ . '/src', |
|
12 | - __DIR__ . '/tests', |
|
11 | + __DIR__.'/src', |
|
12 | + __DIR__.'/tests', |
|
13 | 13 | ]) |
14 | 14 | // Ensure Rector knows we are targeting PHP 8.1+ syntax and features |
15 | 15 | ->withPhpSets(php81: true) |
16 | 16 | ->withPreparedSets( |
17 | - typeDeclarations: true, // Add param/return/var types where possible |
|
18 | - earlyReturn: true, // Replace nested ifs with early returns |
|
19 | - strictBooleans: true, // Use strict bool checks |
|
20 | - phpunitCodeQuality: true, // Modernise PHPUnit usage |
|
17 | + typeDeclarations: true, // Add param/return/var types where possible |
|
18 | + earlyReturn: true, // Replace nested ifs with early returns |
|
19 | + strictBooleans: true, // Use strict bool checks |
|
20 | + phpunitCodeQuality: true, // Modernise PHPUnit usage |
|
21 | 21 | deadCode: true // Remove unused code, vars, imports, etc. |
22 | 22 | ) |
23 | 23 | ->withSets([ |
24 | - LevelSetList::UP_TO_PHP_81, // Enforces all rules up to PHP 8.1 |
|
24 | + LevelSetList::UP_TO_PHP_81, // Enforces all rules up to PHP 8.1 |
|
25 | 25 | SetList::CODE_QUALITY, |
26 | 26 | SetList::CODING_STYLE, |
27 | 27 | SetList::DEAD_CODE, |
28 | - SetList::NAMING, // Enforce clear & consistent naming |
|
29 | - SetList::TYPE_DECLARATION, // Add missing type declarations aggressively |
|
30 | - SetList::PRIVATIZATION, // Make props/methods private if possible |
|
31 | - SetList::STRICT_BOOLEANS, // Strict boolean expressions |
|
28 | + SetList::NAMING, // Enforce clear & consistent naming |
|
29 | + SetList::TYPE_DECLARATION, // Add missing type declarations aggressively |
|
30 | + SetList::PRIVATIZATION, // Make props/methods private if possible |
|
31 | + SetList::STRICT_BOOLEANS, // Strict boolean expressions |
|
32 | 32 | ])->withPHPStanConfigs([ |
33 | - __DIR__ . '/phpstan.neon.dist', |
|
33 | + __DIR__.'/phpstan.neon.dist', |
|
34 | 34 | ]); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | Assertion::file($filename); |
30 | 30 | |
31 | 31 | try { |
32 | - $config = Yaml\Yaml::parse(file_get_contents($filename) ?: ''); |
|
32 | + $config = Yaml\Yaml::parse(file_get_contents($filename) ? : ''); |
|
33 | 33 | } catch (Yaml\Exception\ParseException $parseException) { |
34 | 34 | throw InvalidConfigException::fromYAMLFileError($filename, $parseException->getMessage()); |
35 | 35 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | { |
31 | 31 | Assertion::file($filename); |
32 | 32 | |
33 | - $config = json_decode(file_get_contents($filename) ?: '', true); |
|
33 | + $config = json_decode(file_get_contents($filename) ? : '', true); |
|
34 | 34 | |
35 | 35 | if (json_last_error() !== JSON_ERROR_NONE) { |
36 | 36 | throw InvalidConfigException::fromJSONFileError($filename, $this->getJsonError()); |
@@ -21,6 +21,6 @@ |
||
21 | 21 | { |
22 | 22 | Assertion::string($pattern); |
23 | 23 | |
24 | - return glob($pattern, GLOB_BRACE) ?: []; |
|
24 | + return glob($pattern, GLOB_BRACE) ? : []; |
|
25 | 25 | } |
26 | 26 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private function createFactoryFactory(ServiceDefinition $serviceDefinition) |
100 | 100 | { |
101 | - return function () use ($serviceDefinition) { |
|
101 | + return function() use ($serviceDefinition) { |
|
102 | 102 | $className = $serviceDefinition->getClass(); |
103 | 103 | $factory = new $className(); |
104 | 104 | if (!is_callable($factory)) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | private function resolveArguments(array $arguments): array |
133 | 133 | { |
134 | 134 | return array_map( |
135 | - function ($argument) { |
|
135 | + function($argument) { |
|
136 | 136 | if ($argument === Configurator::container()) { |
137 | 137 | return $this->container; |
138 | 138 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
57 | - $this->container[$prefix . $key] = $value; |
|
57 | + $this->container[$prefix.$key] = $value; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private function createFactoryFactory(ServiceDefinition $serviceDefinition) |
103 | 103 | { |
104 | - return function () use ($serviceDefinition) { |
|
104 | + return function() use ($serviceDefinition) { |
|
105 | 105 | $className = $serviceDefinition->getClass(); |
106 | 106 | $factory = new $className(); |
107 | 107 | if (!is_callable($factory)) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | private function createInstanceFactory(ServiceDefinition $serviceDefinition) |
127 | 127 | { |
128 | - return function () use ($serviceDefinition): object { |
|
128 | + return function() use ($serviceDefinition): object { |
|
129 | 129 | $className = $serviceDefinition->getClass(); |
130 | 130 | $instance = new $className(...$this->resolveArguments($serviceDefinition->getArguments())); |
131 | 131 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | private function createInflector(InflectorDefinition $inflectorDefinition): callable |
141 | 141 | { |
142 | - return function ($subject) use ($inflectorDefinition): void { |
|
142 | + return function($subject) use ($inflectorDefinition): void { |
|
143 | 143 | foreach ($inflectorDefinition->getMethods() as $method => $arguments) { |
144 | 144 | $subject->$method(...$this->resolveArguments($arguments)); |
145 | 145 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | private function applyInflectors(Closure $factory): callable |
150 | 150 | { |
151 | - return function () use ($factory) { |
|
151 | + return function() use ($factory) { |
|
152 | 152 | $instance = $factory(); |
153 | 153 | |
154 | 154 | foreach ($this->inflectors as $interface => $inflector) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | private function resolveArguments(array $arguments): array |
170 | 170 | { |
171 | 171 | return array_map( |
172 | - function ($argument) { |
|
172 | + function($argument) { |
|
173 | 173 | if (!is_string($argument)) { |
174 | 174 | return $argument; |
175 | 175 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | || self::$containerIdentifier === '' |
78 | 78 | || self::$containerIdentifier === '0' |
79 | 79 | ) { |
80 | - self::$containerIdentifier = uniqid(self::class . '::CONTAINER_ID::'); |
|
80 | + self::$containerIdentifier = uniqid(self::class.'::CONTAINER_ID::'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return self::$containerIdentifier; |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | ) { |
33 | 33 | Assertion::string($prefix); |
34 | 34 | |
35 | - $this->identifier = self::class . ($prefix !== '' ? $prefix : uniqid()); |
|
35 | + $this->identifier = self::class.($prefix !== '' ? $prefix : uniqid()); |
|
36 | 36 | $this->prefix = $prefix; |
37 | 37 | $this->provides = array_merge(array_map( |
38 | - fn (int|string $key): string => $this->keyPrefix() . $key, |
|
38 | + fn (int | string $key): string => $this->keyPrefix().$key, |
|
39 | 39 | $this->applicationConfig->getKeys() |
40 | 40 | ), [$this->prefix]); |
41 | 41 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | |
62 | - $this->container?->addShared($prefix . $key, fn (): mixed => $value); |
|
62 | + $this->container?->addShared($prefix.$key, fn (): mixed => $value); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -69,6 +69,6 @@ discard block |
||
69 | 69 | return ''; |
70 | 70 | } |
71 | 71 | |
72 | - return $this->prefix . $this->applicationConfig->getSeparator(); |
|
72 | + return $this->prefix.$this->applicationConfig->getSeparator(); |
|
73 | 73 | } |
74 | 74 | } |