@@ -32,7 +32,8 @@ discard block |
||
32 | 32 | |
33 | 33 | public function listen(\ReflectionClass $class): void |
34 | 34 | { |
35 | - if (!$this->isTargeted($class, $this->target)) { |
|
35 | + if (!$this->isTargeted($class, $this->target)) |
|
36 | + { |
|
36 | 37 | return; |
37 | 38 | } |
38 | 39 | |
@@ -41,8 +42,10 @@ discard block |
||
41 | 42 | |
42 | 43 | public function finalize(): void |
43 | 44 | { |
44 | - foreach ($this->commands as $class) { |
|
45 | - if ($class->isAbstract()) { |
|
45 | + foreach ($this->commands as $class) |
|
46 | + { |
|
47 | + if ($class->isAbstract()) |
|
48 | + { |
|
46 | 49 | continue; |
47 | 50 | } |
48 | 51 | |
@@ -55,7 +58,8 @@ discard block |
||
55 | 58 | */ |
56 | 59 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool |
57 | 60 | { |
58 | - if (!$target->isTrait()) { |
|
61 | + if (!$target->isTrait()) |
|
62 | + { |
|
59 | 63 | // Target is interface or class |
60 | 64 | return $class->isSubclassOf($target) || $class->getName() === $target->getName(); |
61 | 65 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | public function __construct( |
27 | 27 | private readonly ConsoleBootloader $bootloader, |
28 | 28 | ContainerInterface $container, |
29 | - ) { |
|
29 | + ){ |
|
30 | 30 | $this->container = $container; |
31 | 31 | $this->target = new \ReflectionClass(SymfonyCommand::class); |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function listen(\ReflectionClass $class): void |
35 | 35 | { |
36 | - if (!$this->isTargeted($class, $this->target)) { |
|
36 | + if (!$this->isTargeted($class, $this->target)){ |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | public function finalize(): void |
44 | 44 | { |
45 | - foreach ($this->commands as $class) { |
|
46 | - if ($class->isAbstract()) { |
|
45 | + foreach ($this->commands as $class){ |
|
46 | + if ($class->isAbstract()){ |
|
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool |
58 | 58 | { |
59 | - if (!$target->isTrait()) { |
|
59 | + if (!$target->isTrait()){ |
|
60 | 60 | // Target is interface or class |
61 | 61 | return $class->isSubclassOf($target) || $class->getName() === $target->getName(); |
62 | 62 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | use MockeryPHPUnitIntegration; |
19 | 19 | |
20 | 20 | private ClassLocatorByTarget $locator; |
21 | - private ClassesInterface|m\LegacyMockInterface|m\MockInterface $classes; |
|
22 | - private ScopedClassesInterface|m\LegacyMockInterface|m\MockInterface $scopedClasses; |
|
21 | + private ClassesInterface | m\LegacyMockInterface | m\MockInterface $classes; |
|
22 | + private ScopedClassesInterface | m\LegacyMockInterface | m\MockInterface $scopedClasses; |
|
23 | 23 | |
24 | 24 | protected function setUp(): void |
25 | 25 | { |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | $attr = $attr->getAttributes()[0]; |
111 | 111 | $attribute = $attr->newInstance(); |
112 | 112 | |
113 | - if ($attribute->getScope() === null) { |
|
113 | + if ($attribute->getScope() === null){ |
|
114 | 114 | $this->classes |
115 | 115 | ->shouldReceive('getClasses') |
116 | 116 | ->andReturn($classes); |
117 | - } else { |
|
117 | + }else{ |
|
118 | 118 | $this->scopedClasses |
119 | 119 | ->shouldReceive('getScopedClasses') |
120 | 120 | ->with($attribute->getScope()) |
@@ -110,11 +110,14 @@ |
||
110 | 110 | $attr = $attr->getAttributes()[0]; |
111 | 111 | $attribute = $attr->newInstance(); |
112 | 112 | |
113 | - if ($attribute->getScope() === null) { |
|
113 | + if ($attribute->getScope() === null) |
|
114 | + { |
|
114 | 115 | $this->classes |
115 | 116 | ->shouldReceive('getClasses') |
116 | 117 | ->andReturn($classes); |
117 | - } else { |
|
118 | + } |
|
119 | + else |
|
120 | + { |
|
118 | 121 | $this->scopedClasses |
119 | 122 | ->shouldReceive('getScopedClasses') |
120 | 123 | ->with($attribute->getScope()) |
@@ -8,7 +8,8 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct() |
10 | 10 | { |
11 | - $class = new class ('foo', 'bar') { |
|
11 | + $class = new class ('foo', 'bar') |
|
12 | + { |
|
12 | 13 | private function someFunc(): void |
13 | 14 | { |
14 | 15 | } |
@@ -19,13 +19,13 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | } |
22 | -class;FOO; |
|
22 | +class; FOO; |
|
23 | 23 | |
24 | 24 | <<<'class' |
25 | 25 | class FooBar |
26 | 26 | { |
27 | 27 | |
28 | 28 | } |
29 | -class ;FOO; |
|
29 | +class; FOO; |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function __construct() |
12 | 12 | { |
13 | 13 | <<<class |
14 | -FooBar |
|
14 | +foobar |
|
15 | 15 | class; |
16 | 16 | |
17 | 17 | <<<class |
@@ -24,7 +24,7 @@ |
||
24 | 24 | 'alias' => $alias, |
25 | 25 | '--description' => 'My sample command description', |
26 | 26 | ]; |
27 | - if ($alias === null) { |
|
27 | + if ($alias === null){ |
|
28 | 28 | unset($input['alias']); |
29 | 29 | } |
30 | 30 |
@@ -24,7 +24,8 @@ |
||
24 | 24 | 'alias' => $alias, |
25 | 25 | '--description' => 'My sample command description', |
26 | 26 | ]; |
27 | - if ($alias === null) { |
|
27 | + if ($alias === null) |
|
28 | + { |
|
28 | 29 | unset($input['alias']); |
29 | 30 | } |
30 | 31 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ?string $namespace = null, |
23 | 23 | private readonly ?string $alias = null, |
24 | 24 | private readonly ?string $description = null, |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | parent::__construct($config, $name, $comment, $namespace); |
27 | 27 | } |
28 | 28 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'name' => $this->alias, |
70 | 70 | ]; |
71 | 71 | |
72 | - if ($this->description) { |
|
72 | + if ($this->description){ |
|
73 | 73 | $commandDefinition['description'] = $this->description; |
74 | 74 | } |
75 | 75 |
@@ -69,7 +69,8 @@ |
||
69 | 69 | 'name' => $this->alias, |
70 | 70 | ]; |
71 | 71 | |
72 | - if ($this->description) { |
|
72 | + if ($this->description) |
|
73 | + { |
|
73 | 74 | $commandDefinition['description'] = $this->description; |
74 | 75 | } |
75 | 76 |
@@ -33,11 +33,11 @@ |
||
33 | 33 | { |
34 | 34 | $declaration = $this->createDeclaration(ControllerDeclaration::class); |
35 | 35 | |
36 | - foreach ($this->actions as $action) { |
|
36 | + foreach ($this->actions as $action){ |
|
37 | 37 | $declaration->addAction($action); |
38 | 38 | } |
39 | 39 | |
40 | - if ($this->usePrototype) { |
|
40 | + if ($this->usePrototype){ |
|
41 | 41 | $declaration->addPrototypeTrait(); |
42 | 42 | } |
43 | 43 |
@@ -33,11 +33,13 @@ |
||
33 | 33 | { |
34 | 34 | $declaration = $this->createDeclaration(ControllerDeclaration::class); |
35 | 35 | |
36 | - foreach ($this->actions as $action) { |
|
36 | + foreach ($this->actions as $action) |
|
37 | + { |
|
37 | 38 | $declaration->addAction($action); |
38 | 39 | } |
39 | 40 | |
40 | - if ($this->usePrototype) { |
|
41 | + if ($this->usePrototype) |
|
42 | + { |
|
41 | 43 | $declaration->addPrototypeTrait(); |
42 | 44 | } |
43 | 45 |
@@ -33,11 +33,11 @@ |
||
33 | 33 | { |
34 | 34 | $declaration = $this->createDeclaration(FilterDeclaration::class); |
35 | 35 | |
36 | - foreach ($this->properties as $property) { |
|
36 | + foreach ($this->properties as $property){ |
|
37 | 37 | $declaration->addProperty($property); |
38 | 38 | } |
39 | 39 | |
40 | - if ($this->useValidator) { |
|
40 | + if ($this->useValidator){ |
|
41 | 41 | $declaration->addFilterDefinition(); |
42 | 42 | } |
43 | 43 |
@@ -33,11 +33,13 @@ |
||
33 | 33 | { |
34 | 34 | $declaration = $this->createDeclaration(FilterDeclaration::class); |
35 | 35 | |
36 | - foreach ($this->properties as $property) { |
|
36 | + foreach ($this->properties as $property) |
|
37 | + { |
|
37 | 38 | $declaration->addProperty($property); |
38 | 39 | } |
39 | 40 | |
40 | - if ($this->useValidator) { |
|
41 | + if ($this->useValidator) |
|
42 | + { |
|
41 | 43 | $declaration->addFilterDefinition(); |
42 | 44 | } |
43 | 45 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | return new $validationClass(validationRules: [ |
71 | 71 | // Put your validation rules here |
72 | 72 | ]); |
73 | -PHP, |
|
73 | +php, |
|
74 | 74 | ); |
75 | 75 | } |
76 | 76 |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | string $name, |
30 | 30 | ?string $comment = null, |
31 | 31 | ?string $namespace = null, |
32 | - ) { |
|
32 | + ){ |
|
33 | 33 | parent::__construct($config, $name, $comment, $namespace); |
34 | 34 | |
35 | - try { |
|
35 | + try{ |
|
36 | 36 | $this->validationConfig = $container->get(ValidationConfig::class); |
37 | - } catch (\Throwable) { |
|
37 | + }catch (\Throwable){ |
|
38 | 38 | // Validation is not configured |
39 | 39 | $this->validationConfig = null; |
40 | 40 | } |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | public function addFilterDefinition(): void |
52 | 52 | { |
53 | 53 | $validation = $this->validationConfig?->getDefaultValidator(); |
54 | - if ($validation === null) { |
|
54 | + if ($validation === null){ |
|
55 | 55 | throw new ValidationException( |
56 | 56 | 'Default Validator is not configured. Read more at https://spiral.dev/docs/validation-factory', |
57 | 57 | ); |
58 | 58 | } |
59 | 59 | |
60 | - if (!\class_exists($validation)) { |
|
60 | + if (!\class_exists($validation)){ |
|
61 | 61 | throw new ValidationException( |
62 | 62 | \sprintf( |
63 | 63 | 'Default Validator "%s" is not class or does not exist.', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $p = $this->class->addProperty($property->getName()) |
92 | 92 | ->setType($property->getType()); |
93 | 93 | |
94 | - foreach ($property->getAttributes() as $attribute) { |
|
94 | + foreach ($property->getAttributes() as $attribute){ |
|
95 | 95 | $p->addAttribute($attribute->getName(), $attribute->getArguments()); |
96 | 96 | } |
97 | 97 | } |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | { |
109 | 109 | $declaredType = null; |
110 | 110 | |
111 | - if (\str_contains($property, ':')) { |
|
111 | + if (\str_contains($property, ':')){ |
|
112 | 112 | $segments = \explode(':', $property, 3); |
113 | 113 | |
114 | - if (\count($segments) === 3) { |
|
114 | + if (\count($segments) === 3){ |
|
115 | 115 | [$property, $source, $declaredType] = $segments; |
116 | - } else { |
|
116 | + }else{ |
|
117 | 117 | [$property, $source] = $segments; |
118 | 118 | } |
119 | 119 | } |
@@ -32,9 +32,12 @@ discard block |
||
32 | 32 | ) { |
33 | 33 | parent::__construct($config, $name, $comment, $namespace); |
34 | 34 | |
35 | - try { |
|
35 | + try |
|
36 | + { |
|
36 | 37 | $this->validationConfig = $container->get(ValidationConfig::class); |
37 | - } catch (\Throwable) { |
|
38 | + } |
|
39 | + catch (\Throwable) |
|
40 | + { |
|
38 | 41 | // Validation is not configured |
39 | 42 | $this->validationConfig = null; |
40 | 43 | } |
@@ -51,13 +54,15 @@ discard block |
||
51 | 54 | public function addFilterDefinition(): void |
52 | 55 | { |
53 | 56 | $validation = $this->validationConfig?->getDefaultValidator(); |
54 | - if ($validation === null) { |
|
57 | + if ($validation === null) |
|
58 | + { |
|
55 | 59 | throw new ValidationException( |
56 | 60 | 'Default Validator is not configured. Read more at https://spiral.dev/docs/validation-factory', |
57 | 61 | ); |
58 | 62 | } |
59 | 63 | |
60 | - if (!\class_exists($validation)) { |
|
64 | + if (!\class_exists($validation)) |
|
65 | + { |
|
61 | 66 | throw new ValidationException( |
62 | 67 | \sprintf( |
63 | 68 | 'Default Validator "%s" is not class or does not exist.', |
@@ -91,7 +96,8 @@ discard block |
||
91 | 96 | $p = $this->class->addProperty($property->getName()) |
92 | 97 | ->setType($property->getType()); |
93 | 98 | |
94 | - foreach ($property->getAttributes() as $attribute) { |
|
99 | + foreach ($property->getAttributes() as $attribute) |
|
100 | + { |
|
95 | 101 | $p->addAttribute($attribute->getName(), $attribute->getArguments()); |
96 | 102 | } |
97 | 103 | } |
@@ -108,12 +114,16 @@ discard block |
||
108 | 114 | { |
109 | 115 | $declaredType = null; |
110 | 116 | |
111 | - if (\str_contains($property, ':')) { |
|
117 | + if (\str_contains($property, ':')) |
|
118 | + { |
|
112 | 119 | $segments = \explode(':', $property, 3); |
113 | 120 | |
114 | - if (\count($segments) === 3) { |
|
121 | + if (\count($segments) === 3) |
|
122 | + { |
|
115 | 123 | [$property, $source, $declaredType] = $segments; |
116 | - } else { |
|
124 | + } |
|
125 | + else |
|
126 | + { |
|
117 | 127 | [$property, $source] = $segments; |
118 | 128 | } |
119 | 129 | } |