Passed
Push — master ( e8b00c...89139c )
by Anton
07:46
created
src/DataGrid/src/helpers.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function hasKey(array $array, $search): bool
23 23
 {
24
-    foreach ($array as $key => $_) {
25
-        if (equals($key, $search)) {
24
+    foreach ($array as $key => $_){
25
+        if (equals($key, $search)){
26 26
             return true;
27 27
         }
28 28
     }
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function hasValue(array $array, $search): bool
39 39
 {
40
-    foreach ($array as $value) {
41
-        if (equals($value, $search)) {
40
+    foreach ($array as $value){
41
+        if (equals($value, $search)){
42 42
             return true;
43 43
         }
44 44
     }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function getValue(array $array, string $search)
58 58
 {
59
-    foreach ($array as $key => $value) {
60
-        if (equals($key, $search)) {
59
+    foreach ($array as $key => $value){
60
+        if (equals($key, $search)){
61 61
             return $value;
62 62
         }
63 63
     }
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function equals($value1, $value2): bool
75 75
 {
76
-    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0) {
76
+    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0){
77 77
         return true;
78 78
     }
79 79
 
80
-    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0) {
80
+    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0){
81 81
         return true;
82 82
     }
83 83
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,8 +21,10 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function hasKey(array $array, $search): bool
23 23
 {
24
-    foreach ($array as $key => $_) {
25
-        if (equals($key, $search)) {
24
+    foreach ($array as $key => $_)
25
+    {
26
+        if (equals($key, $search))
27
+        {
26 28
             return true;
27 29
         }
28 30
     }
@@ -37,8 +39,10 @@  discard block
 block discarded – undo
37 39
  */
38 40
 function hasValue(array $array, $search): bool
39 41
 {
40
-    foreach ($array as $value) {
41
-        if (equals($value, $search)) {
42
+    foreach ($array as $value)
43
+    {
44
+        if (equals($value, $search))
45
+        {
42 46
             return true;
43 47
         }
44 48
     }
@@ -56,8 +60,10 @@  discard block
 block discarded – undo
56 60
  */
57 61
 function getValue(array $array, string $search)
58 62
 {
59
-    foreach ($array as $key => $value) {
60
-        if (equals($key, $search)) {
63
+    foreach ($array as $key => $value)
64
+    {
65
+        if (equals($key, $search))
66
+        {
61 67
             return $value;
62 68
         }
63 69
     }
@@ -73,11 +79,13 @@  discard block
 block discarded – undo
73 79
  */
74 80
 function equals($value1, $value2): bool
75 81
 {
76
-    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0) {
82
+    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0)
83
+    {
77 84
         return true;
78 85
     }
79 86
 
80
-    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0) {
87
+    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0)
88
+    {
81 89
         return true;
82 90
     }
83 91
 
Please login to merge, or discard this patch.
src/Scaffolder/src/helpers.php 2 patches
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 
12 12
 namespace Spiral\Scaffolder;
13 13
 
14
-if (!function_exists('trimPostfix')) {
14
+if (!function_exists('trimPostfix'))
15
+{
15 16
     /**
16 17
      * @param string $name
17 18
      * @param string $postfix
@@ -26,7 +27,8 @@  discard block
 block discarded – undo
26 27
     }
27 28
 }
28 29
 
29
-if (!function_exists('isAssociativeArray')) {
30
+if (!function_exists('isAssociativeArray'))
31
+{
30 32
     /**
31 33
      * @param array $array
32 34
      * @return bool
@@ -35,12 +37,15 @@  discard block
 block discarded – undo
35 37
     function isAssociativeArray(array $array): bool
36 38
     {
37 39
         $keys = [];
38
-        foreach ($array as $key => $_) {
39
-            if (!is_int($key)) {
40
+        foreach ($array as $key => $_)
41
+        {
42
+            if (!is_int($key))
43
+            {
40 44
                 return true;
41 45
             }
42 46
 
43
-            if ($key !== count($keys)) {
47
+            if ($key !== count($keys))
48
+            {
44 49
                 return true;
45 50
             }
46 51
 
@@ -51,7 +56,8 @@  discard block
 block discarded – undo
51 56
     }
52 57
 }
53 58
 
54
-if (!function_exists('defineArrayType')) {
59
+if (!function_exists('defineArrayType'))
60
+{
55 61
     /**
56 62
      * @param array  $array
57 63
      * @param string|null $failureType
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 namespace Spiral\Scaffolder;
13 13
 
14
-if (!function_exists('trimPostfix')) {
14
+if (!function_exists('trimPostfix')){
15 15
     /**
16 16
      * @param string $name
17 17
      * @param string $postfix
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     }
27 27
 }
28 28
 
29
-if (!function_exists('isAssociativeArray')) {
29
+if (!function_exists('isAssociativeArray')){
30 30
     /**
31 31
      * @param array $array
32 32
      * @return bool
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
     function isAssociativeArray(array $array): bool
36 36
     {
37 37
         $keys = [];
38
-        foreach ($array as $key => $_) {
39
-            if (!is_int($key)) {
38
+        foreach ($array as $key => $_){
39
+            if (!is_int($key)){
40 40
                 return true;
41 41
             }
42 42
 
43
-            if ($key !== count($keys)) {
43
+            if ($key !== count($keys)){
44 44
                 return true;
45 45
             }
46 46
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     }
52 52
 }
53 53
 
54
-if (!function_exists('defineArrayType')) {
54
+if (!function_exists('defineArrayType')){
55 55
     /**
56 56
      * @param array  $array
57 57
      * @param string|null $failureType
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     function defineArrayType(array $array, string $failureType = null): ?string
62 62
     {
63
-        $types = array_map(static fn ($value): string => gettype($value), $array);
63
+        $types = array_map(static fn ($value) : string => gettype($value), $array);
64 64
 
65 65
         $types = array_unique($types);
66 66
 
Please login to merge, or discard this patch.
src/Attributes/src/Composite/MergeReader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     protected function each(callable $resolver): iterable
20 20
     {
21
-        foreach ($this->readers as $reader) {
21
+        foreach ($this->readers as $reader){
22 22
             yield from $resolver($reader);
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
      */
19 19
     protected function each(callable $resolver): iterable
20 20
     {
21
-        foreach ($this->readers as $reader) {
21
+        foreach ($this->readers as $reader)
22
+        {
22 23
             yield from $resolver($reader);
23 24
         }
24 25
     }
Please login to merge, or discard this patch.
src/Attributes/src/Composite/SelectiveReader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
      */
19 19
     protected function each(callable $resolver): iterable
20 20
     {
21
-        foreach ($this->readers as $reader) {
21
+        foreach ($this->readers as $reader){
22 22
             $result = $this->iterableToArray($resolver($reader));
23 23
 
24
-            if (\count($result) > 0) {
24
+            if (\count($result) > 0){
25 25
                 return $result;
26 26
             }
27 27
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,12 @@
 block discarded – undo
18 18
      */
19 19
     protected function each(callable $resolver): iterable
20 20
     {
21
-        foreach ($this->readers as $reader) {
21
+        foreach ($this->readers as $reader)
22
+        {
22 23
             $result = $this->iterableToArray($resolver($reader));
23 24
 
24
-            if (\count($result) > 0) {
25
+            if (\count($result) > 0)
26
+            {
25 27
                 return $result;
26 28
             }
27 29
         }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Cycle/SchemaBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     public function getGenerators(): array
86 86
     {
87 87
         $result = [];
88
-        foreach ($this->generators as $group) {
89
-            foreach ($group as $generator) {
90
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
88
+        foreach ($this->generators as $group){
89
+            foreach ($group as $generator){
90
+                if (is_object($generator) && !$generator instanceof Container\Autowire){
91 91
                     $result[] = $generator;
92
-                } else {
92
+                }else{
93 93
                     $result[] = $this->container->get($generator);
94 94
                 }
95 95
             }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     protected function schema(MemoryInterface $memory): SchemaInterface
108 108
     {
109 109
         $schemaCompiler = SchemaCompiler::fromMemory($memory);
110
-        if ($schemaCompiler->isEmpty()) {
110
+        if ($schemaCompiler->isEmpty()){
111 111
             $schemaCompiler = SchemaCompiler::compile(
112 112
                 $this->container->get(Registry::class),
113 113
                 $this->getGenerators()
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,11 +85,16 @@  discard block
 block discarded – undo
85 85
     public function getGenerators(): array
86 86
     {
87 87
         $result = [];
88
-        foreach ($this->generators as $group) {
89
-            foreach ($group as $generator) {
90
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
88
+        foreach ($this->generators as $group)
89
+        {
90
+            foreach ($group as $generator)
91
+            {
92
+                if (is_object($generator) && !$generator instanceof Container\Autowire)
93
+                {
91 94
                     $result[] = $generator;
92
-                } else {
95
+                }
96
+                else
97
+                {
93 98
                     $result[] = $this->container->get($generator);
94 99
                 }
95 100
             }
@@ -107,7 +112,8 @@  discard block
 block discarded – undo
107 112
     protected function schema(MemoryInterface $memory): SchemaInterface
108 113
     {
109 114
         $schemaCompiler = SchemaCompiler::fromMemory($memory);
110
-        if ($schemaCompiler->isEmpty()) {
115
+        if ($schemaCompiler->isEmpty())
116
+        {
111 117
             $schemaCompiler = SchemaCompiler::compile(
112 118
                 $this->container->get(Registry::class),
113 119
                 $this->getGenerators()
Please login to merge, or discard this patch.
src/Framework/Command/Cycle/SyncCommand.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         );
45 45
         $schemaCompiler->toMemory($memory);
46 46
 
47
-        if ($show->hasChanges()) {
47
+        if ($show->hasChanges()){
48 48
             $this->writeln("\n<info>ORM Schema has been synchronized</info>");
49 49
         }
50 50
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,8 @@
 block discarded – undo
44 44
         );
45 45
         $schemaCompiler->toMemory($memory);
46 46
 
47
-        if ($show->hasChanges()) {
47
+        if ($show->hasChanges())
48
+        {
48 49
             $this->writeln("\n<info>ORM Schema has been synchronized</info>");
49 50
         }
50 51
     }
Please login to merge, or discard this patch.
src/Prototype/tests/Commands/AbstractCommandsTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function __construct($name = null, array $data = [], $dataName = '')
41 41
     {
42
-        $this->storage = new Storage($this->dir() . '/Fixtures/');
42
+        $this->storage = new Storage($this->dir().'/Fixtures/');
43 43
         parent::__construct($name, $data, $dataName);
44 44
     }
45 45
 
46 46
     public function setUp(): void
47 47
     {
48
-        if (!\class_exists(Kernel::class)) {
48
+        if (!\class_exists(Kernel::class)){
49 49
             $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests');
50 50
         }
51 51
 
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
             'cache'  => sys_get_temp_dir()
57 57
         ], null, false);
58 58
 
59
-        foreach (static::STORE as $name) {
59
+        foreach (static::STORE as $name){
60 60
             $this->storage->store($name);
61 61
         }
62 62
     }
63 63
 
64 64
     public function tearDown(): void
65 65
     {
66
-        foreach (static::STORE as $name) {
66
+        foreach (static::STORE as $name){
67 67
             $this->storage->restore($name);
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function setUp(): void
47 47
     {
48
-        if (!\class_exists(Kernel::class)) {
48
+        if (!\class_exists(Kernel::class))
49
+        {
49 50
             $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests');
50 51
         }
51 52
 
@@ -56,14 +57,16 @@  discard block
 block discarded – undo
56 57
             'cache'  => sys_get_temp_dir()
57 58
         ], null, false);
58 59
 
59
-        foreach (static::STORE as $name) {
60
+        foreach (static::STORE as $name)
61
+        {
60 62
             $this->storage->store($name);
61 63
         }
62 64
     }
63 65
 
64 66
     public function tearDown(): void
65 67
     {
66
-        foreach (static::STORE as $name) {
68
+        foreach (static::STORE as $name)
69
+        {
67 70
             $this->storage->restore($name);
68 71
         }
69 72
     }
Please login to merge, or discard this patch.
src/Prototype/tests/Commands/InjectCommandTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $source = file_get_contents($filename);
30 30
         $this->assertStringContainsString('use PrototypeTrait;', $source);
31 31
 
32
-        try {
32
+        try{
33 33
             $this->app->bindApp();
34 34
 
35 35
             $inp = new ArrayInput(['--remove' => true]);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             $this->app->get(Console::class)->run('prototype:inject', $inp, $out);
38 38
 
39 39
             $this->assertStringNotContainsString('use PrototypeTrait;', file_get_contents($filename));
40
-        } finally {
40
+        }finally{
41 41
             file_put_contents($filename, $source);
42 42
         }
43 43
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
         $source = file_get_contents($filename);
30 30
         $this->assertStringContainsString('use PrototypeTrait;', $source);
31 31
 
32
-        try {
32
+        try
33
+        {
33 34
             $this->app->bindApp();
34 35
 
35 36
             $inp = new ArrayInput(['--remove' => true]);
@@ -37,7 +38,9 @@  discard block
 block discarded – undo
37 38
             $this->app->get(Console::class)->run('prototype:inject', $inp, $out);
38 39
 
39 40
             $this->assertStringNotContainsString('use PrototypeTrait;', file_get_contents($filename));
40
-        } finally {
41
+        }
42
+        finally
43
+        {
41 44
             file_put_contents($filename, $source);
42 45
         }
43 46
     }
Please login to merge, or discard this patch.
src/Attributes/src/Internal/Instantiator/DoctrineInstantiator.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @var string
31 31
      */
32 32
     private const ERROR_INVALID_PROPERTY =
33
-        'The attribute #[%s] declared on %s does not have a property named "%s".' . "\n" .
33
+        'The attribute #[%s] declared on %s does not have a property named "%s".'."\n".
34 34
         'Available properties: %s'
35 35
     ;
36 36
 
@@ -61,23 +61,23 @@  discard block
 block discarded – undo
61 61
         $arguments = $this->formatArguments($arguments);
62 62
 
63 63
         // Using constructor
64
-        if ($this->getConstructor($attr)) {
64
+        if ($this->getConstructor($attr)){
65 65
             return $attr->newInstance($arguments);
66 66
         }
67 67
 
68 68
         // Using direct insert
69 69
         $instance = $attr->newInstanceWithoutConstructor();
70 70
 
71
-        foreach ($arguments as $name => $value) {
72
-            try {
71
+        foreach ($arguments as $name => $value){
72
+            try{
73 73
                 $property = $attr->getProperty($name);
74 74
 
75
-                if (!$property->isPublic()) {
75
+                if (!$property->isPublic()){
76 76
                     throw $this->propertyNotFound($attr, $name, $context);
77 77
                 }
78 78
 
79 79
                 $instance->$name = $value;
80
-            } catch (\Throwable $e) {
80
+            }catch (\Throwable $e){
81 81
                 throw $this->propertyNotFound($attr, $name, $context);
82 82
             }
83 83
         }
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $result = [];
95 95
 
96
-        foreach ($arguments as $name => $value) {
97
-            if (\is_int($name)) {
96
+        foreach ($arguments as $name => $value){
97
+            if (\is_int($name)){
98 98
                 $this->validateArgumentPosition($name, $value);
99 99
 
100 100
                 $name = self::DEFAULT_PROPERTY_NAME;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     private function validateArgumentPosition(int $index, $value): void
114 114
     {
115
-        if ($index === 0) {
115
+        if ($index === 0){
116 116
             return;
117 117
         }
118 118
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,23 +61,29 @@  discard block
 block discarded – undo
61 61
         $arguments = $this->formatArguments($arguments);
62 62
 
63 63
         // Using constructor
64
-        if ($this->getConstructor($attr)) {
64
+        if ($this->getConstructor($attr))
65
+        {
65 66
             return $attr->newInstance($arguments);
66 67
         }
67 68
 
68 69
         // Using direct insert
69 70
         $instance = $attr->newInstanceWithoutConstructor();
70 71
 
71
-        foreach ($arguments as $name => $value) {
72
-            try {
72
+        foreach ($arguments as $name => $value)
73
+        {
74
+            try
75
+            {
73 76
                 $property = $attr->getProperty($name);
74 77
 
75
-                if (!$property->isPublic()) {
78
+                if (!$property->isPublic())
79
+                {
76 80
                     throw $this->propertyNotFound($attr, $name, $context);
77 81
                 }
78 82
 
79 83
                 $instance->$name = $value;
80
-            } catch (\Throwable $e) {
84
+            }
85
+            catch (\Throwable $e)
86
+            {
81 87
                 throw $this->propertyNotFound($attr, $name, $context);
82 88
             }
83 89
         }
@@ -93,8 +99,10 @@  discard block
 block discarded – undo
93 99
     {
94 100
         $result = [];
95 101
 
96
-        foreach ($arguments as $name => $value) {
97
-            if (\is_int($name)) {
102
+        foreach ($arguments as $name => $value)
103
+        {
104
+            if (\is_int($name))
105
+            {
98 106
                 $this->validateArgumentPosition($name, $value);
99 107
 
100 108
                 $name = self::DEFAULT_PROPERTY_NAME;
@@ -112,7 +120,8 @@  discard block
 block discarded – undo
112 120
      */
113 121
     private function validateArgumentPosition(int $index, $value): void
114 122
     {
115
-        if ($index === 0) {
123
+        if ($index === 0)
124
+        {
116 125
             return;
117 126
         }
118 127
 
Please login to merge, or discard this patch.