@@ -14,7 +14,6 @@ |
||
14 | 14 | use Doctrine\ORM\Mapping\ClassMetadata; |
15 | 15 | use Illuminate\Support\Traits\Macroable; |
16 | 16 | use RDS\Hydrogen\Criteria\CriterionInterface; |
17 | -use RDS\Hydrogen\Processor\ProcessorInterface; |
|
18 | 17 | use RDS\Hydrogen\Query\AliasProvider; |
19 | 18 | use RDS\Hydrogen\Query\ExecutionsProvider; |
20 | 19 | use RDS\Hydrogen\Query\GroupByProvider; |
@@ -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 |
@@ -44,6 +44,7 @@ |
||
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @param string ...$patterns |
47 | + * @param string[] $patterns |
|
47 | 48 | * @return string |
48 | 49 | */ |
49 | 50 | public function createAlias(string ...$patterns): string |
@@ -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 | /** |
@@ -9,7 +9,6 @@ |
||
9 | 9 | |
10 | 10 | namespace RDS\Hydrogen\Query; |
11 | 11 | |
12 | -use Illuminate\Support\Arr; |
|
13 | 12 | use RDS\Hydrogen\Query; |
14 | 13 | use RDS\Hydrogen\Collection\Collection; |
15 | 14 |
@@ -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 |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace RDS\Hydrogen\Query; |
11 | 11 | |
12 | 12 | use RDS\Hydrogen\Criteria\HavingGroup; |
13 | -use RDS\Hydrogen\Criteria\WhereGroup; |
|
14 | 13 | use RDS\Hydrogen\Criteria\GroupBy; |
15 | 14 | use RDS\Hydrogen\Criteria\Having; |
16 | 15 | use RDS\Hydrogen\Query; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | protected $repository; |
26 | 26 | |
27 | 27 | /** |
28 | - * @param ObjectRepository|Hydrogen $repository |
|
28 | + * @param ObjectRepository $repository |
|
29 | 29 | * @return Query|$this |
30 | 30 | */ |
31 | 31 | public function from(ObjectRepository $repository): self |
@@ -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 | } |
@@ -25,6 +25,6 @@ |
||
25 | 25 | */ |
26 | 26 | public function apply($builder, CriterionInterface $relation): ?iterable |
27 | 27 | { |
28 | - throw new \LogicException(__CLASS__ . ' not implemented yet'); |
|
28 | + throw new \LogicException(__CLASS__.' not implemented yet'); |
|
29 | 29 | } |
30 | 30 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | private function registerDQLFunctions(Configuration $config): void |
45 | 45 | { |
46 | 46 | foreach (self::DQL_FUNCTIONS as $name => $fn) { |
47 | - if (! $config->getCustomStringFunction($name)) { |
|
47 | + if (!$config->getCustomStringFunction($name)) { |
|
48 | 48 | $config->addCustomStringFunction($name, $fn); |
49 | 49 | } |
50 | 50 | } |