@@ -110,7 +110,7 @@ |
||
| 110 | 110 | */ |
| 111 | 111 | protected function mode(): bool |
| 112 | 112 | { |
| 113 | - return \tap($this->conjunction, function () { |
|
| 113 | + return \tap($this->conjunction, function() { |
|
| 114 | 114 | $this->conjunction = true; |
| 115 | 115 | }); |
| 116 | 116 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $name = $pattern |
| 52 | 52 | ? \snake_case(\class_basename($pattern)) |
| 53 | - : 'q' . Str::random(7); |
|
| 53 | + : 'q'.Str::random(7); |
|
| 54 | 54 | |
| 55 | 55 | return \sprintf('%s_%d', $name, ++static::$lastQueryId); |
| 56 | 56 | } |
@@ -61,6 +61,6 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function placeholder(string $pattern = null): string |
| 63 | 63 | { |
| 64 | - return ':' . $this->createAlias($pattern); |
|
| 64 | + return ':'.$this->createAlias($pattern); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | return Collection::wrap($processor->getArrayResult($this)) |
| 34 | - ->map(function ($item) use ($fields) { |
|
| 34 | + ->map(function($item) use ($fields) { |
|
| 35 | 35 | $result = []; |
| 36 | 36 | |
| 37 | 37 | foreach ($fields as $field) { |
@@ -71,22 +71,22 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | switch ($typeOf) { |
| 73 | 73 | case 'callable': |
| 74 | - return function (callable $applicator = null) use ($result) { |
|
| 74 | + return function(callable $applicator = null) use ($result) { |
|
| 75 | 75 | return ($applicator ?? '\\value')($result); |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | 78 | case 'object': |
| 79 | - return (object)$result; |
|
| 79 | + return (object) $result; |
|
| 80 | 80 | |
| 81 | 81 | case 'array': |
| 82 | 82 | case 'iterable': |
| 83 | - return (array)$result; |
|
| 83 | + return (array) $result; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $function = $typeOf . 'val'; |
|
| 86 | + $function = $typeOf.'val'; |
|
| 87 | 87 | |
| 88 | - if (! \function_exists($function)) { |
|
| 89 | - throw new \InvalidArgumentException('Could not cast to type ' . $typeOf); |
|
| 88 | + if (!\function_exists($function)) { |
|
| 89 | + throw new \InvalidArgumentException('Could not cast to type '.$typeOf); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $function($result); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function count(?string $field = 'id'): int |
| 101 | 101 | { |
| 102 | - return $this->select('COUNT(' . $field . ') AS __count') |
|
| 102 | + return $this->select('COUNT('.$field.') AS __count') |
|
| 103 | 103 | ->scalar('__count', 'int'); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function sum(string $field = null): int |
| 112 | 112 | { |
| 113 | - return $this->select('SUM(' . $field . ') AS __sum') |
|
| 113 | + return $this->select('SUM('.$field.') AS __sum') |
|
| 114 | 114 | ->scalar('__sum', 'int'); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function avg(string $field = null): int |
| 123 | 123 | { |
| 124 | - return $this->select('AVG(' . $field . ') AS __avg') |
|
| 124 | + return $this->select('AVG('.$field.') AS __avg') |
|
| 125 | 125 | ->scalar('__avg', 'int'); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function max(string $field = null): int |
| 134 | 134 | { |
| 135 | - return $this->select('MAX(' . $field . ') AS __max') |
|
| 135 | + return $this->select('MAX('.$field.') AS __max') |
|
| 136 | 136 | ->scalar('__max', 'int'); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function min(string $field = null): int |
| 145 | 145 | { |
| 146 | - return $this->select('MIN(' . $field . ') AS __min') |
|
| 146 | + return $this->select('MIN('.$field.') AS __min') |
|
| 147 | 147 | ->scalar('__min', 'int'); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -25,7 +25,7 @@ |
||
| 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 | } |
@@ -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 | } |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | public function __get(string $key): HigherOrderCollectionProxy |
| 122 | 122 | { |
| 123 | - if (! \in_array($key, static::$proxies, true)) { |
|
| 123 | + if (!\in_array($key, static::$proxies, true)) { |
|
| 124 | 124 | $error = "Property [{$key}] does not exist on this collection instance."; |
| 125 | 125 | throw new \InvalidArgumentException($error); |
| 126 | 126 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | $expression = $this->getDoctrineExpression($having, $builder->expr(), $having->getField()); |
| 29 | 29 | |
| 30 | - yield from $this->extractResult($expression, function ($expr) use ($having, $builder) { |
|
| 30 | + yield from $this->extractResult($expression, function($expr) use ($having, $builder) { |
|
| 31 | 31 | if ($having->isAnd()) { |
| 32 | 32 | $builder->andHaving($expr); |
| 33 | 33 | } else { |