Passed
Push — dev_2x ( 3e8772...896177 )
by Adrian
06:45
created
src/MapperConfig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function getTableAlias($fallbackToTable = false)
132 132
     {
133
-        return (! $this->tableAlias && $fallbackToTable) ? $this->table : $this->tableAlias;
133
+        return (!$this->tableAlias && $fallbackToTable) ? $this->table : $this->tableAlias;
134 134
     }
135 135
 
136 136
     public function getColumns(): array
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
     public function getTableReference()
179 179
     {
180
-        if (! $this->tableReference) {
180
+        if (!$this->tableReference) {
181 181
             $this->tableReference = QueryHelper::reference($this->table, $this->tableAlias);
182 182
         }
183 183
 
Please login to merge, or discard this patch.
src/Helpers/Str.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     public static function underscore(string $str): string
17 17
     {
18
-        if (! isset(static::$cache['underscore'][$str])) {
18
+        if (!isset(static::$cache['underscore'][$str])) {
19 19
             $str = preg_replace("/([A-Z]+)/", ' $1', $str);
20 20
             $str = strtolower($str);
21 21
             $str = preg_replace("/[^a-z0-9]+/", ' ', $str);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public static function methodName(string $str, string $verb): string
30 30
     {
31 31
         $key = $verb . $str;
32
-        if (! isset(static::$cache['methodName'][$key])) {
32
+        if (!isset(static::$cache['methodName'][$key])) {
33 33
             static::$cache['methodName'][$key] = strtolower($verb) . static::className($str);
34 34
         }
35 35
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     public static function variableName(string $str): string
40 40
     {
41
-        if (! isset(static::$cache['variableName'][$str])) {
41
+        if (!isset(static::$cache['variableName'][$str])) {
42 42
             $class = static::className($str);
43 43
 
44 44
             static::$cache['variableName'][$str] = strtolower(substr($class, 0, 1)) . substr($class, 1);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public static function className(string $str): string
51 51
     {
52
-        if (! isset(static::$cache['className'][$str])) {
52
+        if (!isset(static::$cache['className'][$str])) {
53 53
             $str = strtolower($str);
54 54
             $str = preg_replace("/[^a-z0-9]+/", ' ', $str);
55 55
             $str = ucwords($str);
Please login to merge, or discard this patch.
src/Relation/OneToOne.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 
27 27
     protected function addActionOnDelete(BaseAction $action)
28 28
     {
29
-        $relations          = $action->getOption('relations');
29
+        $relations = $action->getOption('relations');
30 30
 
31 31
         // no cascade delete? treat it as a save
32
-        if (! $this->isCascade()) {
32
+        if (!$this->isCascade()) {
33 33
             $this->addActionOnSave($action);
34 34
         } elseif ($relations === true || in_array($this->name, (array)$relations)) {
35 35
             $nativeEntity       = $action->getEntity();
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
                                     ->first();
42 42
 
43 43
             if ($foreignEntity) {
44
-                $deleteAction       = $this->foreignMapper
44
+                $deleteAction = $this->foreignMapper
45 45
                     ->newDeleteAction($foreignEntity, ['relations' => $remainingRelations]);
46 46
                 $action->prepend($deleteAction);
47 47
                 $action->append($this->newSyncAction($action->getEntity(), $foreignEntity, 'delete'));
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
     protected function addActionOnSave(BaseAction $action)
63 63
     {
64
-        if (! $this->relationWasChanged($action->getEntity())) {
64
+        if (!$this->relationWasChanged($action->getEntity())) {
65 65
             return;
66 66
         }
67 67
 
68
-        if (! $action->includesRelation($this->name)) {
68
+        if (!$action->includesRelation($this->name)) {
69 69
             return;
70 70
         }
71 71
 
Please login to merge, or discard this patch.
src/Relation/Relation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     protected function setOptionIfMissing($name, $value)
78 78
     {
79
-        if (! isset($this->options[$name])) {
79
+        if (!isset($this->options[$name])) {
80 80
             $this->options[$name] = $value;
81 81
         }
82 82
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
     protected function getKeyColumn($name, $column)
117 117
     {
118
-        if (! is_array($column)) {
118
+        if (!is_array($column)) {
119 119
             return $name . '_' . $column;
120 120
         }
121 121
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         foreach ($entities as $entity) {
178 178
             $entityId = $this->getEntityId($this->foreignMapper, $entity, array_values($this->keyPairs));
179
-            if (! isset($result[$entityId])) {
179
+            if (!isset($result[$entityId])) {
180 180
                 $result[$entityId] = [];
181 181
             }
182 182
             $result[$entityId][] = $entity;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     protected function getRemainingRelations($relations)
225 225
     {
226
-        if (! is_array($relations)) {
226
+        if (!is_array($relations)) {
227 227
             return $relations;
228 228
         }
229 229
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         if (is_array($guards)) {
245 245
             foreach ($guards as $col => $val) {
246 246
                 // guards that are strings (eg: 'deleted_at is null') can't be used as extra columns
247
-                if (! is_int($col)) {
247
+                if (!is_int($col)) {
248 248
                     $cols[$col] = $val;
249 249
                 }
250 250
             }
Please login to merge, or discard this patch.
src/Relation/HasAggregates.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
         $aggregates     = [];
17 17
         $aggregatesList = $this->getOption(RelationConfig::AGGREGATES);
18
-        if (! is_array($aggregatesList) || empty($aggregatesList)) {
18
+        if (!is_array($aggregatesList) || empty($aggregatesList)) {
19 19
             $this->aggregates = $aggregates;
20 20
 
21 21
             return;
Please login to merge, or discard this patch.
src/Query.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             return $this;
139 139
         }
140 140
 
141
-        if (! $this->mapper->hasRelation($name)) {
141
+        if (!$this->mapper->hasRelation($name)) {
142 142
             throw new \InvalidArgumentException(
143 143
                 sprintf("Relation %s, not defined for %s", $name, $this->mapper->getConfig()->getTable())
144 144
             );
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
             return null;
201 201
         }
202 202
 
203
-        $receivedTracker = ! ! $tracker;
204
-        if (! $tracker) {
203
+        $receivedTracker = !!$tracker;
204
+        if (!$tracker) {
205 205
             $receivedTracker = false;
206 206
             $tracker         = new Tracker([$data]);
207 207
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $this->injectAggregates($entity, $tracker, $load);
212 212
         $entity->setState(StateEnum::SYNCHRONIZED);
213 213
 
214
-        if (! $receivedTracker) {
214
+        if (!$receivedTracker) {
215 215
             $tracker->replaceRows([$entity]);
216 216
         }
217 217
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             $queryCallback = $eagerLoad[$name] ?? null;
263 263
             $nextLoad      = Arr::getChildren($eagerLoad, $name);
264 264
 
265
-            if (! $tracker->hasRelation($name)) {
265
+            if (!$tracker->hasRelation($name)) {
266 266
                 $tracker->setRelation($name, $relation, $queryCallback, $nextLoad);
267 267
             }
268 268
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     {
279 279
         foreach ($this->mapper->getRelations() as $name) {
280 280
             $relation = $this->mapper->getRelation($name);
281
-            if (! method_exists($relation, 'getAggregates')) {
281
+            if (!method_exists($relation, 'getAggregates')) {
282 282
                 continue;
283 283
             }
284 284
             $aggregates = $relation->getAggregates();
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      */
308 308
     public function chunk(int $size, callable $callback, int $limit = 100000)
309 309
     {
310
-        if (! $this->orderBy->build()) {
310
+        if (!$this->orderBy->build()) {
311 311
             $this->orderBy(...(array)$this->mapper->getConfig()->getPrimaryKey());
312 312
         }
313 313
 
Please login to merge, or discard this patch.
src/Action/AttachEntities.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@
 block discarded – undo
115 115
 
116 116
         $insert = new \Sirius\Sql\Insert($conn);
117 117
         $insert->into($pivotTable)
118
-               ->columns($insertColumns)
119
-               ->perform();
118
+                ->columns($insertColumns)
119
+                ->perform();
120 120
     }
121 121
 
122 122
     protected function getNativeEntityHydrator()
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     protected function maybeUpdatePivotRow()
70 70
     {
71
-        if (! $this->relation instanceof ManyToMany) {
71
+        if (!$this->relation instanceof ManyToMany) {
72 72
             return;
73 73
         }
74 74
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $delete->where($pivotForeignColumns[$k], $foreignKey[$k]);
89 89
         }
90 90
         foreach ((array)$this->relation->getOption(RelationConfig::PIVOT_GUARDS) as $col => $value) {
91
-            if (! is_int($col)) {
91
+            if (!is_int($col)) {
92 92
                 $delete->where($col, $value);
93 93
             } else {
94 94
                 $delete->where($value);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         foreach ((array)$this->relation->getOption(RelationConfig::PIVOT_GUARDS) as $col => $value) {
111
-            if (! is_int($col)) {
111
+            if (!is_int($col)) {
112 112
                 $insertColumns[$col] = $value;
113 113
             }
114 114
         }
Please login to merge, or discard this patch.
src/Action/DeletePivotRows.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $conditions = [];
76 76
 
77
-        $nativeEntityPk    = (array)$this->nativeMapper->getConfig()->getPrimaryKey();
77
+        $nativeEntityPk = (array)$this->nativeMapper->getConfig()->getPrimaryKey();
78 78
         $pivotThroughCols = (array)$this->relation->getOption(RelationConfig::PIVOT_NATIVE_COLUMN);
79 79
         foreach ($nativeEntityPk as $idx => $col) {
80 80
             $val = $this->nativeEntityHydrator->get($this->nativeEntity, $col);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             }
84 84
         }
85 85
 
86
-        $entityPk    = (array)$this->mapper->getConfig()->getPrimaryKey();
86
+        $entityPk = (array)$this->mapper->getConfig()->getPrimaryKey();
87 87
         $pivotColumns = (array)$this->relation->getOption(RelationConfig::PIVOT_FOREIGN_COLUMN);
88 88
         foreach ($entityPk as $idx => $col) {
89 89
             $val = $this->entityHydrator->get($this->entity, $col);
Please login to merge, or discard this patch.
src/Relation/RelationBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
     {
14 14
         $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER];
15 15
         if ($orm->has($foreignMapper)) {
16
-            if (! $foreignMapper instanceof Mapper) {
16
+            if (!$foreignMapper instanceof Mapper) {
17 17
                 $foreignMapper = $orm->get($foreignMapper);
18 18
             }
19 19
         }
20 20
         $type          = $options[RelationConfig::TYPE];
21 21
         $relationClass = 'Sirius\\Orm\\Relation\\' . Str::className($type);
22 22
 
23
-        if (! class_exists($relationClass)) {
23
+        if (!class_exists($relationClass)) {
24 24
             throw new InvalidArgumentException("{$relationClass} does not exist");
25 25
         }
26 26
 
Please login to merge, or discard this patch.