Completed
Pull Request — master (#226)
by Oskar
03:03
created
src/Hal/Component/File/Finder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function find($path)
69 69
     {
70 70
         $files = array();
71
-        if(is_dir($path)) {
71
+        if (is_dir($path)) {
72 72
             $path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
73 73
             $directory = new RecursiveDirectoryIterator($path, $this->flags);
74 74
             $iterator = new RecursiveIteratorIterator($directory);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             $filterRegex = sprintf(
77 77
                 '`^%s%s$`',
78 78
                 !empty($this->excludedDirs) ? '((?!'.$this->excludedDirs.').)+' : '.+',
79
-                '\.(' . $this->extensions . ')'
79
+                '\.('.$this->extensions.')'
80 80
             );
81 81
 
82 82
             $filteredIterator = new RegexIterator(
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
                 \RecursiveRegexIterator::GET_MATCH
86 86
             );
87 87
 
88
-            foreach($filteredIterator as $file) {
88
+            foreach ($filteredIterator as $file) {
89 89
                 $files[] = $file[0];
90 90
             }
91
-        } elseif(is_file($path)) {
91
+        } elseif (is_file($path)) {
92 92
             $files = array($path);
93 93
         }
94 94
         return $files;
Please login to merge, or discard this patch.
src/Hal/Component/File/SyntaxChecker.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         $php = 'php';
32 32
 
33 33
         if (0 >= version_compare('5.4.0', PHP_VERSION)) {
34
-           $php = PHP_BINARY;
34
+            $php = PHP_BINARY;
35 35
         }
36 36
 
37 37
         $output = shell_exec(sprintf('"%s" -l %s 2>&1', $php, escapeshellarg($filename)));
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      * @return int
25 25
      */
26 26
     public function isCorrect($filename) {
27
-        if(1 === version_compare('5.0.4', PHP_VERSION)) {
27
+        if (1 === version_compare('5.0.4', PHP_VERSION)) {
28 28
             return php_check_syntax($filename);
29 29
         }
30 30
 
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Extractor/AliasExtractor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@
 block discarded – undo
43 43
     {
44 44
         $alias = $real = null;
45 45
         $expression = $this->searcher->getUnder(array(';'), $n, $tokens);
46
-        if(preg_match('!use\s+(.*)\s+as\s+(.*)!i', $expression, $matches)) {
46
+        if (preg_match('!use\s+(.*)\s+as\s+(.*)!i', $expression, $matches)) {
47 47
             list(, $real, $alias) = $matches;
48
-        } else if(preg_match('!use\s+([^\s\(]+)\s*!i', $expression, $matches)) {
48
+        } else if (preg_match('!use\s+([^\s\(]+)\s*!i', $expression, $matches)) {
49 49
             list(, $real) = $matches;
50 50
             $alias = $real;
51 51
         }
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Extractor/CallExtractor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 
53 53
         $token = $tokens[$n];
54 54
         $call = null;
55
-        switch($token->getType()) {
55
+        switch ($token->getType()) {
56 56
             case T_PAAMAYIM_NEKUDOTAYIM:
57 57
                 $prev = $n - 1;
58 58
                 $value = $this->searcher->getUnder(array('::'), $prev, $tokens);
59 59
 
60
-                switch(true) {
60
+                switch (true) {
61 61
                     case $value == 'parent' && $this->currentClass:
62 62
                         return $this->currentClass->getParent();
63 63
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
                         $extendPosition = $this->searcher->getExtendPosition($tokens, $n);
67 67
                         return $this->searcher->getFollowingName($extendPosition, $tokens);
68 68
 
69
-                    case ($value == 'static' ||$value === 'self')&& $this->currentClass:
69
+                    case ($value == 'static' || $value === 'self') && $this->currentClass:
70 70
                         return $this->currentClass->getFullname();
71 71
 
72
-                    case ($value == 'static' ||$value === 'self'):
72
+                    case ($value == 'static' || $value === 'self'):
73 73
                         $extendPosition = $this->searcher->getClassNamePosition($tokens);
74 74
                         return $this->searcher->getFollowingName($extendPosition, $tokens);
75 75
 
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 
80 80
             case T_NEW:
81 81
                 $call = $this->searcher->getFollowingName($n, $tokens);
82
-                if(preg_match('!^(\w+)!', $call, $matches)) { // fixes PHP 5.4:    (new MyClass)->foo()
82
+                if (preg_match('!^(\w+)!', $call, $matches)) { // fixes PHP 5.4:    (new MyClass)->foo()
83 83
                     $call = $matches[1];
84 84
                 }
85 85
                 break;
86 86
         }
87
-        if(null === $call) {
87
+        if (null === $call) {
88 88
             throw new \LogicException('Classname of call not found');
89 89
         }
90 90
         return $call;
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Extractor/ClassExtractor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     {
50 50
         // is PHP7 ?
51 51
         $previous = $tokens->get($n - 2);
52
-        if($previous && T_NEW === $previous->getType()) {
52
+        if ($previous && T_NEW === $previous->getType()) {
53 53
             // anonymous class
54 54
             $class = new ReflectedAnonymousClass($this->namespace, 'class@anonymous');
55 55
             return $class;
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Extractor/ClassMap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      * @return $this
32 32
      */
33 33
     public function push($filename, Result $result) {
34
-        $this->classes[$filename] = $result;;
34
+        $this->classes[$filename] = $result; ;
35 35
         return $this;
36 36
     }
37 37
 
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Extractor/Result.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function asArray() {
32 32
 
33 33
         $nom = 0;
34
-        foreach($this->getClasses() as $class) {
34
+        foreach ($this->getClasses() as $class) {
35 35
             $nom += sizeof($class->getMethods(), COUNT_NORMAL);
36 36
         }
37 37
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getAbstractClasses() {
73 73
         $result = array();
74
-        foreach($this->getClasses() as $class) {
75
-            if($class->isAbstract() ||$class instanceof ReflectedInterface) {
74
+        foreach ($this->getClasses() as $class) {
75
+            if ($class->isAbstract() || $class instanceof ReflectedInterface) {
76 76
                 array_push($result, $class);
77 77
             }
78 78
         }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function getAnonymousClasses() {
88 88
         $result = array();
89
-        foreach($this->getClasses() as $class) {
90
-            if($class instanceof ReflectedClass\ReflectedAnonymousClass) {
89
+        foreach ($this->getClasses() as $class) {
90
+            if ($class instanceof ReflectedClass\ReflectedAnonymousClass) {
91 91
                 array_push($result, $class);
92 92
             }
93 93
         }
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function getInterfaces() {
103 103
         $result = array();
104
-        foreach($this->getClasses() as $class) {
105
-            if($class instanceof ReflectedInterface) {
104
+        foreach ($this->getClasses() as $class) {
105
+            if ($class instanceof ReflectedInterface) {
106 106
                 array_push($result, $class);
107 107
             }
108 108
         }
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function getConcreteClasses() {
118 118
         $result = array();
119
-        foreach($this->getClasses() as $class) {
120
-            if(!$class->isAbstract() &&!$class instanceof ReflectedInterface  && !$class instanceof ReflectedClass\ReflectedAnonymousClass) {
119
+        foreach ($this->getClasses() as $class) {
120
+            if (!$class->isAbstract() && !$class instanceof ReflectedInterface && !$class instanceof ReflectedClass\ReflectedAnonymousClass) {
121 121
                 array_push($result, $class);
122 122
             }
123 123
         }
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Reflected/ReflectedClass.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     public function getDependencies()
137 137
     {
138 138
         $dependencies = array();
139
-        foreach($this->getMethods() as $method) {
139
+        foreach ($this->getMethods() as $method) {
140 140
             $dependencies = array_merge($dependencies, $method->getDependencies());
141 141
         }
142
-        foreach($dependencies as &$name) {
143
-            if(in_array($name, array('self', 'static'))) {
142
+        foreach ($dependencies as &$name) {
143
+            if (in_array($name, array('self', 'static'))) {
144 144
                 $name = $this->getFullname();
145 145
             }
146 146
             $name = $this->nameResolver->resolve($name, $this->namespace);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     public function getInterfaces()
208 208
     {
209 209
         $resolvedInterfaces = array();
210
-        foreach($this->interfaces as $interface) {
210
+        foreach ($this->interfaces as $interface) {
211 211
             array_push($resolvedInterfaces, $this->nameResolver->resolve($interface, $this->namespace));
212 212
         }
213 213
         return $resolvedInterfaces;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function getAnonymousClasses() {
232 232
         $result = array();
233
-        foreach($this->methods as $method) {
233
+        foreach ($this->methods as $method) {
234 234
             $result = array_merge($result, $method->getAnonymousClasses());
235 235
         }
236 236
         return $result;
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Reflected/ReflectedMethod.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
         // on read : compare with aliases. We cannot make it in pushDependency() => aliases aren't yet known
190 190
         $result = array();
191 191
         $resolver = new TypeResolver();
192
-        foreach($this->returns as $return) {
192
+        foreach ($this->returns as $return) {
193 193
             $type = $this->nameResolver->resolve($return->getType(), null);
194 194
 
195
-            if("\\" !== $type[0] &&!$resolver->isNative($type)) {
195
+            if ("\\" !== $type[0] && !$resolver->isNative($type)) {
196 196
                 $type = $this->namespace.'\\'.$type;
197 197
             }
198 198
 
@@ -233,21 +233,21 @@  discard block
 block discarded – undo
233 233
     {
234 234
         // on read : compare with aliases. We cannot make it in pushDependency() => aliases aren't yet known
235 235
         $dependencies = array();
236
-        foreach($this->dependencies as $name) {
236
+        foreach ($this->dependencies as $name) {
237 237
             array_push($dependencies, $this->nameResolver->resolve($name, null));
238 238
         }
239 239
 
240 240
         // returned values
241 241
         $resolver = new TypeResolver();
242
-        foreach($this->returns as $return) {
242
+        foreach ($this->returns as $return) {
243 243
             $name = $return->getType();
244
-            if(!$resolver->isNative($name)) {
244
+            if (!$resolver->isNative($name)) {
245 245
                 array_push($dependencies, $this->nameResolver->resolve($name, null));
246 246
             }
247 247
         }
248 248
 
249 249
         // anonymous classes in method (inner class)
250
-        foreach($this->anonymousClasses as $c) {
250
+        foreach ($this->anonymousClasses as $c) {
251 251
             array_push($dependencies, $c->getParent());
252 252
             $dependencies = array_merge($dependencies, $c->getDependencies());
253 253
         }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     public function getInstanciedClasses()
380 380
     {
381 381
         $classes = array();
382
-        foreach($this->instanciedClasses as $name) {
382
+        foreach ($this->instanciedClasses as $name) {
383 383
             array_push($classes, $this->nameResolver->resolve($name, null));
384 384
         }
385 385
         return $classes;
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     }
164 164
 
165 165
     /**
166
-     * @return TokenCollection
166
+     * @return \Hal\Component\Token\TokenCollection
167 167
      */
168 168
     public function getTokens()
169 169
     {
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     }
366 366
 
367 367
     /**
368
-     * @param $class
368
+     * @param string|null $class
369 369
      * @return $this
370 370
      */
371 371
     public function pushInstanciedClass($class) {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     }
387 387
 
388 388
     /**
389
-     * @param $call
389
+     * @param string $call
390 390
      * @return $this
391 391
      */
392 392
     public function pushInternalCall($call)
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
     }
405 405
 
406 406
     /**
407
-     * @param $call
407
+     * @param string $call
408 408
      * @return $this
409 409
      */
410 410
     public function pushExternalCall($call)
Please login to merge, or discard this patch.