Passed
Push — master ( a2014d...22f24f )
by Kacper
03:29
created
Language/Xml.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@
 block discarded – undo
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']]),
Please login to merge, or discard this patch.
Parser/Validator/Validator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function setRules($rules)
46 46
     {
47
-        if(empty($rules)) {
48
-            $this->_rules = [ 'none' => Validator::CONTEXT_IN_ONE_OF ];
47
+        if (empty($rules)) {
48
+            $this->_rules = ['none' => Validator::CONTEXT_IN_ONE_OF];
49 49
         } else {
50 50
             foreach ($rules as $key => $rule) {
51 51
                 list($plain, $type)   = $this->_parse($rule);
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
     private function _clean($rule, &$required)
58 58
     {
59 59
         if (strpos($rule, '.') !== false) {
60
-            foreach (array_filter(array_keys($required), function ($key) use ($rule) {
61
-                return fnmatch($key . '.*', $rule);
60
+            foreach (array_filter(array_keys($required), function($key) use ($rule) {
61
+                return fnmatch($key.'.*', $rule);
62 62
             }) as $remove) {
63 63
                 unset($required[$remove]);
64 64
             }
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
     }
67 67
 
68 68
     protected function _validate($context, $rules, $result = false) {
69
-        if(empty($context)) {
69
+        if (empty($context)) {
70 70
             $context = ['none'];
71 71
         }
72 72
 
73
-        foreach($rules as $rule => &$type) {
73
+        foreach ($rules as $rule => &$type) {
74 74
             $matched = $this->_matches($context, $rule, $type);
75 75
 
76 76
             if ($type & Validator::CONTEXT_NOT_IN) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
         $rule = substr($rule, $pos);
125 125
 
126
-        if($type & self::CONTEXT_REGEX) {
126
+        if ($type & self::CONTEXT_REGEX) {
127 127
             $rule = "/^$rule(\\.\\w+)?/i";
128 128
         }
129 129
 
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
     }
132 132
 
133 133
     private function _matches($context, $rule, $type) {
134
-        if($type & self::CONTEXT_EXACTLY) {
134
+        if ($type & self::CONTEXT_EXACTLY) {
135 135
             return in_array($rule, $context, true);
136
-        } elseif($type & self::CONTEXT_REGEX) {
137
-            foreach($context as $item) {
138
-                if(preg_match($rule, $item)) {
136
+        } elseif ($type & self::CONTEXT_REGEX) {
137
+            foreach ($context as $item) {
138
+                if (preg_match($rule, $item)) {
139 139
                     return true;
140 140
                 }
141 141
             }
142 142
             return false;
143 143
         } else {
144
-            if(in_array($rule, $context, true)) {
144
+            if (in_array($rule, $context, true)) {
145 145
                 return true;
146 146
             }
147 147
 
148
-            foreach($context as $item) {
149
-                if(fnmatch("$rule.*", $item)) {
148
+            foreach ($context as $item) {
149
+                if (fnmatch("$rule.*", $item)) {
150 150
                     return true;
151 151
                 }
152 152
             }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     {
159 159
         static $validator;
160 160
         if (!$validator) {
161
-            $validator = new DelegateValidator(function () {
161
+            $validator = new DelegateValidator(function() {
162 162
                 return true;
163 163
             });
164 164
         }
Please login to merge, or discard this patch.
Parser/Token/TerminatorToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
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]);
Please login to merge, or discard this patch.
Utils/ArrayHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Language/Http.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
54 54
         $split = preg_split('/\R\R/', $source, 2);
55 55
 
56 56
         $http = $split[0];
57
-        if(isset($split[1]) && $payload = $split[1]) {
58
-            if(preg_match('/Content-Type: ([^;]*)/', $http, $matches)) {
57
+        if (isset($split[1]) && $payload = $split[1]) {
58
+            if (preg_match('/Content-Type: ([^;]*)/', $http, $matches)) {
59 59
                 $mime = $matches[1];
60 60
             } else {
61 61
                 $mime = 'text/plain';
Please login to merge, or discard this patch.
Language/JavaScript.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
             'comment' => new Rule(new CommentMatcher(['//'], [['/*', '*/']]), ['priority' => 3]),
63 63
 
64
-            'call' => new Rule(new RegexMatcher('/(' . self::IDENTIFIER . ')\s*\(/iu'), ['priority' => -1]),
64
+            'call' => new Rule(new RegexMatcher('/('.self::IDENTIFIER.')\s*\(/iu'), ['priority' => -1]),
65 65
 
66 66
             'keyword' => new Rule(new WordMatcher([
67 67
                 'do', 'if', 'in', 'for', 'let', 'new', 'try', 'var', 'case', 'else', 'enum', 'eval',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 ])
91 91
             ],
92 92
 
93
-            'variable' => new Rule(new RegexMatcher('/\b(?<!\.)(' . self::IDENTIFIER . ':?)/iu'), [
93
+            'variable' => new Rule(new RegexMatcher('/\b(?<!\.)('.self::IDENTIFIER.':?)/iu'), [
94 94
                 'priority' => -1,
95 95
                 'enabled'  => $this->variables
96 96
             ])
Please login to merge, or discard this patch.
Language/Perl.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
             'string.nowdoc'  => new Rule(
62 62
                 new RegexMatcher('/<<\s*\'(\w+)\';(?P<string>.*?)\R\1/sm', [
63 63
                     'string' => Token::NAME,
64
-                          0  => 'keyword.nowdoc'
64
+                            0  => 'keyword.nowdoc'
65 65
                 ]), ['context' => ['!comment']]
66 66
             ),
67 67
 
Please login to merge, or discard this patch.
Matcher/CommentMatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function __construct(array $singleLine = null, array $multiLine = null)
32 32
     {
33 33
         $this->singleLine = $singleLine ?: [];
34
-        $this->multiLine  = $multiLine  ?: [];
34
+        $this->multiLine  = $multiLine ?: [];
35 35
     }
36 36
 
37 37
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $all = [];
50 50
 
51 51
         foreach ($this->multiLine as $name => $comment) {
52
-            $comment = array_map(function ($e) { return preg_quote($e, '/'); }, $comment);
52
+            $comment = array_map(function($e) { return preg_quote($e, '/'); }, $comment);
53 53
 
54 54
             $all[] = [$name, "/({$comment[0]}(.*?){$comment[1]})/ms"];
55 55
         }
Please login to merge, or discard this patch.
bin/Commands/Benchmark/RunCommand.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -104,6 +104,9 @@  discard block
 block discarded – undo
104 104
         ;
105 105
     }
106 106
 
107
+    /**
108
+     * @param string $source
109
+     */
107 110
     protected function benchmark($source, Language $language, FormatterInterface $formatter, $geshi = null)
108 111
     {
109 112
         $tokenization = microtime(true);
@@ -122,6 +125,9 @@  discard block
 block discarded – undo
122 125
         return compact('tokenization', 'parsing', 'formatting', 'overall');
123 126
     }
124 127
 
128
+    /**
129
+     * @param string $source
130
+     */
125 131
     protected function geshi($source, $language)
126 132
     {
127 133
         $geshi = microtime(true);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     protected function execute(InputInterface $input, OutputInterface $output)
33 33
     {
34
-        $dir = __DIR__ . 'BenchmarkCommand.php/' .static::DIRECTORY;
34
+        $dir = __DIR__.'BenchmarkCommand.php/'.static::DIRECTORY;
35 35
         $iterator = new \RecursiveIteratorIterator(
36 36
             new \RecursiveDirectoryIterator(
37 37
                 $dir,
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
             $this->benchmark($source, $language, $formatter);
68 68
 
69 69
             $intermediate = [];
70
-            for($i = $input->getOption('times'); $i > 0; $i--) {
70
+            for ($i = $input->getOption('times'); $i > 0; $i--) {
71 71
                 $intermediate = array_merge_recursive($intermediate, $this->benchmark($source, $language, $formatter));
72 72
 
73
-                if($input->getOption('geshi') && class_exists('GeSHi')) {
73
+                if ($input->getOption('geshi') && class_exists('GeSHi')) {
74 74
                     $intermediate['geshi'][] = $this->geshi($source, $file->getExtension());
75 75
                 }
76 76
             }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $result = json_encode($results, $input->getOption('pretty') ? JSON_PRETTY_PRINT : 0);
135 135
 
136
-        if($input->hasArgument('output')) {
136
+        if ($input->hasArgument('output')) {
137 137
             file_put_contents($input->getArgument('output'), $result);
138 138
         } else {
139 139
             $output->write($result);
Please login to merge, or discard this patch.