Passed
Pull Request — master (#1190)
by Aleksei
20:19 queued 07:41
created
src/Core/src/Internal/Proxy.php 2 patches
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,9 +37,11 @@  discard block
 block discarded – undo
37 37
             $attribute->proxyOverloads ? '[magic-calls]' : '',
38 38
         );
39 39
 
40
-        if (!\array_key_exists($cacheKey, self::$classes)) {
40
+        if (!\array_key_exists($cacheKey, self::$classes))
41
+        {
41 42
             $n = 0;
42
-            do {
43
+            do
44
+            {
43 45
                 $className = \sprintf(
44 46
                     '%s\%s SCOPED PROXY%s',
45 47
                     $type->getNamespaceName(),
@@ -49,7 +51,8 @@  discard block
 block discarded – undo
49 51
             } while (\class_exists($className));
50 52
 
51 53
             /** @var class-string<TClass> $className */
52
-            try {
54
+            try
55
+            {
53 56
                 $classString = ProxyClassRenderer::renderClass(
54 57
                     $type,
55 58
                     $className,
@@ -58,7 +61,9 @@  discard block
 block discarded – undo
58 61
                 );
59 62
 
60 63
                 eval($classString);
61
-            } catch (\Throwable $e) {
64
+            }
65
+            catch (\Throwable $e)
66
+            {
62 67
                 throw new \Error("Unable to create proxy for `{$interface}`: {$e->getMessage()}", 0, $e);
63 68
             }
64 69
 
@@ -67,12 +72,15 @@  discard block
 block discarded – undo
67 72
 
68 73
             // Store in cache without context
69 74
             self::$classes[$cacheKey] = $className;
70
-        } else {
75
+        }
76
+        else
77
+        {
71 78
             /** @var TClass $instance */
72 79
             $instance = new (self::$classes[$cacheKey])();
73 80
         }
74 81
 
75
-        if ($context !== null || $attachContainer) {
82
+        if ($context !== null || $attachContainer)
83
+        {
76 84
             (static function () use ($instance, $context, $attachContainer): void {
77 85
                 // Set the Current Context
78 86
                 /** @see \Spiral\Core\Internal\Proxy\ProxyTrait::$__container_proxy_context */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public static function create(
24 24
         \ReflectionClass $type,
25
-        \Stringable|string|null $context,
25
+        \Stringable | string | null $context,
26 26
         \Spiral\Core\Attribute\Proxy $attribute,
27 27
     ): object {
28 28
         $interface = $type->getName();
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
             $attribute->proxyOverloads ? '[magic-calls]' : '',
38 38
         );
39 39
 
40
-        if (!\array_key_exists($cacheKey, self::$classes)) {
40
+        if (!\array_key_exists($cacheKey, self::$classes)){
41 41
             $n = 0;
42
-            do {
42
+            do{
43 43
                 $className = \sprintf(
44 44
                     '%s\%s SCOPED PROXY%s',
45 45
                     $type->getNamespaceName(),
46 46
                     $type->getShortName(),
47 47
                     $n++ > 0 ? " {$n}" : '',
48 48
                 );
49
-            } while (\class_exists($className));
49
+            }while (\class_exists($className));
50 50
 
51 51
             /** @var class-string<TClass> $className */
52
-            try {
52
+            try{
53 53
                 $classString = ProxyClassRenderer::renderClass(
54 54
                     $type,
55 55
                     $className,
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 );
59 59
 
60 60
                 eval($classString);
61
-            } catch (\Throwable $e) {
61
+            }catch (\Throwable $e){
62 62
                 throw new \Error("Unable to create proxy for `{$interface}`: {$e->getMessage()}", 0, $e);
63 63
             }
64 64
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 
68 68
             // Store in cache without context
69 69
             self::$classes[$cacheKey] = $className;
70
-        } else {
70
+        }else{
71 71
             /** @var TClass $instance */
72 72
             $instance = new (self::$classes[$cacheKey])();
73 73
         }
74 74
 
75
-        if ($context !== null || $attachContainer) {
75
+        if ($context !== null || $attachContainer){
76 76
             (static function () use ($instance, $context, $attachContainer): void {
77 77
                 // Set the Current Context
78 78
                 /** @see \Spiral\Core\Internal\Proxy\ProxyTrait::$__container_proxy_context */
Please login to merge, or discard this patch.
src/Core/tests/Internal/Config/StateBinderTest.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@
 block discarded – undo
46 46
         $binder = $this->constructor->get('binder', BinderInterface::class);
47 47
         $factory = $this->constructor->get('factory', FactoryInterface::class);
48 48
 
49
-        $this->bindSingleton('test', new #[Singleton] class {});
49
+        $this->bindSingleton('test', new #[Singleton] class
50
+        {
51
+});
50 52
         $factory->make('test');
51 53
 
52 54
         $this->assertTrue($binder->hasInstance('test'));
Please login to merge, or discard this patch.
src/AnnotatedRoutes/tests/App/Controller/PageController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     #[Route('/page/<page>', name: 'page_get', methods: 'GET')]
12 12
     public function get($page): string
13 13
     {
14
-        return 'page-' . $page;
14
+        return 'page-'.$page;
15 15
     }
16 16
 
17 17
     #[Route('/page/about', name: 'page_about', methods: 'GET', priority: -1)]
Please login to merge, or discard this patch.
src/Core/src/Internal/Container.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     use DestructorTrait;
20 20
 
21 21
     private State $state;
22
-    private FactoryInterface|Factory $factory;
22
+    private FactoryInterface | Factory $factory;
23 23
     private Scope $scope;
24 24
 
25 25
     public function __construct(Registry $constructor)
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
      * @throws ContainerException
50 50
      * @throws \Throwable
51 51
      */
52
-    public function get(string|Autowire $id, \Stringable|string|null $context = null): mixed
52
+    public function get(string | Autowire $id, \Stringable | string | null $context = null): mixed
53 53
     {
54
-        if ($id instanceof Autowire) {
54
+        if ($id instanceof Autowire){
55 55
             return $id->resolve($this->factory);
56 56
         }
57 57
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function has(string $id): bool
63 63
     {
64
-        if (\array_key_exists($id, $this->state->bindings) || \array_key_exists($id, $this->state->singletons)) {
64
+        if (\array_key_exists($id, $this->state->bindings) || \array_key_exists($id, $this->state->singletons)){
65 65
             return true;
66 66
         }
67 67
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,8 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function get(string|Autowire $id, \Stringable|string|null $context = null): mixed
53 53
     {
54
-        if ($id instanceof Autowire) {
54
+        if ($id instanceof Autowire)
55
+        {
55 56
             return $id->resolve($this->factory);
56 57
         }
57 58
 
@@ -61,7 +62,8 @@  discard block
 block discarded – undo
61 62
 
62 63
     public function has(string $id): bool
63 64
     {
64
-        if (\array_key_exists($id, $this->state->bindings) || \array_key_exists($id, $this->state->singletons)) {
65
+        if (\array_key_exists($id, $this->state->bindings) || \array_key_exists($id, $this->state->singletons))
66
+        {
65 67
             return true;
66 68
         }
67 69
 
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/InfoCommand.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,35 +32,35 @@
 block discarded – undo
32 32
         $available = $config->getDeclarations();
33 33
 
34 34
         $i = 0;
35
-        foreach ($available as $name) {
36
-            $command = 'create:' . $name;
35
+        foreach ($available as $name){
36
+            $command = 'create:'.$name;
37 37
 
38
-            if (!$console->getApplication()->has($command)) {
38
+            if (!$console->getApplication()->has($command)){
39 39
                 continue;
40 40
             }
41 41
 
42 42
             $command = $console->getApplication()->get($command);
43 43
 
44
-            if ($i > 0) {
44
+            if ($i > 0){
45 45
                 $table->addRow(new TableSeparator());
46 46
             }
47 47
             $declaration = $config->getDeclaration($name);
48 48
 
49 49
             $options = [];
50
-            foreach ($declaration['options'] ?? [] as $key => $value) {
51
-                $options[] = $key . ': <fg=yellow>' . \json_encode(\str_replace($rootDir, '', $value)) . '</>';
50
+            foreach ($declaration['options'] ?? [] as $key => $value){
51
+                $options[] = $key.': <fg=yellow>'.\json_encode(\str_replace($rootDir, '', $value)).'</>';
52 52
             }
53 53
 
54 54
             $file = \str_replace($rootDir, '', $config->classFilename($name, $this->name));
55 55
             $namespace = $config->classNamespace($name, $this->name);
56 56
             $table->addRow([
57
-                $command->getName() . "\n<fg=gray>{$command->getDescription()}</>",
57
+                $command->getName()."\n<fg=gray>{$command->getDescription()}</>",
58 58
                 <<<TARGET
59 59
 path: <fg=green>/$file</>
60 60
 namespace: <fg=yellow>$namespace</>
61 61
 TARGET
62 62
                 .
63
-                ($options !== [] ? "\n" . \implode("\n", $options) : ''),
63
+                ($options !== [] ? "\n".\implode("\n", $options) : ''),
64 64
             ]);
65 65
 
66 66
             $i++;
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,22 +32,26 @@
 block discarded – undo
32 32
         $available = $config->getDeclarations();
33 33
 
34 34
         $i = 0;
35
-        foreach ($available as $name) {
35
+        foreach ($available as $name)
36
+        {
36 37
             $command = 'create:' . $name;
37 38
 
38
-            if (!$console->getApplication()->has($command)) {
39
+            if (!$console->getApplication()->has($command))
40
+            {
39 41
                 continue;
40 42
             }
41 43
 
42 44
             $command = $console->getApplication()->get($command);
43 45
 
44
-            if ($i > 0) {
46
+            if ($i > 0)
47
+            {
45 48
                 $table->addRow(new TableSeparator());
46 49
             }
47 50
             $declaration = $config->getDeclaration($name);
48 51
 
49 52
             $options = [];
50
-            foreach ($declaration['options'] ?? [] as $key => $value) {
53
+            foreach ($declaration['options'] ?? [] as $key => $value)
54
+            {
51 55
                 $options[] = $key . ': <fg=yellow>' . \json_encode(\str_replace($rootDir, '', $value)) . '</>';
52 56
             }
53 57
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
                 <<<TARGET
59 59
 path: <fg=green>/$file</>
60 60
 namespace: <fg=yellow>$namespace</>
61
-TARGET
61
+target
62 62
                 .
63 63
                 ($options !== [] ? "\n" . \implode("\n", $options) : ''),
64 64
             ]);
Please login to merge, or discard this patch.
src/Core/src/Config/DeprecationProxy.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
     public function __construct(
13 13
         string $interface,
14 14
         bool $singleton = false,
15
-        private readonly string|\BackedEnum|null $scope = null,
15
+        private readonly string | \BackedEnum | null $scope = null,
16 16
         private readonly ?string $version = null,
17 17
         private readonly ?string $message = null,
18
-    ) {
19
-        if (($scope === null || $version === null) && $message === null) {
18
+    ){
19
+        if (($scope === null || $version === null) && $message === null){
20 20
             throw new \InvalidArgumentException('Scope and version or custom message must be provided.');
21 21
         }
22 22
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@
 block discarded – undo
16 16
         private readonly ?string $version = null,
17 17
         private readonly ?string $message = null,
18 18
     ) {
19
-        if (($scope === null || $version === null) && $message === null) {
19
+        if (($scope === null || $version === null) && $message === null)
20
+        {
20 21
             throw new \InvalidArgumentException('Scope and version or custom message must be provided.');
21 22
         }
22 23
 
Please login to merge, or discard this patch.
src/Core/tests/Internal/Common/RegistryTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         $option->checkScope = true;
32 32
         yield [$option];
33 33
 
34
-        $option = new class extends Options {
34
+        $option = new class extends Options{
35 35
             public int $customOption = 3;
36 36
         };
37 37
         $option->customOption = 5;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
         $option->checkScope = true;
32 32
         yield [$option];
33 33
 
34
-        $option = new class extends Options {
34
+        $option = new class extends Options
35
+        {
35 36
             public int $customOption = 3;
36 37
         };
37 38
         $option->customOption = 5;
Please login to merge, or discard this patch.
src/Core/src/Attribute/Scope.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
 {
15 15
     public readonly string $name;
16 16
 
17
-    public function __construct(string|\BackedEnum $name)
17
+    public function __construct(string | \BackedEnum $name)
18 18
     {
19
-        $this->name = \is_object($name) ? (string) $name->value : $name;
19
+        $this->name = \is_object($name) ? (string)$name->value : $name;
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
src/Hmvc/tests/Unit/InterceptorPipelineTest.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,9 +89,12 @@  discard block
 block discarded – undo
89 89
             new ExceptionInterceptor(),
90 90
         ], self::createMock(CoreInterface::class));
91 91
 
92
-        try {
92
+        try
93
+        {
93 94
             $pipeline->callAction('controller', 'action');
94
-        } catch (\RuntimeException) {
95
+        }
96
+        catch (\RuntimeException)
97
+        {
95 98
             // Attributes won't be lost after legacy interceptor
96 99
             self::assertSame(['key' => 'value'], $state->context->getAttributes());
97 100
         }
@@ -111,7 +114,8 @@  discard block
 block discarded – undo
111 114
         $lastHandler instanceof CoreInterface and $pipeline = $pipeline->withCore($lastHandler);
112 115
         $lastHandler instanceof HandlerInterface and $pipeline = $pipeline->withHandler($lastHandler);
113 116
 
114
-        foreach ($interceptors as $interceptor) {
117
+        foreach ($interceptors as $interceptor)
118
+        {
115 119
             $pipeline->addInterceptor($interceptor);
116 120
         }
117 121
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
             new ExceptionInterceptor(),
92 92
         ], self::createMock(CoreInterface::class));
93 93
 
94
-        try {
94
+        try{
95 95
             $pipeline->callAction('controller', 'action');
96
-        } catch (\RuntimeException) {
96
+        }catch (\RuntimeException){
97 97
             // Attributes won't be lost after legacy interceptor
98 98
             self::assertSame(['key' => 'value'], $state->context->getAttributes());
99 99
         }
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
      */
125 125
     private function createPipeline(
126 126
         array $interceptors = [],
127
-        CoreInterface|HandlerInterface|null $lastHandler = null,
128
-        EventDispatcherInterface|null $dispatcher = null,
127
+        CoreInterface | HandlerInterface | null $lastHandler = null,
128
+        EventDispatcherInterface | null $dispatcher = null,
129 129
     ): InterceptorPipeline {
130 130
         $pipeline = new InterceptorPipeline($dispatcher);
131 131
 
132 132
         $lastHandler instanceof CoreInterface and $pipeline = $pipeline->withCore($lastHandler);
133 133
         $lastHandler instanceof HandlerInterface and $pipeline = $pipeline->withHandler($lastHandler);
134 134
 
135
-        foreach ($interceptors as $interceptor) {
135
+        foreach ($interceptors as $interceptor){
136 136
             $pipeline->addInterceptor($interceptor);
137 137
         }
138 138
 
Please login to merge, or discard this patch.