Passed
Push — master ( 203740...2c4c0a )
by Kacper
04:22
created
Parser/TokenList.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@
 block discarded – undo
56 56
     public function sort() {
57 57
         ksort($this->_tokens);
58 58
 
59
-        foreach(array_keys($this->_pending) as $position) {
59
+        foreach (array_keys($this->_pending) as $position) {
60 60
             uasort(
61 61
                 $this->_tokens[$position],
62
-                Token::class.'::compare'
62
+                Token::class . '::compare'
63 63
             );
64 64
         }
65 65
         $this->_pending = [];
Please login to merge, or discard this patch.
Parser/TokenFactory.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
     }
114 114
 
115 115
     /**
116
-     * @param mixed $class
116
+     * @param string $class
117 117
      *
118 118
      * @throws \InvalidArgumentException
119 119
      */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function create($params) {
48 48
         $params[0] = !empty($params[0]) ? $this->getName($params[0]) : $this->_base;
49
-        if(empty($params['rule'])) {
49
+        if (empty($params['rule'])) {
50 50
             $params['rule'] = $this->_rule;
51 51
         }
52 52
 
53
-        if(isset($params['pos'])) {
53
+        if (isset($params['pos'])) {
54 54
             $params['pos'] += $this->_offset;
55 55
         }
56 56
 
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
         /** @var Token $token */
67 67
         $token = new $this->_class($params);
68 68
 
69
-        if($this->_type == 0x3) {
69
+        if ($this->_type == 0x3) {
70 70
             return $token;
71 71
         }
72 72
 
73
-        if($this->_type === Token::START) {
73
+        if ($this->_type === Token::START) {
74 74
             $token->setEnd(false);
75 75
             return $token;
76 76
         } else {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function setClass($class)
121 121
     {
122
-        if(!is_a($class, 'Kadet\Highlighter\Parser\Token', true)) {
122
+        if (!is_a($class, 'Kadet\Highlighter\Parser\Token', true)) {
123 123
             throw new \InvalidArgumentException('$class must extend Kadet\Highlighter\Parser\Token');
124 124
         }
125 125
 
Please login to merge, or discard this patch.
Parser/Token.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,19 +91,19 @@
 block discarded – undo
91 91
         $multiplier = $a->isEnd() ? -1 : 1;
92 92
 
93 93
         if (($a->isStart() && $b->isEnd()) || ($a->isEnd() && $b->isStart())) {
94
-            if($a->getStart() == $b) {
94
+            if ($a->getStart() == $b) {
95 95
                 return 1;
96
-            } elseif($a->getEnd() == $b) {
96
+            } elseif ($a->getEnd() == $b) {
97 97
                 return -1;
98 98
             } else {
99 99
                 return $multiplier;
100 100
             }
101 101
         } elseif (($rule = Helper::cmp($b->_rule->priority, $a->_rule->priority)) !== 0) {
102
-            return $multiplier*$rule;
102
+            return $multiplier * $rule;
103 103
         } elseif (($rule = Helper::cmp($b->index, $a->index)) !== 0) {
104
-            return $multiplier*$rule;
104
+            return $multiplier * $rule;
105 105
         } else {
106
-            return $multiplier*($a->id < $b->id ? -1 : 1);
106
+            return $multiplier * ($a->id < $b->id ? -1 : 1);
107 107
         }
108 108
     }
109 109
 
Please login to merge, or discard this patch.
Formatter/CliFormatter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param $styles
36 36
      */
37 37
     public function __construct($styles = false) {
38
-        $this->_styles = $styles ?: include __DIR__.'/../Styles/Cli/Default.php';
38
+        $this->_styles = $styles ?: include __DIR__ . '/../Styles/Cli/Default.php';
39 39
     }
40 40
 
41 41
     public function format(TokenIterator $tokens)
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
             $last = $token->pos;
57 57
         }
58
-        $result .= substr($source, $last).Console::reset();
58
+        $result .= substr($source, $last) . Console::reset();
59 59
 
60 60
         return $result;
61 61
     }
Please login to merge, or discard this patch.
KeyLighter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function getLanguage($name) {
51 51
         $embedded = [];
52
-        if(($pos = strpos($name, '>')) !== false) {
52
+        if (($pos = strpos($name, '>')) !== false) {
53 53
             $embedded[] = self::getLanguage(trim(substr($name, $pos + 1)));
54 54
             $name       = trim(substr($name, 0, $pos));
55 55
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function highlight($source, $language, FormatterInterface $formatter = null) {
84 84
         $formatter = $formatter ?: $this->getDefaultFormatter();
85 85
 
86
-        if(!$language instanceof Language) {
86
+        if (!$language instanceof Language) {
87 87
             $language = $this->getLanguage($language);
88 88
         }
89 89
 
Please login to merge, or discard this patch.
Language/Sql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
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',
Please login to merge, or discard this patch.
Utils/ArrayHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 {
21 21
     public static function rearrange(array $array, array $keys)
22 22
     {
23
-        return array_combine($keys, array_map(function ($key) use ($array) {
23
+        return array_combine($keys, array_map(function($key) use ($array) {
24 24
             return $array[$key];
25 25
         }, $keys));
26 26
     }
27 27
 
28 28
     public static function column(array $array, $index)
29 29
     {
30
-        return array_map(function ($e) use ($index) { return $e[$index]; }, $array);
30
+        return array_map(function($e) use ($index) { return $e[$index]; }, $array);
31 31
     }
32 32
 
33 33
     public static function find(array $array, callable $tester)
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     public static function resolve(array $array, $key, $fallback = null) {
45 45
         do {
46
-            if(isset($array[$key])) {
46
+            if (isset($array[$key])) {
47 47
                 return $array[$key];
48 48
             }
49 49
 
Please login to merge, or discard this patch.
Language/Language.php 2 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -158,6 +158,9 @@  discard block
 block discarded – undo
158 158
         return new TokenIterator($result, $tokens->getSource());
159 159
     }
160 160
 
161
+    /**
162
+     * @param string $source
163
+     */
161 164
     public function tokenize($source, $additional = [], $offset = 0, $embedded = false)
162 165
     {
163 166
         $iterator = new TokenIterator(
@@ -197,7 +200,7 @@  discard block
 block discarded – undo
197 200
     /**
198 201
      * @param bool $embedded
199 202
      *
200
-     * @return Rule[]
203
+     * @return \Generator
201 204
      */
202 205
     private function _rules($embedded = false)
203 206
     {
@@ -241,7 +244,7 @@  discard block
 block discarded – undo
241 244
     /**
242 245
      * Language range Rule(s)
243 246
      *
244
-     * @return Rule|Rule[]
247
+     * @return Rule
245 248
      */
246 249
     public function getOpenClose()
247 250
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
                     } else {
141 141
                         /** @noinspection PhpUnusedParameterInspection */
142 142
                         $start = ArrayHelper::find(
143
-                            array_reverse($context), function ($k, $v) use ($token) {
143
+                            array_reverse($context), function($k, $v) use ($token) {
144 144
                             return $v === $token->name;
145 145
                         });
146 146
 
Please login to merge, or discard this patch.