@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $before = \substr($query, 0, $analyzed->getReturn()); |
| 74 | 74 | $after = \substr($query, $analyzed->getReturn() + \max(0, $haystack - 1)); |
| 75 | 75 | |
| 76 | - $this->wrapper = $before . '%s' . $after; |
|
| 76 | + $this->wrapper = $before.'%s'.$after; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - return (int)$offset; |
|
| 120 | + return (int) $offset; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -75,25 +75,25 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | switch ($typeOf) { |
| 77 | 77 | case 'callable': |
| 78 | - return function (callable $applicator = null) use ($result) { |
|
| 78 | + return function(callable $applicator = null) use ($result) { |
|
| 79 | 79 | return ($applicator ?? '\\value')($result); |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | 82 | case 'object': |
| 83 | - return (object)$result; |
|
| 83 | + return (object) $result; |
|
| 84 | 84 | |
| 85 | 85 | case 'array': |
| 86 | 86 | case 'iterable': |
| 87 | - return (array)$result; |
|
| 87 | + return (array) $result; |
|
| 88 | 88 | |
| 89 | 89 | case 'string': |
| 90 | - return (string)$result; |
|
| 90 | + return (string) $result; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $function = $typeOf . 'val'; |
|
| 93 | + $function = $typeOf.'val'; |
|
| 94 | 94 | |
| 95 | - if (! \function_exists($function)) { |
|
| 96 | - throw new \InvalidArgumentException('Could not cast to type ' . $typeOf); |
|
| 95 | + if (!\function_exists($function)) { |
|
| 96 | + throw new \InvalidArgumentException('Could not cast to type '.$typeOf); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | return $function($result); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $this |
| 114 | - ->select('COUNT(' . $field . ') AS __count') |
|
| 114 | + ->select('COUNT('.$field.') AS __count') |
|
| 115 | 115 | ->scalar('__count', 'int'); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function sum(string $field = null): int |
| 124 | 124 | { |
| 125 | 125 | return $this |
| 126 | - ->select('SUM(' . $field . ') AS __sum') |
|
| 126 | + ->select('SUM('.$field.') AS __sum') |
|
| 127 | 127 | ->scalar('__sum', 'int'); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | public function avg(string $field = null): int |
| 136 | 136 | { |
| 137 | 137 | return $this |
| 138 | - ->select('AVG(' . $field . ') AS __avg') |
|
| 138 | + ->select('AVG('.$field.') AS __avg') |
|
| 139 | 139 | ->scalar('__avg', 'int'); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | public function max(string $field = null): int |
| 148 | 148 | { |
| 149 | 149 | return $this |
| 150 | - ->select('MAX(' . $field . ') AS __max') |
|
| 150 | + ->select('MAX('.$field.') AS __max') |
|
| 151 | 151 | ->scalar('__max', 'int'); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | public function min(string $field = null): int |
| 160 | 160 | { |
| 161 | 161 | return $this |
| 162 | - ->select('MIN(' . $field . ') AS __min') |
|
| 162 | + ->select('MIN('.$field.') AS __min') |
|
| 163 | 163 | ->scalar('__min', 'int'); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - return 'q' . Str::random(7) . '_' . ++static::$lastQueryId; |
|
| 63 | + return 'q'.Str::random(7).'_'.++static::$lastQueryId; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function createPlaceholder(string $pattern = null): string |
| 71 | 71 | { |
| 72 | - return ':' . $this->createAlias($pattern); |
|
| 72 | + return ':'.$this->createAlias($pattern); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | ? \get_class($this->criteria->top()) |
| 74 | 74 | : null; |
| 75 | 75 | |
| 76 | - switch($latest) { |
|
| 76 | + switch ($latest) { |
|
| 77 | 77 | case Where::class: |
| 78 | 78 | case WhereGroup::class: |
| 79 | 79 | return new WhereGroup($this, $group, $this->mode()); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | protected function mode(): bool |
| 95 | 95 | { |
| 96 | - return \tap($this->conjunction, function () { |
|
| 96 | + return \tap($this->conjunction, function() { |
|
| 97 | 97 | $this->conjunction = true; |
| 98 | 98 | }); |
| 99 | 99 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function select(...$fields): self |
| 26 | 26 | { |
| 27 | 27 | foreach ($fields as $field) { |
| 28 | - if (! \is_array($field) && ! \is_string($field)) { |
|
| 28 | + if (!\is_array($field) && !\is_string($field)) { |
|
| 29 | 29 | $error = 'Selection should be array (["field" => "alias"]) or string ("field") but %s given'; |
| 30 | 30 | throw new \InvalidArgumentException(\sprintf($error, \gettype($field))); |
| 31 | 31 | } |
@@ -52,6 +52,6 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function withEntity(string $alias = null): Query |
| 54 | 54 | { |
| 55 | - return $this->select([':' . $this->getAlias() => $alias]); |
|
| 55 | + return $this->select([':'.$this->getAlias() => $alias]); |
|
| 56 | 56 | } |
| 57 | 57 | } |
@@ -199,7 +199,7 @@ |
||
| 199 | 199 | */ |
| 200 | 200 | public function add(CriterionInterface $criterion): self |
| 201 | 201 | { |
| 202 | - if (! $criterion->isAttached()) { |
|
| 202 | + if (!$criterion->isAttached()) { |
|
| 203 | 203 | $criterion->attach($this); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | if ($result === null) { |
| 115 | 115 | $stmt = \is_object($value) ? \get_class($value) : \gettype($value); |
| 116 | - $error = 'Unrecognized coroutine\'s return statement: ' . $stmt; |
|
| 116 | + $error = 'Unrecognized coroutine\'s return statement: '.$stmt; |
|
| 117 | 117 | $context->throw(new \InvalidArgumentException($error)); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | $query->from($this->repository); |
| 136 | 136 | |
| 137 | - if (! $query->has(Criteria\Selection::class)) { |
|
| 138 | - $query->select(':' . $query->getAlias()); |
|
| 137 | + if (!$query->has(Criteria\Selection::class)) { |
|
| 138 | + $query->select(':'.$query->getAlias()); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | private function getKey(array $relation): string |
| 105 | 105 | { |
| 106 | - return $relation['sourceEntity'] . '_' . $relation['targetEntity']; |
|
| 106 | + return $relation['sourceEntity'].'_'.$relation['targetEntity']; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $key = $this->getKey($relation); |
| 116 | 116 | |
| 117 | - if (! isset($this->relations[$key])) { |
|
| 117 | + if (!isset($this->relations[$key])) { |
|
| 118 | 118 | return $this->relations[$key] = |
| 119 | 119 | $this->query->createAlias( |
| 120 | 120 | $relation['sourceEntity'], |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $selection = yield $select->getField(); |
| 30 | 30 | |
| 31 | 31 | if ($select->hasAlias()) { |
| 32 | - $selection .= ' AS ' . $select->getAlias(); |
|
| 32 | + $selection .= ' AS '.$select->getAlias(); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $builder->addSelect($selection); |