Passed
Pull Request — master (#1141)
by Aleksei
10:45
created
src/Core/src/Internal/Proxy/ProxyClassRenderer.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,29 +27,29 @@  discard block
 block discarded – undo
27 27
             MagicCallTrait::class,
28 28
         ] : [];
29 29
 
30
-        if (\str_contains($className, '\\')) {
30
+        if (\str_contains($className, '\\')){
31 31
             $classShortName = \substr($className, \strrpos($className, '\\') + 1);
32
-            $classNamespaceStr = 'namespace ' . \substr($className, 0, \strrpos($className, '\\')) . ';';
33
-        } else {
32
+            $classNamespaceStr = 'namespace '.\substr($className, 0, \strrpos($className, '\\')).';';
33
+        }else{
34 34
             $classShortName = $className;
35 35
             $classNamespaceStr = '';
36 36
         }
37 37
 
38 38
         $interface = $type->getName();
39 39
         $classBody = [];
40
-        foreach ($type->getMethods() as $method) {
41
-            if ($method->isConstructor()) {
40
+        foreach ($type->getMethods() as $method){
41
+            if ($method->isConstructor()){
42 42
                 throw new \LogicException('Constructor is not allowed in a proxy.');
43 43
             }
44 44
 
45
-            if ($method->isDestructor()) {
45
+            if ($method->isDestructor()){
46 46
                 $classBody[] = self::renderMethod($method);
47 47
                 continue;
48 48
             }
49 49
 
50 50
             $hasRefs = false;
51 51
             $return = $method->hasReturnType() && (string)$method->getReturnType() === 'void' ? '' : 'return ';
52
-            $call = ($method->isStatic() ? '::' : '->') . $method->getName();
52
+            $call = ($method->isStatic() ? '::' : '->').$method->getName();
53 53
             $context = $method->isStatic() ? 'null' : '$this->__container_proxy_context';
54 54
             $containerStr = match (false) {
55 55
                 $attachContainer => 'null',
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
                 PHP;
70 70
 
71 71
             $args = [];
72
-            foreach ($method->getParameters() as $param) {
72
+            foreach ($method->getParameters() as $param){
73 73
                 $hasRefs = $hasRefs || $param->isPassedByReference();
74
-                $args[] = ($param->isVariadic() ? '...' : '') . '$' . $param->getName();
74
+                $args[] = ($param->isVariadic() ? '...' : '').'$'.$param->getName();
75 75
             }
76 76
 
77
-            if (!$hasRefs && !$method->isVariadic()) {
77
+            if (!$hasRefs && !$method->isVariadic()){
78 78
                 $classBody[] = self::renderMethod(
79 79
                     $method,
80 80
                     <<<PHP
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
             $argsStr = \implode(', ', $args);
88 88
 
89
-            if ($method->isVariadic()) {
89
+            if ($method->isVariadic()){
90 90
                 $classBody[] = self::renderMethod(
91 91
                     $method,
92 92
                     <<<PHP
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
         $traitsStr = $traits === [] ? '' : \implode(
110 110
             "\n    ",
111
-            \array_map(fn (string $trait): string => 'use \\' . \ltrim($trait, '\\') . ';', $traits)
111
+            \array_map(fn (string $trait) : string => 'use \\'.\ltrim($trait, '\\').';', $traits)
112 112
         );
113 113
         return <<<PHP
114 114
             $classNamespaceStr
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             $m->getName(),
132 132
             \implode(', ', \array_map(self::renderParameter(...), $m->getParameters())),
133 133
             $m->hasReturnType()
134
-                ? ': ' . self::renderParameterTypes($m->getReturnType(), $m->getDeclaringClass())
134
+                ? ': '.self::renderParameterTypes($m->getReturnType(), $m->getDeclaringClass())
135 135
                 : '',
136 136
             $body,
137 137
         );
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
                 $param->hasType() ? 'mixed' : '',
146 146
                 $param->isPassedByReference() ? '&' : '',
147 147
                 $param->isVariadic() ? '...' : '',
148
-                '$' . $param->getName(),
149
-                $param->isOptional() && !$param->isVariadic() ? ' = ' . self::renderDefaultValue($param) : '',
148
+                '$'.$param->getName(),
149
+                $param->isOptional() && !$param->isVariadic() ? ' = '.self::renderDefaultValue($param) : '',
150 150
             ),
151 151
             ' '
152 152
         );
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 
155 155
     public static function renderParameterTypes(\ReflectionType $types, \ReflectionClass $class): string
156 156
     {
157
-        if ($types instanceof \ReflectionNamedType) {
158
-            return ($types->allowsNull() && $types->getName() !== 'mixed' ? '?' : '') . ($types->isBuiltin()
157
+        if ($types instanceof \ReflectionNamedType){
158
+            return ($types->allowsNull() && $types->getName() !== 'mixed' ? '?' : '').($types->isBuiltin()
159 159
                     ? $types->getName()
160 160
                     : self::normalizeClassType($types, $class));
161 161
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         };
168 168
 
169 169
         $result = [];
170
-        foreach ($types as $type) {
170
+        foreach ($types as $type){
171 171
             $result[] = $type->isBuiltin()
172 172
                 ? $type->getName()
173 173
                 : self::normalizeClassType($type, $class);
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 
179 179
     public static function renderDefaultValue(\ReflectionParameter $param): string
180 180
     {
181
-        if ($param->isDefaultValueConstant()) {
181
+        if ($param->isDefaultValueConstant()){
182 182
             $result = $param->getDefaultValueConstantName();
183 183
 
184
-            return \explode('::', (string) $result)[0] === 'self'
184
+            return \explode('::', (string)$result)[0] === 'self'
185 185
                 ? $result
186
-                : '\\' . $result;
186
+                : '\\'.$result;
187 187
         }
188 188
 
189 189
         $cut = self::cutDefaultValue($param);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
     public static function normalizeClassType(\ReflectionNamedType $type, \ReflectionClass $class): string
197 197
     {
198
-        return '\\' . ($type->getName() === 'self' ? $class->getName() : $type->getName());
198
+        return '\\'.($type->getName() === 'self' ? $class->getName() : $type->getName());
199 199
     }
200 200
 
201 201
     private static function cutDefaultValue(\ReflectionParameter $param): string
Please login to merge, or discard this patch.
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,22 +27,28 @@  discard block
 block discarded – undo
27 27
             MagicCallTrait::class,
28 28
         ] : [];
29 29
 
30
-        if (\str_contains($className, '\\')) {
30
+        if (\str_contains($className, '\\'))
31
+        {
31 32
             $classShortName = \substr($className, \strrpos($className, '\\') + 1);
32 33
             $classNamespaceStr = 'namespace ' . \substr($className, 0, \strrpos($className, '\\')) . ';';
33
-        } else {
34
+        }
35
+        else
36
+        {
34 37
             $classShortName = $className;
35 38
             $classNamespaceStr = '';
36 39
         }
37 40
 
38 41
         $interface = $type->getName();
39 42
         $classBody = [];
40
-        foreach ($type->getMethods() as $method) {
41
-            if ($method->isConstructor()) {
43
+        foreach ($type->getMethods() as $method)
44
+        {
45
+            if ($method->isConstructor())
46
+            {
42 47
                 throw new \LogicException('Constructor is not allowed in a proxy.');
43 48
             }
44 49
 
45
-            if ($method->isDestructor()) {
50
+            if ($method->isDestructor())
51
+            {
46 52
                 $classBody[] = self::renderMethod($method);
47 53
                 continue;
48 54
             }
@@ -69,12 +75,14 @@  discard block
 block discarded – undo
69 75
                 PHP;
70 76
 
71 77
             $args = [];
72
-            foreach ($method->getParameters() as $param) {
78
+            foreach ($method->getParameters() as $param)
79
+            {
73 80
                 $hasRefs = $hasRefs || $param->isPassedByReference();
74 81
                 $args[] = ($param->isVariadic() ? '...' : '') . '$' . $param->getName();
75 82
             }
76 83
 
77
-            if (!$hasRefs && !$method->isVariadic()) {
84
+            if (!$hasRefs && !$method->isVariadic())
85
+            {
78 86
                 $classBody[] = self::renderMethod(
79 87
                     $method,
80 88
                     <<<PHP
@@ -86,7 +94,8 @@  discard block
 block discarded – undo
86 94
 
87 95
             $argsStr = \implode(', ', $args);
88 96
 
89
-            if ($method->isVariadic()) {
97
+            if ($method->isVariadic())
98
+            {
90 99
                 $classBody[] = self::renderMethod(
91 100
                     $method,
92 101
                     <<<PHP
@@ -154,7 +163,8 @@  discard block
 block discarded – undo
154 163
 
155 164
     public static function renderParameterTypes(\ReflectionType $types, \ReflectionClass $class): string
156 165
     {
157
-        if ($types instanceof \ReflectionNamedType) {
166
+        if ($types instanceof \ReflectionNamedType)
167
+        {
158 168
             return ($types->allowsNull() && $types->getName() !== 'mixed' ? '?' : '') . ($types->isBuiltin()
159 169
                     ? $types->getName()
160 170
                     : self::normalizeClassType($types, $class));
@@ -167,7 +177,8 @@  discard block
 block discarded – undo
167 177
         };
168 178
 
169 179
         $result = [];
170
-        foreach ($types as $type) {
180
+        foreach ($types as $type)
181
+        {
171 182
             $result[] = $type->isBuiltin()
172 183
                 ? $type->getName()
173 184
                 : self::normalizeClassType($type, $class);
@@ -178,7 +189,8 @@  discard block
 block discarded – undo
178 189
 
179 190
     public static function renderDefaultValue(\ReflectionParameter $param): string
180 191
     {
181
-        if ($param->isDefaultValueConstant()) {
192
+        if ($param->isDefaultValueConstant())
193
+        {
182 194
             $result = $param->getDefaultValueConstantName();
183 195
 
184 196
             return \explode('::', (string) $result)[0] === 'self'
Please login to merge, or discard this patch.
src/Core/src/Internal/Common/Registry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         private readonly Config $config,
20 20
         private array $objects = [],
21 21
         private readonly Options $options = new Options(),
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     public function set(string $name, object $value): void
Please login to merge, or discard this patch.
src/Distribution/src/Internal/DateTimeIntervalFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct(
16 16
         private readonly DateTimeFactoryInterface $factory = new DateTimeFactory()
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     public function create(mixed $duration): \DateInterval
21 21
     {
22
-        try {
22
+        try{
23 23
             return $this->createOrFail($duration);
24
-        } catch (\InvalidArgumentException $e) {
24
+        }catch (\InvalidArgumentException $e){
25 25
             throw $e;
26
-        } catch (\Throwable $e) {
26
+        }catch (\Throwable $e){
27 27
             throw new \InvalidArgumentException($e->getMessage(), (int)$e->getCode(), $e);
28 28
         }
29 29
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $duration instanceof \DateInterval => $duration,
45 45
             $duration instanceof \DateTimeInterface => $this->factory->now()->diff($duration),
46 46
             \is_string($duration) => new \DateInterval($duration),
47
-            \is_int($duration) => new \DateInterval('PT' . $duration . 'S'),
47
+            \is_int($duration) => new \DateInterval('PT'.$duration.'S'),
48 48
             $duration === null => new \DateInterval('PT0S'),
49 49
             default => throw new \InvalidArgumentException(
50 50
                 \sprintf(self::ERROR_INVALID_INTERVAL_TYPE, \get_debug_type($duration))
Please login to merge, or discard this patch.
src/Distribution/src/Resolver/CloudFrontResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         string $privateKey,
26 26
         private readonly string $domain,
27 27
         private readonly ?string $prefix = null
28
-    ) {
28
+    ){
29 29
         $this->assertCloudFrontAvailable();
30 30
         $this->factory = new AmazonUriFactory();
31 31
         $this->signer = new UrlSigner($keyPairId, $privateKey);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     protected function assertCloudFrontAvailable(): void
48 48
     {
49
-        if (\class_exists(UrlSigner::class)) {
49
+        if (\class_exists(UrlSigner::class)){
50 50
             return;
51 51
         }
52 52
 
Please login to merge, or discard this patch.
src/Distribution/src/Resolver/S3SignedResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         private readonly S3ClientInterface $client,
20 20
         private readonly string $bucket,
21 21
         private readonly ?string $prefix = null
22
-    ) {
22
+    ){
23 23
         parent::__construct();
24 24
     }
25 25
 
Please login to merge, or discard this patch.
src/Console/src/Configurator/Signature/Parser.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $name = $this->parseName($signature);
26 26
 
27
-        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)) {
28
-            if (\count($matches[1])) {
27
+        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)){
28
+            if (\count($matches[1])){
29 29
                 return new CommandDefinition($name, ...$this->parseParameters($matches[1]));
30 30
             }
31 31
         }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     private function parseName(string $signature): string
42 42
     {
43
-        if (!\preg_match('/\S+/', $signature, $matches)) {
43
+        if (!\preg_match('/\S+/', $signature, $matches)){
44 44
             throw new InvalidArgumentException('Unable to determine command name from signature.');
45 45
         }
46 46
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
         $arguments = [];
58 58
         $options = [];
59 59
 
60
-        foreach ($tokens as $token) {
61
-            if (\preg_match('/-{2,}(.*)/', (string) $token, $matches)) {
60
+        foreach ($tokens as $token){
61
+            if (\preg_match('/-{2,}(.*)/', (string)$token, $matches)){
62 62
                 $options[] = $this->parseOption($matches[1]);
63
-            } else {
63
+            }else{
64 64
                 $arguments[] = $this->parseArgument($token);
65 65
             }
66 66
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $matches = \preg_split('/\s*\|\s*/', $token, 2);
123 123
         $shortcut = null;
124 124
 
125
-        if (isset($matches[1])) {
125
+        if (isset($matches[1])){
126 126
             [$shortcut, $token] = $matches;
127 127
         }
128 128
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,8 +24,10 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $name = $this->parseName($signature);
26 26
 
27
-        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)) {
28
-            if (\count($matches[1])) {
27
+        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches))
28
+        {
29
+            if (\count($matches[1]))
30
+            {
29 31
                 return new CommandDefinition($name, ...$this->parseParameters($matches[1]));
30 32
             }
31 33
         }
@@ -40,7 +42,8 @@  discard block
 block discarded – undo
40 42
      */
41 43
     private function parseName(string $signature): string
42 44
     {
43
-        if (!\preg_match('/\S+/', $signature, $matches)) {
45
+        if (!\preg_match('/\S+/', $signature, $matches))
46
+        {
44 47
             throw new InvalidArgumentException('Unable to determine command name from signature.');
45 48
         }
46 49
 
@@ -57,10 +60,14 @@  discard block
 block discarded – undo
57 60
         $arguments = [];
58 61
         $options = [];
59 62
 
60
-        foreach ($tokens as $token) {
61
-            if (\preg_match('/-{2,}(.*)/', (string) $token, $matches)) {
63
+        foreach ($tokens as $token)
64
+        {
65
+            if (\preg_match('/-{2,}(.*)/', (string) $token, $matches))
66
+            {
62 67
                 $options[] = $this->parseOption($matches[1]);
63
-            } else {
68
+            }
69
+            else
70
+            {
64 71
                 $arguments[] = $this->parseArgument($token);
65 72
             }
66 73
         }
@@ -122,7 +129,8 @@  discard block
 block discarded – undo
122 129
         $matches = \preg_split('/\s*\|\s*/', $token, 2);
123 130
         $shortcut = null;
124 131
 
125
-        if (isset($matches[1])) {
132
+        if (isset($matches[1]))
133
+        {
126 134
             [$shortcut, $token] = $matches;
127 135
         }
128 136
 
Please login to merge, or discard this patch.
rector.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,59 +22,59 @@  discard block
 block discarded – undo
22 22
 
23 23
 return RectorConfig::configure()
24 24
     ->withPaths([
25
-        __DIR__ . '/src/*/src',
26
-        __DIR__ . '/src/*/tests',
27
-        __DIR__ . '/tests',
25
+        __DIR__.'/src/*/src',
26
+        __DIR__.'/src/*/tests',
27
+        __DIR__.'/tests',
28 28
     ])
29 29
     ->withParallel()
30 30
     ->withSkip([
31 31
         IfIssetToCoalescingRector::class,
32 32
         RemoveUnusedPrivatePropertyRector::class => [
33
-            __DIR__ . '/src/Scaffolder/src/Command/BootloaderCommand.php',
34
-            __DIR__ . '/src/Scaffolder/src/Command/CommandCommand.php',
35
-            __DIR__ . '/src/Scaffolder/src/Command/ConfigCommand.php',
36
-            __DIR__ . '/src/Scaffolder/src/Command/ControllerCommand.php',
37
-            __DIR__ . '/src/Scaffolder/src/Command/FilterCommand.php',
38
-            __DIR__ . '/src/Scaffolder/src/Command/JobHandlerCommand.php',
39
-            __DIR__ . '/src/Scaffolder/src/Command/MiddlewareCommand.php',
40
-            __DIR__ . '/src/Console/tests/PromptArgumentsTest.php',
33
+            __DIR__.'/src/Scaffolder/src/Command/BootloaderCommand.php',
34
+            __DIR__.'/src/Scaffolder/src/Command/CommandCommand.php',
35
+            __DIR__.'/src/Scaffolder/src/Command/ConfigCommand.php',
36
+            __DIR__.'/src/Scaffolder/src/Command/ControllerCommand.php',
37
+            __DIR__.'/src/Scaffolder/src/Command/FilterCommand.php',
38
+            __DIR__.'/src/Scaffolder/src/Command/JobHandlerCommand.php',
39
+            __DIR__.'/src/Scaffolder/src/Command/MiddlewareCommand.php',
40
+            __DIR__.'/src/Console/tests/PromptArgumentsTest.php',
41 41
         ],
42 42
         RemoveUnusedPrivateMethodRector::class => [
43
-            __DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php',
44
-            __DIR__ . '/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php',
45
-            __DIR__ . '/src/Cache/src/Bootloader/CacheBootloader.php',
46
-            __DIR__ . '/src/Serializer/src/Bootloader/SerializerBootloader.php',
47
-            __DIR__ . '/src/Validation/src/Bootloader/ValidationBootloader.php',
48
-            __DIR__ . '/src/Translator/tests/IndexerTest.php',
49
-            __DIR__ . '/src/Tokenizer/tests/ReflectionFileTest.php',
50
-            __DIR__ . '/src/Core/tests/SingletonsTest.php',
43
+            __DIR__.'/src/Boot/src/Bootloader/ConfigurationBootloader.php',
44
+            __DIR__.'/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php',
45
+            __DIR__.'/src/Cache/src/Bootloader/CacheBootloader.php',
46
+            __DIR__.'/src/Serializer/src/Bootloader/SerializerBootloader.php',
47
+            __DIR__.'/src/Validation/src/Bootloader/ValidationBootloader.php',
48
+            __DIR__.'/src/Translator/tests/IndexerTest.php',
49
+            __DIR__.'/src/Tokenizer/tests/ReflectionFileTest.php',
50
+            __DIR__.'/src/Core/tests/SingletonsTest.php',
51 51
         ],
52 52
         RemoveUselessVarTagRector::class => [
53
-            __DIR__ . '/src/Console/src/Traits/HelpersTrait.php',
53
+            __DIR__.'/src/Console/src/Traits/HelpersTrait.php',
54 54
         ],
55 55
         RemoveAlwaysTrueIfConditionRector::class => [
56
-            __DIR__ . '/src/Boot/src/BootloadManager/Initializer.php',
57
-            __DIR__ . '/src/Stempler/src/Traverser.php',
58
-            __DIR__ . '/src/Prototype/src/NodeVisitors/LocateProperties.php',
59
-            __DIR__ . '/src/Prototype/src/NodeVisitors/RemoveTrait.php',
60
-            __DIR__ . '/src/Logger/src/ListenerRegistry.php',
61
-            __DIR__ . '/src/Stempler/src/Transform/Merge/ExtendsParent.php',
56
+            __DIR__.'/src/Boot/src/BootloadManager/Initializer.php',
57
+            __DIR__.'/src/Stempler/src/Traverser.php',
58
+            __DIR__.'/src/Prototype/src/NodeVisitors/LocateProperties.php',
59
+            __DIR__.'/src/Prototype/src/NodeVisitors/RemoveTrait.php',
60
+            __DIR__.'/src/Logger/src/ListenerRegistry.php',
61
+            __DIR__.'/src/Stempler/src/Transform/Merge/ExtendsParent.php',
62 62
         ],
63 63
         RemoveExtraParametersRector::class => [
64
-            __DIR__ . '/src/Boot/src/BootloadManager/AbstractBootloadManager.php',
64
+            __DIR__.'/src/Boot/src/BootloadManager/AbstractBootloadManager.php',
65 65
         ],
66 66
         RemoveUnusedPrivateMethodParameterRector::class => [
67
-            __DIR__ . '/src/Core/src/Internal/Factory.php',
68
-            __DIR__ . '/src/Core/tests/InjectableTest.php',
67
+            __DIR__.'/src/Core/src/Internal/Factory.php',
68
+            __DIR__.'/src/Core/tests/InjectableTest.php',
69 69
         ],
70 70
         RemoveDoubleAssignRector::class => [
71
-            __DIR__ . '/src/Core/tests/Scope/FinalizeAttributeTest.php',
71
+            __DIR__.'/src/Core/tests/Scope/FinalizeAttributeTest.php',
72 72
         ],
73 73
         RemoveUnusedVariableAssignRector::class => [
74
-            __DIR__ . '/src/Core/tests/ExceptionsTest.php',
74
+            __DIR__.'/src/Core/tests/ExceptionsTest.php',
75 75
         ],
76 76
         RemoveDeadStmtRector::class => [
77
-            __DIR__ . '/src/Core/tests/ExceptionsTest.php',
77
+            __DIR__.'/src/Core/tests/ExceptionsTest.php',
78 78
         ],
79 79
 
80 80
         // to be enabled later for bc break 4.x
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
         NewInInitializerRector::class,
85 85
 
86 86
         // start with short open tag
87
-        __DIR__ . '/src/Views/tests/fixtures/other/var.php',
88
-        __DIR__ . '/tests/app/views/native.php',
87
+        __DIR__.'/src/Views/tests/fixtures/other/var.php',
88
+        __DIR__.'/tests/app/views/native.php',
89 89
 
90 90
         // example code for test
91 91
         '*/Fixture/*',
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
         '*/Stubs/*',
96 96
         '*/tests/Classes/*',
97 97
         '*/tests/Internal/*',
98
-        __DIR__ . '/src/Console/tests/Configurator',
98
+        __DIR__.'/src/Console/tests/Configurator',
99 99
 
100 100
         // cache
101 101
         '*/runtime/cache/*',
102 102
 
103 103
         ReadOnlyPropertyRector::class => [
104 104
             // used by Configurator
105
-            __DIR__ . '/src/Scaffolder/src/Command',
105
+            __DIR__.'/src/Scaffolder/src/Command',
106 106
         ],
107 107
     ])
108 108
     ->withPhpSets(php81: true)
Please login to merge, or discard this patch.
src/Exceptions/src/Renderer/ConsoleRenderer.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $exceptions = [$exception];
69 69
         $currentE = $exception;
70 70
 
71
-        while ($exception = $exception->getPrevious()) {
71
+        while ($exception = $exception->getPrevious()){
72 72
             $exceptions[] = $exception;
73 73
         }
74 74
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $result = [];
78 78
         $rootDir = \getcwd();
79 79
 
80
-        foreach ($exceptions as $exception) {
80
+        foreach ($exceptions as $exception){
81 81
             $prefix = $currentE === $exception ? '' : 'Previous: ';
82 82
             $row = $this->renderHeader(
83 83
                 \sprintf("%s[%s]\n%s", $prefix, $exception::class, $exception->getMessage()),
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
                 $exception->getLine()
95 95
             );
96 96
 
97
-            if ($verbosity->value >= Verbosity::DEBUG->value) {
97
+            if ($verbosity->value >= Verbosity::DEBUG->value){
98 98
                 $row .= $this->renderTrace(
99 99
                     $exception,
100 100
                     new Highlighter(
101 101
                         $this->colorsSupport ? new ConsoleStyle() : new PlainStyle()
102 102
                     )
103 103
                 );
104
-            } elseif ($verbosity->value >= Verbosity::VERBOSE->value) {
104
+            } elseif ($verbosity->value >= Verbosity::VERBOSE->value){
105 105
                 $row .= $this->renderTrace($exception);
106 106
             }
107 107
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         $length += $padding;
134 134
 
135
-        foreach ($lines as $line) {
135
+        foreach ($lines as $line){
136 136
             $result .= $this->format(
137 137
                 "<{$style}>%s%s%s</reset>\n",
138 138
                 \str_repeat('', $padding + 1),
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
151 151
     {
152 152
         $stacktrace = $this->getStacktrace($e);
153
-        if (empty($stacktrace)) {
153
+        if (empty($stacktrace)){
154 154
             return '';
155 155
         }
156 156
 
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 
160 160
         $pad = \strlen((string)\count($stacktrace));
161 161
 
162
-        foreach ($stacktrace as $i => $trace) {
163
-            $file = isset($trace['file']) ? (string) $trace['file'] : null;
162
+        foreach ($stacktrace as $i => $trace){
163
+            $file = isset($trace['file']) ? (string)$trace['file'] : null;
164 164
             $classColor = 'while';
165 165
 
166
-            if ($file !== null) {
166
+            if ($file !== null){
167 167
                 $file = \str_starts_with($file, $rootDir)
168 168
                     ? \substr($file, \strlen($rootDir) + 1)
169 169
                     : $file;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 $classColor = \str_starts_with($file, 'vendor/') ? 'gray' : 'white';
172 172
             }
173 173
 
174
-            if (isset($trace['type'], $trace['class'])) {
174
+            if (isset($trace['type'], $trace['class'])){
175 175
                 $line = $this->format(
176 176
                     "<$classColor>%s.</reset> <white>%s%s%s()</reset>",
177 177
                     \str_pad((string)((int)$i + 1), $pad, ' ', \STR_PAD_LEFT),
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
                     $trace['type'],
180 180
                     $trace['function']
181 181
                 );
182
-            } else {
182
+            }else{
183 183
                 $line = $this->format(
184 184
                     ' <white>%s()</reset>',
185 185
                     $trace['function']
186 186
                 );
187 187
             }
188
-            if ($file !== null) {
188
+            if ($file !== null){
189 189
                 $line .= $this->format(
190 190
                     ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>',
191 191
                     $file,
@@ -193,21 +193,21 @@  discard block
 block discarded – undo
193 193
                 );
194 194
             }
195 195
 
196
-            if (\in_array($line, $this->lines, true)) {
196
+            if (\in_array($line, $this->lines, true)){
197 197
                 continue;
198 198
             }
199 199
 
200 200
             $this->lines[] = $line;
201 201
 
202
-            $result .= $line . "\n";
202
+            $result .= $line."\n";
203 203
 
204
-            if ($h !== null && !empty($trace['file'])) {
204
+            if ($h !== null && !empty($trace['file'])){
205 205
                 $str = @\file_get_contents($trace['file']);
206 206
                 $result .= $h->highlightLines(
207 207
                     $str,
208 208
                     $trace['line'],
209 209
                     static::SHOW_LINES
210
-                ) . "\n";
210
+                )."\n";
211 211
                 unset($str);
212 212
             }
213 213
         }
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
      */
221 221
     private function format(string $format, mixed ...$args): string
222 222
     {
223
-        if (!$this->colorsSupport) {
223
+        if (!$this->colorsSupport){
224 224
             $format = \preg_replace('/<[^>]+>/', '', $format);
225
-        } else {
226
-            $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial) {
225
+        }else{
226
+            $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial){
227 227
                 $style = '';
228
-                foreach (\explode(',', \trim($partial[2], '/')) as $color) {
229
-                    if (isset(self::COLORS[$color])) {
228
+                foreach (\explode(',', \trim($partial[2], '/')) as $color){
229
+                    if (isset(self::COLORS[$color])){
230 230
                         $style .= self::COLORS[$color];
231 231
                     }
232 232
                 }
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
      */
246 246
     private function isColorsSupported(mixed $stream = STDOUT): bool
247 247
     {
248
-        if ('Hyper' === \getenv('TERM_PROGRAM')) {
248
+        if ('Hyper' === \getenv('TERM_PROGRAM')){
249 249
             return true;
250 250
         }
251 251
 
252
-        try {
253
-            if (\DIRECTORY_SEPARATOR === '\\') {
252
+        try{
253
+            if (\DIRECTORY_SEPARATOR === '\\'){
254 254
                 return (\function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support($stream))
255 255
                     || \getenv('ANSICON') !== false
256 256
                     || \getenv('ConEmuANSI') === 'ON'
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
             }
259 259
 
260 260
             return @\stream_isatty($stream);
261
-        } catch (\Throwable) {
261
+        }catch (\Throwable){
262 262
             return false;
263 263
         }
264 264
     }
Please login to merge, or discard this patch.
Braces   +48 added lines, -22 removed lines patch added patch discarded remove patch
@@ -68,7 +68,8 @@  discard block
 block discarded – undo
68 68
         $exceptions = [$exception];
69 69
         $currentE = $exception;
70 70
 
71
-        while ($exception = $exception->getPrevious()) {
71
+        while ($exception = $exception->getPrevious())
72
+        {
72 73
             $exceptions[] = $exception;
73 74
         }
74 75
 
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
         $result = [];
78 79
         $rootDir = \getcwd();
79 80
 
80
-        foreach ($exceptions as $exception) {
81
+        foreach ($exceptions as $exception)
82
+        {
81 83
             $prefix = $currentE === $exception ? '' : 'Previous: ';
82 84
             $row = $this->renderHeader(
83 85
                 \sprintf("%s[%s]\n%s", $prefix, $exception::class, $exception->getMessage()),
@@ -94,14 +96,17 @@  discard block
 block discarded – undo
94 96
                 $exception->getLine()
95 97
             );
96 98
 
97
-            if ($verbosity->value >= Verbosity::DEBUG->value) {
99
+            if ($verbosity->value >= Verbosity::DEBUG->value)
100
+            {
98 101
                 $row .= $this->renderTrace(
99 102
                     $exception,
100 103
                     new Highlighter(
101 104
                         $this->colorsSupport ? new ConsoleStyle() : new PlainStyle()
102 105
                     )
103 106
                 );
104
-            } elseif ($verbosity->value >= Verbosity::VERBOSE->value) {
107
+            }
108
+            elseif ($verbosity->value >= Verbosity::VERBOSE->value)
109
+            {
105 110
                 $row .= $this->renderTrace($exception);
106 111
             }
107 112
 
@@ -132,7 +137,8 @@  discard block
 block discarded – undo
132 137
 
133 138
         $length += $padding;
134 139
 
135
-        foreach ($lines as $line) {
140
+        foreach ($lines as $line)
141
+        {
136 142
             $result .= $this->format(
137 143
                 "<{$style}>%s%s%s</reset>\n",
138 144
                 \str_repeat('', $padding + 1),
@@ -150,7 +156,8 @@  discard block
 block discarded – undo
150 156
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
151 157
     {
152 158
         $stacktrace = $this->getStacktrace($e);
153
-        if (empty($stacktrace)) {
159
+        if (empty($stacktrace))
160
+        {
154 161
             return '';
155 162
         }
156 163
 
@@ -159,11 +166,13 @@  discard block
 block discarded – undo
159 166
 
160 167
         $pad = \strlen((string)\count($stacktrace));
161 168
 
162
-        foreach ($stacktrace as $i => $trace) {
169
+        foreach ($stacktrace as $i => $trace)
170
+        {
163 171
             $file = isset($trace['file']) ? (string) $trace['file'] : null;
164 172
             $classColor = 'while';
165 173
 
166
-            if ($file !== null) {
174
+            if ($file !== null)
175
+            {
167 176
                 $file = \str_starts_with($file, $rootDir)
168 177
                     ? \substr($file, \strlen($rootDir) + 1)
169 178
                     : $file;
@@ -171,7 +180,8 @@  discard block
 block discarded – undo
171 180
                 $classColor = \str_starts_with($file, 'vendor/') ? 'gray' : 'white';
172 181
             }
173 182
 
174
-            if (isset($trace['type'], $trace['class'])) {
183
+            if (isset($trace['type'], $trace['class']))
184
+            {
175 185
                 $line = $this->format(
176 186
                     "<$classColor>%s.</reset> <white>%s%s%s()</reset>",
177 187
                     \str_pad((string)((int)$i + 1), $pad, ' ', \STR_PAD_LEFT),
@@ -179,13 +189,16 @@  discard block
 block discarded – undo
179 189
                     $trace['type'],
180 190
                     $trace['function']
181 191
                 );
182
-            } else {
192
+            }
193
+            else
194
+            {
183 195
                 $line = $this->format(
184 196
                     ' <white>%s()</reset>',
185 197
                     $trace['function']
186 198
                 );
187 199
             }
188
-            if ($file !== null) {
200
+            if ($file !== null)
201
+            {
189 202
                 $line .= $this->format(
190 203
                     ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>',
191 204
                     $file,
@@ -193,7 +206,8 @@  discard block
 block discarded – undo
193 206
                 );
194 207
             }
195 208
 
196
-            if (\in_array($line, $this->lines, true)) {
209
+            if (\in_array($line, $this->lines, true))
210
+            {
197 211
                 continue;
198 212
             }
199 213
 
@@ -201,7 +215,8 @@  discard block
 block discarded – undo
201 215
 
202 216
             $result .= $line . "\n";
203 217
 
204
-            if ($h !== null && !empty($trace['file'])) {
218
+            if ($h !== null && !empty($trace['file']))
219
+            {
205 220
                 $str = @\file_get_contents($trace['file']);
206 221
                 $result .= $h->highlightLines(
207 222
                     $str,
@@ -220,13 +235,19 @@  discard block
 block discarded – undo
220 235
      */
221 236
     private function format(string $format, mixed ...$args): string
222 237
     {
223
-        if (!$this->colorsSupport) {
238
+        if (!$this->colorsSupport)
239
+        {
224 240
             $format = \preg_replace('/<[^>]+>/', '', $format);
225
-        } else {
226
-            $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial) {
241
+        }
242
+        else
243
+        {
244
+            $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial)
245
+            {
227 246
                 $style = '';
228
-                foreach (\explode(',', \trim($partial[2], '/')) as $color) {
229
-                    if (isset(self::COLORS[$color])) {
247
+                foreach (\explode(',', \trim($partial[2], '/')) as $color)
248
+                {
249
+                    if (isset(self::COLORS[$color]))
250
+                    {
230 251
                         $style .= self::COLORS[$color];
231 252
                     }
232 253
                 }
@@ -245,12 +266,15 @@  discard block
 block discarded – undo
245 266
      */
246 267
     private function isColorsSupported(mixed $stream = STDOUT): bool
247 268
     {
248
-        if ('Hyper' === \getenv('TERM_PROGRAM')) {
269
+        if ('Hyper' === \getenv('TERM_PROGRAM'))
270
+        {
249 271
             return true;
250 272
         }
251 273
 
252
-        try {
253
-            if (\DIRECTORY_SEPARATOR === '\\') {
274
+        try
275
+        {
276
+            if (\DIRECTORY_SEPARATOR === '\\')
277
+            {
254 278
                 return (\function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support($stream))
255 279
                     || \getenv('ANSICON') !== false
256 280
                     || \getenv('ConEmuANSI') === 'ON'
@@ -258,7 +282,9 @@  discard block
 block discarded – undo
258 282
             }
259 283
 
260 284
             return @\stream_isatty($stream);
261
-        } catch (\Throwable) {
285
+        }
286
+        catch (\Throwable)
287
+        {
262 288
             return false;
263 289
         }
264 290
     }
Please login to merge, or discard this patch.
src/Exceptions/src/Renderer/PlainRenderer.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     ): string {
23 23
         $verbosity ??= $this->defaultVerbosity;
24 24
         $exceptions = [$exception];
25
-        while ($exception = $exception->getPrevious()) {
25
+        while ($exception = $exception->getPrevious()){
26 26
             $exceptions[] = $exception;
27 27
         }
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $result = [];
32 32
         $rootDir = \getcwd();
33 33
 
34
-        foreach ($exceptions as $exception) {
34
+        foreach ($exceptions as $exception){
35 35
             $file = \str_starts_with($exception->getFile(), $rootDir)
36 36
                 ? \substr($exception->getFile(), \strlen($rootDir) + 1)
37 37
                 : $exception->getFile();
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
                 $exception->getLine(),
45 45
             );
46 46
 
47
-            if ($verbosity->value >= Verbosity::DEBUG->value) {
47
+            if ($verbosity->value >= Verbosity::DEBUG->value){
48 48
                 $row .= $this->renderTrace($exception, new Highlighter(new PlainStyle()));
49
-            } elseif ($verbosity->value >= Verbosity::VERBOSE->value) {
49
+            } elseif ($verbosity->value >= Verbosity::VERBOSE->value){
50 50
                 $row .= $this->renderTrace($exception);
51 51
             }
52 52
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
65 65
     {
66 66
         $stacktrace = $this->getStacktrace($e);
67
-        if ($stacktrace === []) {
67
+        if ($stacktrace === []){
68 68
             return '';
69 69
         }
70 70
 
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
 
74 74
         $pad = \strlen((string)\count($stacktrace));
75 75
 
76
-        foreach ($stacktrace as $i => $trace) {
77
-            if (isset($trace['type'], $trace['class'])) {
76
+        foreach ($stacktrace as $i => $trace){
77
+            if (isset($trace['type'], $trace['class'])){
78 78
                 $line = \sprintf(
79 79
                     '%s. %s%s%s()',
80
-                    \str_pad((string)((int) $i + 1), $pad, ' ', \STR_PAD_LEFT),
80
+                    \str_pad((string)((int)$i + 1), $pad, ' ', \STR_PAD_LEFT),
81 81
                     $trace['class'],
82 82
                     $trace['type'],
83 83
                     $trace['function']
84 84
                 );
85
-            } else {
85
+            }else{
86 86
                 $line = $trace['function'];
87 87
             }
88 88
 
89
-            if (isset($trace['file'])) {
90
-                $file = (string) $trace['file'];
89
+            if (isset($trace['file'])){
90
+                $file = (string)$trace['file'];
91 91
                 $file = \str_starts_with($file, $rootDir)
92 92
                     ? \substr($file, \strlen($rootDir) + 1)
93 93
                     : $file;
@@ -95,25 +95,25 @@  discard block
 block discarded – undo
95 95
                 $line .= \sprintf(' at %s:%s', $file, $trace['line']);
96 96
             }
97 97
 
98
-            if (\in_array($line, $this->lines, true)) {
98
+            if (\in_array($line, $this->lines, true)){
99 99
                 continue;
100 100
             }
101 101
 
102 102
             $this->lines[] = $line;
103 103
 
104
-            $result .= $line . "\n";
104
+            $result .= $line."\n";
105 105
 
106
-            if ($h !== null && !empty($trace['file']) && \is_file($trace['file'])) {
106
+            if ($h !== null && !empty($trace['file']) && \is_file($trace['file'])){
107 107
                 $str = @\file_get_contents($trace['file']);
108 108
                 $result .= $h->highlightLines(
109 109
                     $str,
110 110
                     $trace['line'],
111 111
                     self::SHOW_LINES
112
-                ) . "\n";
112
+                )."\n";
113 113
                 unset($str);
114 114
             }
115 115
         }
116 116
 
117
-        return $result . "\n";
117
+        return $result."\n";
118 118
     }
119 119
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
     ): string {
23 23
         $verbosity ??= $this->defaultVerbosity;
24 24
         $exceptions = [$exception];
25
-        while ($exception = $exception->getPrevious()) {
25
+        while ($exception = $exception->getPrevious())
26
+        {
26 27
             $exceptions[] = $exception;
27 28
         }
28 29
 
@@ -31,7 +32,8 @@  discard block
 block discarded – undo
31 32
         $result = [];
32 33
         $rootDir = \getcwd();
33 34
 
34
-        foreach ($exceptions as $exception) {
35
+        foreach ($exceptions as $exception)
36
+        {
35 37
             $file = \str_starts_with($exception->getFile(), $rootDir)
36 38
                 ? \substr($exception->getFile(), \strlen($rootDir) + 1)
37 39
                 : $exception->getFile();
@@ -44,9 +46,12 @@  discard block
 block discarded – undo
44 46
                 $exception->getLine(),
45 47
             );
46 48
 
47
-            if ($verbosity->value >= Verbosity::DEBUG->value) {
49
+            if ($verbosity->value >= Verbosity::DEBUG->value)
50
+            {
48 51
                 $row .= $this->renderTrace($exception, new Highlighter(new PlainStyle()));
49
-            } elseif ($verbosity->value >= Verbosity::VERBOSE->value) {
52
+            }
53
+            elseif ($verbosity->value >= Verbosity::VERBOSE->value)
54
+            {
50 55
                 $row .= $this->renderTrace($exception);
51 56
             }
52 57
 
@@ -64,7 +69,8 @@  discard block
 block discarded – undo
64 69
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
65 70
     {
66 71
         $stacktrace = $this->getStacktrace($e);
67
-        if ($stacktrace === []) {
72
+        if ($stacktrace === [])
73
+        {
68 74
             return '';
69 75
         }
70 76
 
@@ -73,8 +79,10 @@  discard block
 block discarded – undo
73 79
 
74 80
         $pad = \strlen((string)\count($stacktrace));
75 81
 
76
-        foreach ($stacktrace as $i => $trace) {
77
-            if (isset($trace['type'], $trace['class'])) {
82
+        foreach ($stacktrace as $i => $trace)
83
+        {
84
+            if (isset($trace['type'], $trace['class']))
85
+            {
78 86
                 $line = \sprintf(
79 87
                     '%s. %s%s%s()',
80 88
                     \str_pad((string)((int) $i + 1), $pad, ' ', \STR_PAD_LEFT),
@@ -82,11 +90,14 @@  discard block
 block discarded – undo
82 90
                     $trace['type'],
83 91
                     $trace['function']
84 92
                 );
85
-            } else {
93
+            }
94
+            else
95
+            {
86 96
                 $line = $trace['function'];
87 97
             }
88 98
 
89
-            if (isset($trace['file'])) {
99
+            if (isset($trace['file']))
100
+            {
90 101
                 $file = (string) $trace['file'];
91 102
                 $file = \str_starts_with($file, $rootDir)
92 103
                     ? \substr($file, \strlen($rootDir) + 1)
@@ -95,7 +106,8 @@  discard block
 block discarded – undo
95 106
                 $line .= \sprintf(' at %s:%s', $file, $trace['line']);
96 107
             }
97 108
 
98
-            if (\in_array($line, $this->lines, true)) {
109
+            if (\in_array($line, $this->lines, true))
110
+            {
99 111
                 continue;
100 112
             }
101 113
 
@@ -103,7 +115,8 @@  discard block
 block discarded – undo
103 115
 
104 116
             $result .= $line . "\n";
105 117
 
106
-            if ($h !== null && !empty($trace['file']) && \is_file($trace['file'])) {
118
+            if ($h !== null && !empty($trace['file']) && \is_file($trace['file']))
119
+            {
107 120
                 $str = @\file_get_contents($trace['file']);
108 121
                 $result .= $h->highlightLines(
109 122
                     $str,
Please login to merge, or discard this patch.