@@ -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', |
@@ -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; |
@@ -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() |
@@ -70,21 +70,19 @@ discard block |
||
| 70 | 70 | public function languageByName($name, $params = []) |
| 71 | 71 | { |
| 72 | 72 | return isset($this->_languages['name'][$name]) ? |
| 73 | - $this->_languages['name'][$name]($params) : |
|
| 74 | - new PlainText($params); |
|
| 73 | + $this->_languages['name'][$name]($params) : new PlainText($params); |
|
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | public function languageByMime($mime, $params = []) |
| 78 | 77 | { |
| 79 | 78 | return isset($this->_languages['mime'][$mime]) ? |
| 80 | - $this->_languages['mime'][$mime]($params) : |
|
| 81 | - new PlainText($params); |
|
| 79 | + $this->_languages['mime'][$mime]($params) : new PlainText($params); |
|
| 82 | 80 | } |
| 83 | 81 | |
| 84 | 82 | public function languageByExt($filename, $params = []) |
| 85 | 83 | { |
| 86 | - foreach($this->_languages['extension'] as $mask => $class) { |
|
| 87 | - if(fnmatch($mask, $filename)) { |
|
| 84 | + foreach ($this->_languages['extension'] as $mask => $class) { |
|
| 85 | + if (fnmatch($mask, $filename)) { |
|
| 88 | 86 | return $class($params); |
| 89 | 87 | } |
| 90 | 88 | } |
@@ -110,7 +108,7 @@ discard block |
||
| 110 | 108 | |
| 111 | 109 | public function registeredLanguages($by = 'name', $class = false) |
| 112 | 110 | { |
| 113 | - return array_map(function ($e) use($class) { |
|
| 111 | + return array_map(function($e) use($class) { |
|
| 114 | 112 | return $e([])->getFQN($class); |
| 115 | 113 | }, $this->_languages[$by]); |
| 116 | 114 | } |
@@ -150,7 +148,7 @@ discard block |
||
| 150 | 148 | |
| 151 | 149 | public function init() |
| 152 | 150 | { |
| 153 | - foreach(include __DIR__.'/Config/metadata.php' as $alias) { |
|
| 151 | + foreach (include __DIR__.'/Config/metadata.php' as $alias) { |
|
| 154 | 152 | $class = $alias[0]; |
| 155 | 153 | unset($alias[0]); |
| 156 | 154 | |
@@ -166,13 +164,13 @@ discard block |
||
| 166 | 164 | */ |
| 167 | 165 | public function register($class, array $options) |
| 168 | 166 | { |
| 169 | - if(!is_callable($class) && is_subclass_of($class, Language::class)) { |
|
| 167 | + if (!is_callable($class) && is_subclass_of($class, Language::class)) { |
|
| 170 | 168 | $class = function($arguments = []) use ($class) { |
| 171 | 169 | return new $class($arguments); |
| 172 | 170 | }; |
| 173 | 171 | } |
| 174 | 172 | |
| 175 | - foreach(array_intersect_key($options, array_flip(['name', 'mime', 'extension'])) as $name => $values) { |
|
| 173 | + foreach (array_intersect_key($options, array_flip(['name', 'mime', 'extension'])) as $name => $values) { |
|
| 176 | 174 | $this->_languages[$name] = array_merge($this->_languages[$name], array_fill_keys($values, $class)); |
| 177 | 175 | } |
| 178 | 176 | } |
@@ -36,14 +36,14 @@ |
||
| 36 | 36 | new OpenRule(new RegexMatcher('/(<[\w\.-]+)[:\/>:\s]/')), |
| 37 | 37 | new CloseRule(new SubStringMatcher('>'), ['context' => ['!string', '!comment']]) |
| 38 | 38 | ], |
| 39 | - 'tag.close' => new Rule(new RegexMatcher('/(<\/' . self::IDENTIFIER . '>)/')), |
|
| 39 | + 'tag.close' => new Rule(new RegexMatcher('/(<\/'.self::IDENTIFIER.'>)/')), |
|
| 40 | 40 | |
| 41 | - 'symbol.tag' => new Rule(new RegexMatcher('/<\\/?' . self::IDENTIFIER . '/', [ |
|
| 41 | + 'symbol.tag' => new Rule(new RegexMatcher('/<\\/?'.self::IDENTIFIER.'/', [ |
|
| 42 | 42 | 'name' => Token::NAME, |
| 43 | 43 | 'namespace' => '$.namespace' |
| 44 | 44 | ]), ['context' => ['tag', '!string']]), |
| 45 | 45 | |
| 46 | - 'symbol.attribute' => new Rule(new RegexMatcher('/' . self::IDENTIFIER . '=/', [ |
|
| 46 | + 'symbol.attribute' => new Rule(new RegexMatcher('/'.self::IDENTIFIER.'=/', [ |
|
| 47 | 47 | 'name' => Token::NAME, |
| 48 | 48 | 'namespace' => '$.namespace' |
| 49 | 49 | ]), ['context' => ['tag', '!string']]), |
@@ -19,14 +19,14 @@ |
||
| 19 | 19 | { |
| 20 | 20 | public static function rearrange(array $array, array $keys) |
| 21 | 21 | { |
| 22 | - return array_combine($keys, array_map(function ($key) use ($array) { |
|
| 22 | + return array_combine($keys, array_map(function($key) use ($array) { |
|
| 23 | 23 | return $array[$key]; |
| 24 | 24 | }, $keys)); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public static function column(array $array, $index) |
| 28 | 28 | { |
| 29 | - return array_map(function ($e) use ($index) { return $e[$index]; }, $array); |
|
| 29 | + return array_map(function($e) use ($index) { return $e[$index]; }, $array); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public static function find(array $array, callable $tester) |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | new Rule(new RegexMatcher('/(\$\w+)/i'), ['context' => ['*none', '*string.double']]), |
| 52 | 52 | 'special' => new Rule(new RegexMatcher('/(\$[#@_])/i'), ['context' => ['*none', '*string.double']]), |
| 53 | 53 | 'argument' => new Rule(new RegexMatcher('/(\$\d+)/i'), ['context' => ['*none', '*string.double']]), |
| 54 | - new Rule(new RegexMatcher('/\$\{(\w+)(.*?)\}/i', [ 1 => Token::NAME, 2 => 'string' ]), ['context' => ['*none', '*string.double']]) |
|
| 54 | + new Rule(new RegexMatcher('/\$\{(\w+)(.*?)\}/i', [1 => Token::NAME, 2 => 'string']), ['context' => ['*none', '*string.double']]) |
|
| 55 | 55 | ], |
| 56 | 56 | |
| 57 | 57 | 'number' => new Rule(new RegexMatcher('/(-?(?:0[0-7]+|0[xX][0-9a-fA-F]+|0b[01]+|\d+))/')), |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | new Rule(new RegexMatcher('/(\\\\\[.*?\\\\\])/s')), |
| 42 | 42 | new Rule( |
| 43 | 43 | new RegexMatcher( |
| 44 | - '/\\\begin{((?:' . implode('|', self::$mathEnvironments) . ')\*?)}(.*?)\\\end{\1}/s', |
|
| 44 | + '/\\\begin{((?:'.implode('|', self::$mathEnvironments).')\*?)}(.*?)\\\end{\1}/s', |
|
| 45 | 45 | [2 => Token::NAME] |
| 46 | 46 | ) |
| 47 | 47 | ) |