@@ -64,6 +64,6 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | public function isDesc(): bool |
| 66 | 66 | { |
| 67 | - return ! $this->asc; |
|
| 67 | + return !$this->asc; |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | return \iterator_to_array($value); |
| 63 | 63 | |
| 64 | 64 | case \is_object($value) && \method_exists($value, '__toString'): |
| 65 | - return (string)$value; |
|
| 65 | + return (string) $value; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return $value; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $error = 'Relation should be string ("relation_name") '. |
| 43 | - 'or array (["relation" => function]), ' . |
|
| 43 | + 'or array (["relation" => function]), '. |
|
| 44 | 44 | 'but %s given'; |
| 45 | 45 | |
| 46 | 46 | throw new \InvalidArgumentException(\sprintf($error, \gettype($relation))); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function query(): Query |
| 44 | 44 | { |
| 45 | - if (! $this instanceof EntityRepository) { |
|
| 45 | + if (!$this instanceof EntityRepository) { |
|
| 46 | 46 | $error = 'Could not use %s under non-repository class, but %s given'; |
| 47 | 47 | throw new \LogicException(\sprintf($error, Hydrogen::class, static::class)); |
| 48 | 48 | } |
@@ -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 | /** |
@@ -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 | } |
@@ -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 | /** |