@@ -34,7 +34,7 @@ |
||
34 | 34 | ], $options); |
35 | 35 | |
36 | 36 | if ($options['escape']) { |
37 | - $words = array_map(function ($word) { |
|
37 | + $words = array_map(function($word) { |
|
38 | 38 | return preg_quote($word, '/'); |
39 | 39 | }, $words); |
40 | 40 | } |
@@ -45,14 +45,14 @@ |
||
45 | 45 | |
46 | 46 | public static function rearrange(array $array, array $keys) |
47 | 47 | { |
48 | - return array_combine($keys, array_map(function ($key) use ($array) { |
|
48 | + return array_combine($keys, array_map(function($key) use ($array) { |
|
49 | 49 | return $array[$key]; |
50 | 50 | }, $keys)); |
51 | 51 | } |
52 | 52 | |
53 | 53 | public static function column(array $array, $index) |
54 | 54 | { |
55 | - return array_map(function ($e) use ($index) { return $e[$index]; }, $array); |
|
55 | + return array_map(function($e) use ($index) { return $e[$index]; }, $array); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public static function find(array $array, callable $tester) |
@@ -40,7 +40,7 @@ |
||
40 | 40 | 'INTERSECT', 'INTERVAL', 'INTO', 'IS', 'ITERATE', 'LANGUAGE', 'LARGE', 'LATERAL', 'LEADING', |
41 | 41 | 'LEAVE', 'LEFT', 'LIKE', 'LOCAL', 'LOOP', 'MATCH', 'MEMBER', 'MERGE', 'METHOD', 'MODIFIES', |
42 | 42 | 'MODULE', 'MONTH', 'MULTISET', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NEW', 'NO', 'NONE', 'NOT', |
43 | - 'OF', 'OLD', 'ON', 'ONLY', 'OPEN', 'OR', 'ORDER', 'OUT','OUTER', 'OUTPUT', 'OVER', |
|
43 | + 'OF', 'OLD', 'ON', 'ONLY', 'OPEN', 'OR', 'ORDER', 'OUT', 'OUTER', 'OUTPUT', 'OVER', |
|
44 | 44 | 'OVERLAPS', 'PARAMETER', 'PARTITION', 'PRECISION', 'PREPARE', 'PRIMARY', 'PROCEDURE', 'RANGE', 'READS', |
45 | 45 | 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'RELEASE', |
46 | 46 | 'REPEAT', 'RESIGNAL', 'RESULT', 'RETURN', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLLBACK', 'ROLLUP', 'ROW', |
@@ -107,7 +107,7 @@ |
||
107 | 107 | public function all() |
108 | 108 | { |
109 | 109 | $items = $this->getArrayCopy(); |
110 | - if(empty($items)) return []; |
|
110 | + if (empty($items)) return []; |
|
111 | 111 | |
112 | 112 | return call_user_func_array('array_merge', $items); |
113 | 113 | } |
@@ -107,7 +107,9 @@ |
||
107 | 107 | public function all() |
108 | 108 | { |
109 | 109 | $items = $this->getArrayCopy(); |
110 | - if(empty($items)) return []; |
|
110 | + if(empty($items)) { |
|
111 | + return []; |
|
112 | + } |
|
111 | 113 | |
112 | 114 | return call_user_func_array('array_merge', $items); |
113 | 115 | } |
@@ -151,7 +151,7 @@ |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
154 | - * @return Token|null|false |
|
154 | + * @return Token |
|
155 | 155 | */ |
156 | 156 | public function getEnd() |
157 | 157 | { |
@@ -85,7 +85,7 @@ |
||
85 | 85 | return $this->_end === null; |
86 | 86 | } |
87 | 87 | |
88 | - public function isValid(Context $context) |
|
88 | + public function isValid(Context $context) |
|
89 | 89 | { |
90 | 90 | if ($this->_valid === null) { |
91 | 91 | $this->validate($context); |
@@ -178,13 +178,12 @@ discard block |
||
178 | 178 | * @return bool Return true to continue processing, false to return already processed tokens. |
179 | 179 | */ |
180 | 180 | public function process(Context $context, Language $language, Result $result, TokenIterator $tokens) { |
181 | - if(!$this->isValid($context)) { |
|
181 | + if (!$this->isValid($context)) { |
|
182 | 182 | return true; |
183 | 183 | } |
184 | 184 | |
185 | 185 | return $this->isStart() ? |
186 | - $this->processStart($context, $language, $result, $tokens) : |
|
187 | - $this->processEnd($context, $language, $result, $tokens); |
|
186 | + $this->processStart($context, $language, $result, $tokens) : $this->processEnd($context, $language, $result, $tokens); |
|
188 | 187 | } |
189 | 188 | |
190 | 189 | protected function processStart(Context $context, Language $language, Result $result, TokenIterator $tokens) { |
@@ -195,7 +194,7 @@ discard block |
||
195 | 194 | } |
196 | 195 | |
197 | 196 | protected function processEnd(Context $context, Language $language, Result $result, TokenIterator $tokens) { |
198 | - if($this->_start) { |
|
197 | + if ($this->_start) { |
|
199 | 198 | $context->pop($this->_start); |
200 | 199 | } else { |
201 | 200 | if (($start = $context->find($this->name)) !== false) { |
@@ -225,9 +224,9 @@ discard block |
||
225 | 224 | return $multiplier; |
226 | 225 | } |
227 | 226 | } elseif (($rule = Helper::cmp($b->rule->priority, $a->rule->priority)) !== 0) { |
228 | - return $multiplier*$rule; |
|
229 | - } else { |
|
230 | - return $multiplier*($a->id < $b->id ? -1 : 1); |
|
227 | + return $multiplier * $rule; |
|
228 | + } else { |
|
229 | + return $multiplier * ($a->id < $b->id ? -1 : 1); |
|
231 | 230 | } |
232 | 231 | } |
233 | 232 | } |
@@ -226,7 +226,7 @@ |
||
226 | 226 | } |
227 | 227 | } elseif (($rule = Helper::cmp($b->rule->priority, $a->rule->priority)) !== 0) { |
228 | 228 | return $multiplier*$rule; |
229 | - } else { |
|
229 | + } else { |
|
230 | 230 | return $multiplier*($a->id < $b->id ? -1 : 1); |
231 | 231 | } |
232 | 232 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | 'string.nowdoc' => new Rule( |
67 | 67 | new RegexMatcher('/<<\s*\'(\w+)\';(?P<string>.*?)\n\1/sm', [ |
68 | 68 | 'string' => Token::NAME, |
69 | - 0 => 'keyword.nowdoc' |
|
69 | + 0 => 'keyword.nowdoc' |
|
70 | 70 | ]), ['context' => ['!comment']] |
71 | 71 | ), |
72 | 72 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $this->_end->_valid = false; |
44 | 44 | } |
45 | 45 | } else { |
46 | - if (!$this->rule->validator->validate($context, [ $this->name => Validator::CONTEXT_IN ])) { |
|
46 | + if (!$this->rule->validator->validate($context, [$this->name => Validator::CONTEXT_IN])) { |
|
47 | 47 | $this->setValid(false); |
48 | 48 | } else { |
49 | 49 | $this->_valid = false; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | protected function processEnd(Context $context, Language $language, Result $result, TokenIterator $tokens) |
47 | 47 | { |
48 | - foreach(array_filter($context->stack, function ($name) { |
|
48 | + foreach (array_filter($context->stack, function($name) { |
|
49 | 49 | return in_array($name, $this->closes); |
50 | 50 | }) as $hash => $name) { |
51 | 51 | $end = new Token([$name, 'pos' => $this->pos]); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public function find($needle) { |
32 | 32 | foreach (array_reverse($this->stack, true) as $id => $name) { |
33 | - if($name === $needle) { |
|
33 | + if ($name === $needle) { |
|
34 | 34 | return $id; |
35 | 35 | } |
36 | 36 | } |