Passed
Push — dev_2x ( 5f9618...4436d9 )
by Adrian
01:44
created
src/Relation/ManyToMany.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             ->newQuery();
59 59
 
60 60
         $query = $this->joinWithThroughTable($query)
61
-                      ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
61
+                        ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
62 62
 
63 63
         $query = $this->applyQueryCallback($query);
64 64
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $subselect = $this->foreignMapper->newQuery();
112 112
         $subselect = $query->subSelectForJoinWith($this->foreignMapper)
113
-                           ->as($reference);
113
+                            ->as($reference);
114 114
         #$subselect->resetGuards();
115 115
         #$subselect->setGuards($this->foreignMapper->getConfig()->getGuards());
116 116
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,28 +22,28 @@  discard block
 block discarded – undo
22 22
         parent::applyDefaults();
23 23
 
24 24
         $foreignKey = $this->foreignMapper->getConfig()->getPrimaryKey();
25
-        if (! isset($this->options[RelationConfig::FOREIGN_KEY])) {
25
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
26 26
             $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey;
27 27
         }
28 28
 
29 29
         $nativeKey = $this->foreignMapper->getConfig()->getPrimaryKey();
30
-        if (! isset($this->options[RelationConfig::NATIVE_KEY])) {
30
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
31 31
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
32 32
         }
33 33
 
34
-        if (! isset($this->options[RelationConfig::THROUGH_TABLE])) {
34
+        if (!isset($this->options[RelationConfig::THROUGH_TABLE])) {
35 35
             $tables = [$this->foreignMapper->getConfig()->getTable(), $this->nativeMapper->getConfig()->getTable()];
36 36
             sort($tables);
37 37
             $this->options[RelationConfig::THROUGH_TABLE] = implode('_', $tables);
38 38
         }
39 39
 
40
-        if (! isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
40
+        if (!isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
41 41
             $prefix = Inflector::singularize($this->nativeMapper->getConfig()->getTableAlias(true));
42 42
 
43 43
             $this->options[RelationConfig::THROUGH_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey);
44 44
         }
45 45
 
46
-        if (! isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
46
+        if (!isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
47 47
             $prefix = Inflector::singularize($this->foreignMapper->getConfig()->getTableAlias(true));
48 48
 
49 49
             $this->options[RelationConfig::THROUGH_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS);
97 97
         $throughName  = $throughAlias ?? $through;
98 98
 
99
-        if (! empty($throughColumns)) {
99
+        if (!empty($throughColumns)) {
100 100
             foreach ($throughColumns as $col => $alias) {
101 101
                 $query->columns("{$throughName}.{$col} AS {$alias}");
102 102
             }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
     protected function addActionOnDelete(BaseAction $action)
179 179
     {
180
-        $nativeEntity       = $action->getEntity();
180
+        $nativeEntity = $action->getEntity();
181 181
 
182 182
         // retrieve them again from the DB since the related collection might not have everything
183 183
         // for example due to a relation query callback
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 
193 193
     protected function addActionOnSave(BaseAction $action)
194 194
     {
195
-        if (! $this->relationWasChanged($action->getEntity())) {
195
+        if (!$this->relationWasChanged($action->getEntity())) {
196 196
             return;
197 197
         }
198 198
 
199
-        if (! $action->includesRelation($this->name)) {
199
+        if (!$action->includesRelation($this->name)) {
200 200
             return;
201 201
         }
202 202
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
         /** @var Collection $foreignEntities */
206 206
         $foreignEntities = $this->nativeEntityHydrator->get($action->getEntity(), $this->name);
207
-        if (! $foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
207
+        if (!$foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
208 208
             return;
209 209
         }
210 210
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
         // save the entities still in the collection
214 214
         foreach ($foreignEntities as $foreignEntity) {
215
-            if (! empty($foreignEntity->getChanges())) {
215
+            if (!empty($foreignEntity->getChanges())) {
216 216
                 $saveAction = $this->foreignMapper
217 217
                     ->newSaveAction($foreignEntity, [
218 218
                         'relations' => $remainingRelations
Please login to merge, or discard this patch.
src/Relation/ManyToOne.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     public function joinSubselect(Query $query, string $reference)
49 49
     {
50 50
         $subselect = $query->subSelectForJoinWith($this->foreignMapper)
51
-                           ->as($reference);
51
+                            ->as($reference);
52 52
 
53 53
         $subselect = $this->applyQueryCallback($subselect);
54 54
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
         parent::applyDefaults();
16 16
 
17 17
         $foreignKey = $this->foreignMapper->getConfig()->getPrimaryKey();
18
-        if (! isset($this->options[RelationConfig::FOREIGN_KEY])) {
18
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
19 19
             $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey;
20 20
         }
21 21
 
22
-        if (! isset($this->options[RelationConfig::NATIVE_KEY])) {
22
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
23 23
             $nativeKey                                 = $this->getKeyColumn($this->name, $foreignKey);
24 24
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
25 25
         }
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
     protected function addActionOnSave(BaseAction $action)
96 96
     {
97
-        if (! $this->relationWasChanged($action->getEntity())) {
97
+        if (!$this->relationWasChanged($action->getEntity())) {
98 98
             return;
99 99
         }
100 100
 
101
-        if (! $action->includesRelation($this->name)) {
101
+        if (!$action->includesRelation($this->name)) {
102 102
             return;
103 103
         }
104 104
 
Please login to merge, or discard this patch.
src/CodeGenerator/EntityBaseGenerator.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         }
57 57
 
58 58
         $constructor = $this->class->addMethod('__construct')
59
-                                   ->setBody('parent::__construct($attributes, $state);');
59
+                                    ->setBody('parent::__construct($attributes, $state);');
60 60
         $constructor->addParameter('attributes')
61 61
                     ->setType('array')
62 62
                     ->setDefaultValue([]);
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Relation/ManyToOneObserver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $name          = $this->relation->getName();
51 51
         $foreignMapper = $mapper->getOrm()->getMapper($this->relation->getForeignMapper());
52 52
         $type          = $foreignMapper->getEntityNamespace()
53
-                         . '\\' . $foreignMapper->getEntityClass();
53
+                            . '\\' . $foreignMapper->getEntityClass();
54 54
 
55 55
         $class->getNamespace()->addUse($type, null, $type);
56 56
 
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
             $setter = $class->addMethod(Str::methodName($name, 'set'));
71 71
             $setter->setVisibility(ClassType::VISIBILITY_PUBLIC);
72 72
             $setter->addParameter('value')
73
-                   ->setType($type)
74
-                   ->setNullable(true);
73
+                    ->setType($type)
74
+                    ->setNullable(true);
75 75
             $setter->addBody('$this->set(\'' . $name . '\', $value);');
76 76
 
77 77
             $getter = $class->addMethod(Str::methodName($name, 'get'));
78 78
             $getter->setVisibility(ClassType::VISIBILITY_PUBLIC);
79 79
             $getter->addBody('return $this->get(\'' . $name . '\');');
80 80
             $getter->setReturnType($type)
81
-                   ->setReturnNullable(true);
81
+                    ->setReturnNullable(true);
82 82
         }
83 83
 
84 84
         return $class;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function with(Relation $relation)
23 23
     {
24
-        $clone         = clone($this);
24
+        $clone = clone($this);
25 25
         $clone->relation = $relation;
26 26
 
27 27
         return $clone;
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/ColumnObserver.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,14 +78,14 @@
 block discarded – undo
78 78
             $setter->setVisibility(ClassType::VISIBILITY_PUBLIC);
79 79
             $setter->addParameter('value')
80 80
                     ->setType($type)
81
-                   ->setNullable($this->attributeIsNullable());
81
+                    ->setNullable($this->attributeIsNullable());
82 82
             $setter->addBody('$this->set(\'' . $name . '\', $value);');
83 83
 
84 84
             $getter = $class->addMethod(Str::methodName($name, 'get'));
85 85
             $getter->setVisibility(ClassType::VISIBILITY_PUBLIC);
86 86
             $getter->addBody('return $this->get(\'' . $name . '\');');
87 87
             $getter->setReturnType($type)
88
-                   ->setReturnNullable($this->attributeIsNullable());
88
+                    ->setReturnNullable($this->attributeIsNullable());
89 89
         }
90 90
 
91 91
         return $class;
Please login to merge, or discard this patch.
src/Blueprint/Relation/OneToOne.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@
 block discarded – undo
14 14
 
15 15
     public function setMapper(Mapper $mapper): Relation
16 16
     {
17
-        if ($mapper && ! $this->foreignKey) {
17
+        if ($mapper && !$this->foreignKey) {
18 18
             $this->foreignKey = Inflector::singularize($mapper->getName()) . '_id';
19 19
         }
20 20
 
21
-        if ($mapper && ! $this->nativeKey) {
21
+        if ($mapper && !$this->nativeKey) {
22 22
             $this->nativeKey = $mapper->getPrimaryKey();
23 23
         }
24 24
 
Please login to merge, or discard this patch.
src/Blueprint/Relation/ManyToOne.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
     public function setForeignMapper($foreignMapper): Relation
17 17
     {
18
-        if ($foreignMapper && ! $this->nativeKey) {
18
+        if ($foreignMapper && !$this->nativeKey) {
19 19
             $this->nativeKey = Inflector::singularize($foreignMapper) . '_id';
20 20
         }
21 21
 
Please login to merge, or discard this patch.
src/Blueprint/Column.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -134,86 +134,86 @@
 block discarded – undo
134 134
     public static function varchar(string $name, $length = 255)
135 135
     {
136 136
         return static::make($name)
137
-                     ->setType(static::TYPE_VARCHAR)
138
-                     ->setLength($length);
137
+                        ->setType(static::TYPE_VARCHAR)
138
+                        ->setLength($length);
139 139
     }
140 140
 
141 141
     public static function bool(string $name)
142 142
     {
143 143
         return static::make($name)
144
-                     ->setType(static::TYPE_BOOLEAN);
144
+                        ->setType(static::TYPE_BOOLEAN);
145 145
     }
146 146
 
147 147
     public static function string(string $name)
148 148
     {
149 149
         return static::make($name)
150
-                     ->setType(static::TYPE_TEXT);
150
+                        ->setType(static::TYPE_TEXT);
151 151
     }
152 152
 
153 153
     public static function datetime(string $name)
154 154
     {
155 155
         return static::make($name)
156
-                     ->setType(static::TYPE_DATETIME);
156
+                        ->setType(static::TYPE_DATETIME);
157 157
     }
158 158
 
159 159
     public static function date(string $name)
160 160
     {
161 161
         return static::make($name)
162
-                     ->setType(static::TYPE_DATE);
162
+                        ->setType(static::TYPE_DATE);
163 163
     }
164 164
 
165 165
     public static function timestamp(string $name)
166 166
     {
167 167
         return static::make($name)
168
-                     ->setType(static::TYPE_TIMESTAMP);
168
+                        ->setType(static::TYPE_TIMESTAMP);
169 169
     }
170 170
 
171 171
     public static function json(string $name)
172 172
     {
173 173
         return static::make($name)
174
-                     ->setType(static::TYPE_JSON);
174
+                        ->setType(static::TYPE_JSON);
175 175
     }
176 176
 
177 177
     public static function float(string $name)
178 178
     {
179 179
         return static::make($name)
180
-                     ->setType(static::TYPE_FLOAT);
180
+                        ->setType(static::TYPE_FLOAT);
181 181
     }
182 182
 
183 183
     public static function integer(string $name, $unsigned = false)
184 184
     {
185 185
         return static::make($name)
186
-                     ->setType(static::TYPE_INTEGER)
187
-                     ->setUnsigned($unsigned);
186
+                        ->setType(static::TYPE_INTEGER)
187
+                        ->setUnsigned($unsigned);
188 188
     }
189 189
 
190 190
     public static function tinyInteger(string $name, $unsigned = false)
191 191
     {
192 192
         return static::make($name)
193
-                     ->setType(static::TYPE_TINY_INTEGER)
194
-                     ->setUnsigned($unsigned);
193
+                        ->setType(static::TYPE_TINY_INTEGER)
194
+                        ->setUnsigned($unsigned);
195 195
     }
196 196
 
197 197
     public static function smallInteger(string $name, $unsigned = false)
198 198
     {
199 199
         return static::make($name)
200
-                     ->setType(static::TYPE_SMALL_INTEGER)
201
-                     ->setUnsigned($unsigned);
200
+                        ->setType(static::TYPE_SMALL_INTEGER)
201
+                        ->setUnsigned($unsigned);
202 202
     }
203 203
 
204 204
     public static function bigInteger(string $name, $unsigned = false)
205 205
     {
206 206
         return static::make($name)
207
-                     ->setType(static::TYPE_BIG_INTEGER)
208
-                     ->setUnsigned($unsigned);
207
+                        ->setType(static::TYPE_BIG_INTEGER)
208
+                        ->setUnsigned($unsigned);
209 209
     }
210 210
 
211 211
     public static function decimal(string $name, int $digits, int $precision)
212 212
     {
213 213
         return static::make($name)
214
-                     ->setType(static::TYPE_DECIMAL)
215
-                     ->setDigits($digits)
216
-                     ->setPrecision($precision);
214
+                        ->setType(static::TYPE_DECIMAL)
215
+                        ->setDigits($digits)
216
+                        ->setPrecision($precision);
217 217
     }
218 218
 
219 219
     public function getErrors(): array
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -220,11 +220,11 @@
 block discarded – undo
220 220
     {
221 221
         $errors = [];
222 222
 
223
-        if (! $this->name) {
223
+        if (!$this->name) {
224 224
             $errors[] = 'Column requires a name';
225 225
         }
226 226
 
227
-        if (! $this->type) {
227
+        if (!$this->type) {
228 228
             $errors[] = 'Column requires a type';
229 229
         } elseif (($type = $this->getConstantByValue($this->type)) && substr($type, 0, 5) !== 'TYPE_') {
230 230
             $errors[] = sprintf('Column does not have a valid type (%s)', $this->type);
Please login to merge, or discard this patch.
src/Blueprint/Behaviour/SoftDelete.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 
69 69
         if ($this->deletedAtColumn && ! array_key_exists($this->deletedAtColumn, $columns)) {
70 70
             $mapper->addColumn(Column::datetime($this->deletedAtColumn)
71
-                                     ->setNullable(true));
71
+                                        ->setNullable(true));
72 72
         }
73 73
 
74 74
         return $this;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
 
67 67
         $columns = $mapper->getColumns();
68 68
 
69
-        if ($this->deletedAtColumn && ! array_key_exists($this->deletedAtColumn, $columns)) {
69
+        if ($this->deletedAtColumn && !array_key_exists($this->deletedAtColumn, $columns)) {
70 70
             $mapper->addColumn(Column::datetime($this->deletedAtColumn)
71 71
                                      ->setNullable(true));
72 72
         }
Please login to merge, or discard this patch.