@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
73 | - return ! ! $value; |
|
73 | + return !!$value; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // phpcs:ignore |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | return $value; |
103 | 103 | } |
104 | 104 | |
105 | - return json_decode((string) $value, true); |
|
105 | + return json_decode((string)$value, true); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | public function json($value) |
109 | 109 | { |
110 | - if ( ! $value) { |
|
110 | + if (!$value) { |
|
111 | 111 | return new \ArrayObject(); |
112 | 112 | } |
113 | 113 | if (is_array($value)) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // phpcs:ignore |
126 | 126 | public function json_for_db($value) |
127 | 127 | { |
128 | - if ( ! $value) { |
|
128 | + if (!$value) { |
|
129 | 129 | return null; |
130 | 130 | } |
131 | 131 | if (is_array($value)) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function add($element) |
68 | 68 | { |
69 | 69 | $element = $this->ensureHydratedElement($element); |
70 | - if ( ! $this->contains($element)) { |
|
70 | + if (!$this->contains($element)) { |
|
71 | 71 | $this->change('added', $element); |
72 | 72 | |
73 | 73 | return parent::add($element); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function removeElement($element) |
90 | 90 | { |
91 | 91 | $element = $this->ensureHydratedElement($element); |
92 | - if ( ! $this->contains($element)) { |
|
92 | + if (!$this->contains($element)) { |
|
93 | 93 | return true; |
94 | 94 | } |
95 | 95 | $removed = parent::removeElement($this->findByPk($this->hydrator->getPk($element))); |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | |
114 | 114 | public function pluck($names) |
115 | 115 | { |
116 | - return $this->map(function ($item) use ($names) { |
|
117 | - if ( ! is_array($names)) { |
|
116 | + return $this->map(function($item) use ($names) { |
|
117 | + if (!is_array($names)) { |
|
118 | 118 | return $this->hydrator->get($item, $names); |
119 | 119 | } |
120 | 120 |
@@ -60,9 +60,9 @@ |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | $value = $this->castAttribute($attribute, $value); |
63 | - if ( ! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
63 | + if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
64 | 64 | $this->markChanged($attribute); |
65 | - $this->state = StateEnum::CHANGED; |
|
65 | + $this->state = StateEnum::CHANGED; |
|
66 | 66 | } |
67 | 67 | $this->attributes[$attribute] = $value; |
68 | 68 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | $value = $this->castAttribute($attribute, $value); |
43 | - if ( ! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
43 | + if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
44 | 44 | $this->markChanged($attribute); |
45 | 45 | $this->state = StateEnum::CHANGED; |
46 | 46 | } |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $setter = $class->addMethod(Str::methodName($name . ' Attribute', 'set')); |
58 | 58 | $setter->setVisibility(ClassType::VISIBILITY_PROTECTED); |
59 | 59 | $setter->addParameter('value') |
60 | - ->setNullable($this->property->getNullable()) |
|
61 | - ->setType($alias); |
|
60 | + ->setNullable($this->property->getNullable()) |
|
61 | + ->setType($alias); |
|
62 | 62 | $setter->setBody($body); |
63 | 63 | $setter->setComment($this->property->getSetterComment()); |
64 | 64 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $setter = $class->addMethod(Str::methodName($name, 'set')); |
77 | 77 | $setter->setVisibility(ClassType::VISIBILITY_PUBLIC); |
78 | 78 | $setter->addParameter('value') |
79 | - ->setType($type) |
|
80 | - ->setNullable($this->property->getNullable()); |
|
79 | + ->setType($type) |
|
80 | + ->setNullable($this->property->getNullable()); |
|
81 | 81 | $setter->setBody($body); |
82 | 82 | $setter->setComment($this->property->getSetterComment()); |
83 | 83 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $name = $this->relation->getName(); |
55 | 55 | $foreignMapper = $mapper->getOrm()->getMapper($this->relation->getForeignMapper()); |
56 | 56 | $type = $foreignMapper->getEntityNamespace() |
57 | - . '\\' . $foreignMapper->getEntityClass(); |
|
57 | + . '\\' . $foreignMapper->getEntityClass(); |
|
58 | 58 | |
59 | 59 | $class->getNamespace()->addUse(Collection::class); |
60 | 60 | $class->getNamespace()->addUse($type, null, $type); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $setter = $class->addMethod(Str::methodName($name, 'set')); |
66 | 66 | $setter->setVisibility(ClassType::VISIBILITY_PUBLIC); |
67 | 67 | $setter->addParameter('value') |
68 | - ->setType('Collection'); |
|
68 | + ->setType('Collection'); |
|
69 | 69 | $setter->setBody('$this->set(\'' . $name . '\', $value);'); |
70 | 70 | |
71 | 71 | $getter = $class->addMethod(Str::methodName($name, 'get')); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $adder = $class->addMethod(Str::methodName($singular, 'add')); |
80 | 80 | $adder->setVisibility(ClassType::VISIBILITY_PUBLIC); |
81 | 81 | $adder->addParameter($singular) |
82 | - ->setType($type); |
|
82 | + ->setType($type); |
|
83 | 83 | $adder->setBody(sprintf('$this->get(\'%s\')->add($%s);', $name, $singular)); |
84 | 84 | |
85 | 85 | $class = $this->addAggregates($class); |
@@ -104,7 +104,7 @@ |
||
104 | 104 | |
105 | 105 | private function addAggregates(ClassType $class) |
106 | 106 | { |
107 | - $mapper = $this->relation->getMapper(); |
|
107 | + $mapper = $this->relation->getMapper(); |
|
108 | 108 | $aggregates = $this->relation->getAggregates(); |
109 | 109 | |
110 | 110 | foreach ($aggregates as $name => $aggregate) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | $this->relations[$name] = $relation; |
65 | 65 | $this->relationCallback[$name] = $callback; |
66 | - if ( ! empty($nextLoad)) { |
|
66 | + if (!empty($nextLoad)) { |
|
67 | 67 | $this->relationNextLoad[$name] = $nextLoad; |
68 | 68 | } |
69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public function getResultsForRelation($name) |
77 | 77 | { |
78 | - if ( ! isset($this->relations[$name])) { |
|
78 | + if (!isset($this->relations[$name])) { |
|
79 | 79 | return []; |
80 | 80 | } |
81 | 81 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $result = []; |
113 | 113 | foreach ($this->rows as $row) { |
114 | 114 | $value = $this->getColumnsFromRow($row, $columns, $hydrator); |
115 | - if ($value && ! in_array($value, $result)) { |
|
115 | + if ($value && !in_array($value, $result)) { |
|
116 | 116 | $result[] = $value; |
117 | 117 | } |
118 | 118 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function getLazyAggregate(Aggregate $aggregate) |
144 | 144 | { |
145 | 145 | $name = $aggregate->getName(); |
146 | - if ( ! isset($this->lazyAggregates[$name])) { |
|
146 | + if (!isset($this->lazyAggregates[$name])) { |
|
147 | 147 | $this->lazyAggregates[$name] = new LazyAggregate($this, $aggregate); |
148 | 148 | } |
149 | 149 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function getLazyRelation(Relation $relation) |
154 | 154 | { |
155 | 155 | $name = $relation->getOption('name'); |
156 | - if ( ! isset($this->lazyRelations[$name])) { |
|
156 | + if (!isset($this->lazyRelations[$name])) { |
|
157 | 157 | $this->lazyRelations[$name] = new LazyRelation($this, $relation); |
158 | 158 | } |
159 | 159 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | $queryNextLoad = $this->relationNextLoad[$name] ?? []; |
192 | - if ($queryNextLoad && ! empty($queryNextLoad)) { |
|
192 | + if ($queryNextLoad && !empty($queryNextLoad)) { |
|
193 | 193 | foreach ($queryNextLoad as $next => $callback) { |
194 | 194 | $query = $query->load([$next => $callback]); |
195 | 195 | } |
@@ -135,11 +135,11 @@ |
||
135 | 135 | $relation = $this->mapper->getRelation($name); |
136 | 136 | if ($relation instanceof ToOneInterface && |
137 | 137 | isset($attributes[$name]) && |
138 | - ! is_object($attributes[$name])) { |
|
138 | + !is_object($attributes[$name])) { |
|
139 | 139 | $attributes[$name] = $relation->getForeignMapper()->newEntity($attributes[$name]); |
140 | 140 | } elseif ($relation instanceof ToManyInterface && |
141 | - ! $relation instanceof ToOneInterface |
|
142 | - && ( ! isset($attributes[$name]) || is_array($attributes[$name]))) { |
|
141 | + !$relation instanceof ToOneInterface |
|
142 | + && (!isset($attributes[$name]) || is_array($attributes[$name]))) { |
|
143 | 143 | /** |
144 | 144 | * we also need to check against ToOneInterface because OneToOne relation extends |
145 | 145 | * OneToMany which implements ToOneInterface |