@@ -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 | }  | 
                                                        
@@ -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',  | 
                                                        
@@ -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 |      { | 
                                                        
@@ -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 | }  | 
                                                        
@@ -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;  | 
                                                        
@@ -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 | }  | 
                                                        
@@ -28,7 +28,7 @@  | 
                                                    ||
| 28 | 28 | $this->_source = $source;  | 
                                                        
| 29 | 29 | $this->_start = $start;  | 
                                                        
| 30 | 30 | |
| 31 | - parent::__construct($start !== null ? [ $start->id => $start ] : [], 0, \ArrayIterator::class);  | 
                                                        |
| 31 | + parent::__construct($start !== null ? [$start->id => $start] : [], 0, \ArrayIterator::class);  | 
                                                        |
| 32 | 32 | }  | 
                                                        
| 33 | 33 | |
| 34 | 34 | public function getSource()  | 
                                                        
@@ -25,7 +25,7 @@  | 
                                                    ||
| 25 | 25 | /**  | 
                                                        
| 26 | 26 | * RegexMatcher constructor.  | 
                                                        
| 27 | 27 | *  | 
                                                        
| 28 | - * @param $regex  | 
                                                        |
| 28 | + * @param string $regex  | 
                                                        |
| 29 | 29 | * @param callable $callable  | 
                                                        
| 30 | 30 | */  | 
                                                        
| 31 | 31 | public function __construct($regex, callable $callable)  | 
                                                        
@@ -49,7 +49,7 @@  | 
                                                    ||
| 49 | 49 | |
| 50 | 50 | $callable = $this->callable;  | 
                                                        
| 51 | 51 |          foreach ($matches as $match) { | 
                                                        
| 52 | -            foreach($callable($match, $factory) as $token) { | 
                                                        |
| 52 | +            foreach ($callable($match, $factory) as $token) { | 
                                                        |
| 53 | 53 | yield $token;  | 
                                                        
| 54 | 54 | }  | 
                                                        
| 55 | 55 | }  | 
                                                        
@@ -32,7 +32,7 @@  | 
                                                    ||
| 32 | 32 |  { | 
                                                        
| 33 | 33 |      public function __construct($name, $options = []) { | 
                                                        
| 34 | 34 | parent::__construct($name, $options);  | 
                                                        
| 35 | -        if(isset($options['inject'])) { | 
                                                        |
| 35 | +        if (isset($options['inject'])) { | 
                                                        |
| 36 | 36 | $this->inject = $options['inject'];  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -48,7 +48,7 @@ discard block  | 
                                                    ||
| 48 | 48 | *  | 
                                                        
| 49 | 49 | * @return false|Token|null  | 
                                                        
| 50 | 50 | */  | 
                                                        
| 51 | - public function create($name, $params = [ ])  | 
                                                        |
| 51 | + public function create($name, $params = [])  | 
                                                        |
| 52 | 52 |      { | 
                                                        
| 53 | 53 |          if ($name !== null) { | 
                                                        
| 54 | 54 | $name = $this->getName($name);  | 
                                                        
@@ -72,29 +72,29 @@ discard block  | 
                                                    ||
| 72 | 72 | }  | 
                                                        
| 73 | 73 | |
| 74 | 74 |      private function link($name, $params) { | 
                                                        
| 75 | -        if($this->_type & Token::START) { | 
                                                        |
| 76 | -            if(!isset($params['start'])) { | 
                                                        |
| 75 | +        if ($this->_type & Token::START) { | 
                                                        |
| 76 | +            if (!isset($params['start'])) { | 
                                                        |
| 77 | 77 | $params['start'] = new $params['class']($name, $params);  | 
                                                        
| 78 | 78 | }  | 
                                                        
| 79 | 79 | |
| 80 | -            if($this->_type === Token::START) { | 
                                                        |
| 80 | +            if ($this->_type === Token::START) { | 
                                                        |
| 81 | 81 | $params['start']->setEnd(false);  | 
                                                        
| 82 | 82 | return $params['start'];  | 
                                                        
| 83 | 83 | }  | 
                                                        
| 84 | 84 | }  | 
                                                        
| 85 | 85 | |
| 86 | -        if($this->_type & Token::END) { | 
                                                        |
| 86 | +        if ($this->_type & Token::END) { | 
                                                        |
| 87 | 87 |              if (isset($params['length'])) { | 
                                                        
| 88 | 88 | $end = $params;  | 
                                                        
| 89 | 89 | $end['pos'] += $params['length'];  | 
                                                        
| 90 | 90 | |
| 91 | 91 | /** @var Token $end */  | 
                                                        
| 92 | 92 | $params['end'] = new $params['class']($name, $end);  | 
                                                        
| 93 | -            } elseif(!isset($params['end'])) { | 
                                                        |
| 93 | +            } elseif (!isset($params['end'])) { | 
                                                        |
| 94 | 94 | $params['end'] = new $params['class']($name, $params);  | 
                                                        
| 95 | 95 | }  | 
                                                        
| 96 | 96 | |
| 97 | -            if($this->_type === Token::END) { | 
                                                        |
| 97 | +            if ($this->_type === Token::END) { | 
                                                        |
| 98 | 98 | $params['end']->setStart(false);  | 
                                                        
| 99 | 99 | return $params['end'];  | 
                                                        
| 100 | 100 | }  |