Passed
Push — master ( e0a427...e39392 )
by Adrian
01:41
created
src/QueryBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
     public static function getInstance()
18 18
     {
19
-        if (! static::$instance) {
19
+        if (!static::$instance) {
20 20
             static::$instance = new static;
21 21
         }
22 22
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function getQueryClass(Mapper $mapper)
34 34
     {
35 35
         $mapperClass = get_class($mapper);
36
-        if (! isset($this->queryClasses[$mapperClass])) {
36
+        if (!isset($this->queryClasses[$mapperClass])) {
37 37
             $queryClass = $mapperClass . 'Query';
38 38
             if (class_exists($queryClass)) {
39 39
                 $this->queryClasses[$mapperClass] = $queryClass;
Please login to merge, or discard this patch.
src/Entity/GenericEntity.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         }
99 99
 
100 100
         $value = $this->castAttribute($attribute, $value);
101
-        if (! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) {
101
+        if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) {
102 102
             $this->changed[$attribute] = true;
103 103
             $this->state               = StateEnum::CHANGED;
104 104
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     public function get($attribute)
111 111
     {
112
-        if (! $attribute) {
112
+        if (!$attribute) {
113 113
             return null;
114 114
         }
115 115
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
     public function getPersistenceState()
122 122
     {
123
-        if (! empty($this->changed)) {
123
+        if (!empty($this->changed)) {
124 124
         }
125 125
 
126 126
         return $this->state;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $changes = $this->changed;
151 151
         foreach ($this->attributes as $name => $value) {
152 152
             if (is_object($value) && method_exists($value, 'getChanges')) {
153
-                if (! empty($value->getChanges())) {
153
+                if (!empty($value->getChanges())) {
154 154
                     $changes[$name] = true;
155 155
                 }
156 156
             }
Please login to merge, or discard this patch.
src/Relation/OneToMany.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
     protected function applyDefaults(): void
15 15
     {
16 16
         $nativeKey = $this->nativeMapper->getPrimaryKey();
17
-        if (! isset($this->options[RelationConfig::NATIVE_KEY])) {
17
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
18 18
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
19 19
         }
20 20
 
21
-        if (! isset($this->options[RelationConfig::FOREIGN_KEY])) {
21
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
22 22
             $prefix                                     = Inflector::singularize($this->nativeMapper->getTable());
23 23
             $this->options[RelationConfig::FOREIGN_KEY] = $this->getKeyColumn($prefix, $nativeKey);
24 24
         }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     public function attachEntities(EntityInterface $nativeEntity, EntityInterface $foreignEntity)
70 70
     {
71 71
         foreach ($this->keyPairs as $nativeCol => $foreignCol) {
72
-            $nativeKeyValue  = $this->nativeMapper->getEntityAttribute($nativeEntity, $nativeCol);
72
+            $nativeKeyValue = $this->nativeMapper->getEntityAttribute($nativeEntity, $nativeCol);
73 73
             $this->foreignMapper->setEntityAttribute($foreignEntity, $foreignCol, $nativeKeyValue);
74 74
         }
75 75
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $remainingRelations = $this->getRemainingRelations($action->getOption('relations'));
92 92
 
93 93
         // no cascade delete? treat as save so we can process the changes
94
-        if (! $this->isCascade()) {
94
+        if (!$this->isCascade()) {
95 95
             $this->addActionOnSave($action);
96 96
         } else {
97 97
             // retrieve them again from the DB since the related collection might not have everything
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
         // save the entities still in the collection
125 125
         foreach ($foreignEntities as $foreignEntity) {
126
-            if (! empty($foreignEntity->getChanges())) {
126
+            if (!empty($foreignEntity->getChanges())) {
127 127
                 $saveAction = $this->foreignMapper
128 128
                     ->newSaveAction($foreignEntity, ['relations' => $remainingRelations]);
129 129
                 $saveAction->addColumns($this->getExtraColumnsForAction());
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@
 block discarded – undo
47 47
     {
48 48
         $tableRef = $this->foreignMapper->getTableAlias(true);
49 49
         $subselect = $query->subSelectForJoinWith()
50
-                           ->columns($this->foreignMapper->getTable() . '.*')
51
-                           ->from($this->foreignMapper->getTable())
52
-                           ->as($reference);
50
+                            ->columns($this->foreignMapper->getTable() . '.*')
51
+                            ->from($this->foreignMapper->getTable())
52
+                            ->as($reference);
53 53
 
54 54
         $subselect = $this->applyQueryCallback($subselect);
55 55
 
Please login to merge, or discard this patch.
src/Action/Update.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 
58 58
     public function revert()
59 59
     {
60
-        if (! $this->hasRun) {
60
+        if (!$this->hasRun) {
61 61
             return;
62 62
         }
63 63
         $this->entity->setPersistenceState($this->entityState);
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@
 block discarded – undo
55 55
         if (count($columns) > 0) {
56 56
             $updateSql = new \Sirius\Sql\Update($connection);
57 57
             $updateSql->table($this->mapper->getTable())
58
-                      ->columns($columns)
59
-                      ->whereAll($conditions, false);
58
+                        ->columns($columns)
59
+                        ->whereAll($conditions, false);
60 60
             $updateSql->perform();
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
src/Helpers/QueryHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 {
8 8
     public static function reference($table, $tableAlias)
9 9
     {
10
-        if (! $tableAlias || $table == $tableAlias) {
10
+        if (!$tableAlias || $table == $tableAlias) {
11 11
             return $table;
12 12
         }
13 13
 
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
     public static function joinCondition($firsTable, $firstColumns, $secondTable, $secondColumns)
18 18
     {
19
-        $firstColumns = (array) $firstColumns;
20
-        $secondColumns = (array) $secondColumns;
19
+        $firstColumns = (array)$firstColumns;
20
+        $secondColumns = (array)$secondColumns;
21 21
 
22 22
         $parts = [];
23 23
         foreach ($firstColumns as $k => $col) {
Please login to merge, or discard this patch.
src/Query.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 
85 85
     public function joinWith($name): Query
86 86
     {
87
-        if (! $this->mapper->hasRelation($name)) {
87
+        if (!$this->mapper->hasRelation($name)) {
88 88
             throw new \InvalidArgumentException(
89 89
                 sprintf("Relation %s, not defined for %s", $name, $this->mapper->getTable())
90 90
             );
Please login to merge, or discard this patch.
src/CastingManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     public function bool($value)
68 68
     {
69
-        return ! ! $value;
69
+        return !!$value;
70 70
     }
71 71
 
72 72
     // phpcs:ignore
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     public function float($value)
84 84
     {
85
-        return $value === null ? null : (float) $value;
85
+        return $value === null ? null : (float)$value;
86 86
     }
87 87
 
88 88
     public function decimal($value, $digits)
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function json($value)
94 94
     {
95
-        if (! $value) {
95
+        if (!$value) {
96 96
             return new \ArrayObject();
97 97
         }
98 98
         if (is_array($value)) {
Please login to merge, or discard this patch.
src/Relation/ManyToMany.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             ->newQuery();
58 58
 
59 59
         $query = $this->joinWithThroughTable($query)
60
-                      ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
60
+                        ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
61 61
 
62 62
         $query = $this->applyQueryCallback($query);
63 63
 
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $tableRef  = $this->foreignMapper->getTableAlias(true);
112 112
         $subselect = $query->subSelectForJoinWith()
113
-                           ->from($this->foreignMapper->getTable())
114
-                           ->columns($this->foreignMapper->getTable() . '.*')
115
-                           ->as($reference);
113
+                            ->from($this->foreignMapper->getTable())
114
+                            ->columns($this->foreignMapper->getTable() . '.*')
115
+                            ->as($reference);
116 116
 
117 117
         $subselect = $this->joinWithThroughTable($subselect);
118 118
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,28 +23,28 @@  discard block
 block discarded – undo
23 23
         $this->setOptionIfMissing(RelationConfig::THROUGH_COLUMNS_PREFIX, 'pivot_');
24 24
 
25 25
         $foreignKey = $this->foreignMapper->getPrimaryKey();
26
-        if (! isset($this->options[RelationConfig::FOREIGN_KEY])) {
26
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
27 27
             $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey;
28 28
         }
29 29
 
30 30
         $nativeKey = $this->foreignMapper->getPrimaryKey();
31
-        if (! isset($this->options[RelationConfig::NATIVE_KEY])) {
31
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
32 32
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
33 33
         }
34 34
 
35
-        if (! isset($this->options[RelationConfig::THROUGH_TABLE])) {
35
+        if (!isset($this->options[RelationConfig::THROUGH_TABLE])) {
36 36
             $tables = [$this->foreignMapper->getTable(), $this->nativeMapper->getTable()];
37 37
             sort($tables);
38 38
             $this->options[RelationConfig::THROUGH_TABLE] = implode('_', $tables);
39 39
         }
40 40
 
41
-        if (! isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
41
+        if (!isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
42 42
             $prefix = Inflector::singularize($this->nativeMapper->getTableAlias(true));
43 43
 
44 44
             $this->options[RelationConfig::THROUGH_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey);
45 45
         }
46 46
 
47
-        if (! isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
47
+        if (!isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
48 48
             $prefix = Inflector::singularize($this->foreignMapper->getTableAlias(true));
49 49
 
50 50
             $this->options[RelationConfig::THROUGH_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS);
96 96
         $throughName  = $throughAlias ?? $through;
97 97
 
98
-        if (! empty($throughColumns)) {
98
+        if (!empty($throughColumns)) {
99 99
             $prefix = $this->getOption(RelationConfig::THROUGH_COLUMNS_PREFIX);
100 100
             foreach ($throughColumns as $col) {
101 101
                 $query->columns("{$throughName}.{$col} AS {$prefix}{$col}");
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             /** @var Collection $collection */
151 151
             $collection = $this->nativeMapper->getEntityAttribute($nativeEntity, $this->name);
152 152
             foreach ($found as $foreignEntity) {
153
-                if (! $collection->contains($foreignEntity)) {
153
+                if (!$collection->contains($foreignEntity)) {
154 154
                     $collection->add($foreignEntity);
155 155
                 }
156 156
             }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $remainingRelations = $this->getRemainingRelations($action->getOption('relations'));
199 199
 
200 200
         // no cascade delete? treat as save so we can process the changes
201
-        if (! $this->isCascade()) {
201
+        if (!$this->isCascade()) {
202 202
             $this->addActionOnSave($action);
203 203
         } else {
204 204
             // retrieve them again from the DB since the related collection might not have everything
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
         /** @var Collection $foreignEntities */
224 224
         $foreignEntities = $this->nativeMapper->getEntityAttribute($action->getEntity(), $this->name);
225
-        if (! $foreignEntities) {
225
+        if (!$foreignEntities) {
226 226
             return;
227 227
         }
228 228
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         // save the entities still in the collection
232 232
         foreach ($foreignEntities as $foreignEntity) {
233
-            if (! empty($foreignEntity->getChanges())) {
233
+            if (!empty($foreignEntity->getChanges())) {
234 234
                 $saveAction = $this->foreignMapper
235 235
                     ->newSaveAction($foreignEntity, [
236 236
                         'relations' => $remainingRelations
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
@@ -22,14 +22,14 @@
 block discarded – undo
22 22
     {
23 23
         $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER];
24 24
         if ($this->orm->has($foreignMapper)) {
25
-            if (! $foreignMapper instanceof Mapper) {
25
+            if (!$foreignMapper instanceof Mapper) {
26 26
                 $foreignMapper = $this->orm->get($foreignMapper);
27 27
             }
28 28
         }
29 29
         $type          = $options[RelationConfig::TYPE];
30 30
         $relationClass = __NAMESPACE__ . '\\' . Str::className($type);
31 31
 
32
-        if (! class_exists($relationClass)) {
32
+        if (!class_exists($relationClass)) {
33 33
             throw new \InvalidArgumentException("{$relationClass} does not exist");
34 34
         }
35 35
 
Please login to merge, or discard this patch.