@@ -62,40 +62,40 @@ |
||
62 | 62 | public function secondsProvider() |
63 | 63 | { |
64 | 64 | return array( |
65 | - array('0 ms', 0), |
|
66 | - array('1 ms', .001), |
|
67 | - array('10 ms', .01), |
|
68 | - array('100 ms', .1), |
|
69 | - array('999 ms', .999), |
|
70 | - array('1 second', .9999), |
|
71 | - array('1 second', 1), |
|
72 | - array('2 seconds', 2), |
|
73 | - array('59.9 seconds', 59.9), |
|
74 | - array('59.99 seconds', 59.99), |
|
75 | - array('59.99 seconds', 59.999), |
|
76 | - array('1 minute', 59.9999), |
|
77 | - array('59 seconds', 59.001), |
|
78 | - array('59.01 seconds', 59.01), |
|
79 | - array('1 minute', 60), |
|
80 | - array('1.01 minutes', 61), |
|
81 | - array('2 minutes', 120), |
|
82 | - array('2.01 minutes', 121), |
|
83 | - array('59.99 minutes', 3599.9), |
|
84 | - array('59.99 minutes', 3599.99), |
|
85 | - array('59.99 minutes', 3599.999), |
|
86 | - array('1 hour', 3599.9999), |
|
87 | - array('59.98 minutes', 3599.001), |
|
88 | - array('59.98 minutes', 3599.01), |
|
89 | - array('1 hour', 3600), |
|
90 | - array('1 hour', 3601), |
|
91 | - array('1 hour', 3601.9), |
|
92 | - array('1 hour', 3601.99), |
|
93 | - array('1 hour', 3601.999), |
|
94 | - array('1 hour', 3601.9999), |
|
95 | - array('1.01 hours', 3659.9999), |
|
96 | - array('1.01 hours', 3659.001), |
|
97 | - array('1.01 hours', 3659.01), |
|
98 | - array('2 hours', 7199.9999), |
|
65 | + array('0 ms', 0), |
|
66 | + array('1 ms', .001), |
|
67 | + array('10 ms', .01), |
|
68 | + array('100 ms', .1), |
|
69 | + array('999 ms', .999), |
|
70 | + array('1 second', .9999), |
|
71 | + array('1 second', 1), |
|
72 | + array('2 seconds', 2), |
|
73 | + array('59.9 seconds', 59.9), |
|
74 | + array('59.99 seconds', 59.99), |
|
75 | + array('59.99 seconds', 59.999), |
|
76 | + array('1 minute', 59.9999), |
|
77 | + array('59 seconds', 59.001), |
|
78 | + array('59.01 seconds', 59.01), |
|
79 | + array('1 minute', 60), |
|
80 | + array('1.01 minutes', 61), |
|
81 | + array('2 minutes', 120), |
|
82 | + array('2.01 minutes', 121), |
|
83 | + array('59.99 minutes', 3599.9), |
|
84 | + array('59.99 minutes', 3599.99), |
|
85 | + array('59.99 minutes', 3599.999), |
|
86 | + array('1 hour', 3599.9999), |
|
87 | + array('59.98 minutes', 3599.001), |
|
88 | + array('59.98 minutes', 3599.01), |
|
89 | + array('1 hour', 3600), |
|
90 | + array('1 hour', 3601), |
|
91 | + array('1 hour', 3601.9), |
|
92 | + array('1 hour', 3601.99), |
|
93 | + array('1 hour', 3601.999), |
|
94 | + array('1 hour', 3601.9999), |
|
95 | + array('1.01 hours', 3659.9999), |
|
96 | + array('1.01 hours', 3659.001), |
|
97 | + array('1.01 hours', 3659.01), |
|
98 | + array('2 hours', 7199.9999), |
|
99 | 99 | ); |
100 | 100 | } |
101 | 101 | } |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | { |
298 | 298 | if ($this->includes === null) { |
299 | 299 | $this->includes = array( |
300 | - 'require_once' => array(), |
|
301 | - 'require' => array(), |
|
302 | - 'include_once' => array(), |
|
303 | - 'include' => array() |
|
300 | + 'require_once' => array(), |
|
301 | + 'require' => array(), |
|
302 | + 'include_once' => array(), |
|
303 | + 'include' => array() |
|
304 | 304 | ); |
305 | 305 | |
306 | 306 | foreach ($this->tokens as $token) { |
@@ -369,29 +369,29 @@ discard block |
||
369 | 369 | $interfaceEndLine = $token->getEndLine(); |
370 | 370 | |
371 | 371 | $this->interfaces[$interface] = array( |
372 | - 'methods' => array(), |
|
373 | - 'parent' => $token->getParent(), |
|
374 | - 'keywords' => $token->getKeywords(), |
|
375 | - 'docblock' => $token->getDocblock(), |
|
376 | - 'startLine' => $token->getLine(), |
|
377 | - 'endLine' => $interfaceEndLine, |
|
378 | - 'package' => $token->getPackage(), |
|
379 | - 'file' => $this->filename |
|
372 | + 'methods' => array(), |
|
373 | + 'parent' => $token->getParent(), |
|
374 | + 'keywords' => $token->getKeywords(), |
|
375 | + 'docblock' => $token->getDocblock(), |
|
376 | + 'startLine' => $token->getLine(), |
|
377 | + 'endLine' => $interfaceEndLine, |
|
378 | + 'package' => $token->getPackage(), |
|
379 | + 'file' => $this->filename |
|
380 | 380 | ); |
381 | 381 | break; |
382 | 382 | |
383 | 383 | case 'PHP_Token_CLASS': |
384 | 384 | case 'PHP_Token_TRAIT': |
385 | 385 | $tmp = array( |
386 | - 'methods' => array(), |
|
387 | - 'parent' => $token->getParent(), |
|
388 | - 'interfaces'=> $token->getInterfaces(), |
|
389 | - 'keywords' => $token->getKeywords(), |
|
390 | - 'docblock' => $token->getDocblock(), |
|
391 | - 'startLine' => $token->getLine(), |
|
392 | - 'endLine' => $token->getEndLine(), |
|
393 | - 'package' => $token->getPackage(), |
|
394 | - 'file' => $this->filename |
|
386 | + 'methods' => array(), |
|
387 | + 'parent' => $token->getParent(), |
|
388 | + 'interfaces'=> $token->getInterfaces(), |
|
389 | + 'keywords' => $token->getKeywords(), |
|
390 | + 'docblock' => $token->getDocblock(), |
|
391 | + 'startLine' => $token->getLine(), |
|
392 | + 'endLine' => $token->getEndLine(), |
|
393 | + 'package' => $token->getPackage(), |
|
394 | + 'file' => $this->filename |
|
395 | 395 | ); |
396 | 396 | |
397 | 397 | if ($token instanceof PHP_Token_CLASS) { |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | case 'PHP_Token_FUNCTION': |
412 | 412 | $name = $token->getName(); |
413 | 413 | $tmp = array( |
414 | - 'docblock' => $token->getDocblock(), |
|
415 | - 'keywords' => $token->getKeywords(), |
|
416 | - 'visibility'=> $token->getVisibility(), |
|
417 | - 'signature' => $token->getSignature(), |
|
418 | - 'startLine' => $token->getLine(), |
|
419 | - 'endLine' => $token->getEndLine(), |
|
420 | - 'ccn' => $token->getCCN(), |
|
421 | - 'file' => $this->filename |
|
414 | + 'docblock' => $token->getDocblock(), |
|
415 | + 'keywords' => $token->getKeywords(), |
|
416 | + 'visibility'=> $token->getVisibility(), |
|
417 | + 'signature' => $token->getSignature(), |
|
418 | + 'startLine' => $token->getLine(), |
|
419 | + 'endLine' => $token->getEndLine(), |
|
420 | + 'ccn' => $token->getCCN(), |
|
421 | + 'file' => $this->filename |
|
422 | 422 | ); |
423 | 423 | |
424 | 424 | if (empty($class) && |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | $class[] = $token->getName(); |
399 | 399 | $classEndLine[] = $token->getEndLine(); |
400 | 400 | |
401 | - if ($class[count($class)-1] != 'anonymous class') { |
|
402 | - $this->classes[$class[count($class)-1]] = $tmp; |
|
401 | + if ($class[count($class) - 1] != 'anonymous class') { |
|
402 | + $this->classes[$class[count($class) - 1]] = $tmp; |
|
403 | 403 | } |
404 | 404 | } else { |
405 | 405 | $trait = $token->getName(); |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | $tmp['startLine'], |
432 | 432 | $tmp['endLine'] |
433 | 433 | ); |
434 | - } elseif (!empty($class) && $class[count($class)-1] != 'anonymous class') { |
|
435 | - $this->classes[$class[count($class)-1]]['methods'][$name] = $tmp; |
|
434 | + } elseif (!empty($class) && $class[count($class) - 1] != 'anonymous class') { |
|
435 | + $this->classes[$class[count($class) - 1]]['methods'][$name] = $tmp; |
|
436 | 436 | |
437 | 437 | $this->addFunctionToMap( |
438 | - $class[count($class)-1] . '::' . $name, |
|
438 | + $class[count($class) - 1] . '::' . $name, |
|
439 | 439 | $tmp['startLine'], |
440 | 440 | $tmp['endLine'] |
441 | 441 | ); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | |
455 | 455 | case 'PHP_Token_CLOSE_CURLY': |
456 | 456 | if (!empty($classEndLine) && |
457 | - $classEndLine[count($classEndLine)-1] == $token->getLine()) { |
|
457 | + $classEndLine[count($classEndLine) - 1] == $token->getLine()) { |
|
458 | 458 | array_pop($classEndLine); |
459 | 459 | array_pop($class); |
460 | 460 | } elseif ($traitEndLine !== false && |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | $this->assertEquals(array(), $this->functions[0]->getArguments()); |
44 | 44 | |
45 | 45 | $this->assertEquals( |
46 | - array('$baz' => 'Baz'), $this->functions[1]->getArguments() |
|
46 | + array('$baz' => 'Baz'), $this->functions[1]->getArguments() |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | $this->assertEquals( |
50 | - array('$foobar' => 'Foobar'), $this->functions[2]->getArguments() |
|
50 | + array('$foobar' => 'Foobar'), $this->functions[2]->getArguments() |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | $this->assertEquals( |
54 | - array('$barfoo' => 'Barfoo'), $this->functions[3]->getArguments() |
|
54 | + array('$barfoo' => 'Barfoo'), $this->functions[3]->getArguments() |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 | $this->assertEquals(array(), $this->functions[4]->getArguments()); |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | $this->assertNull($this->functions[0]->getDocblock()); |
104 | 104 | |
105 | 105 | $this->assertEquals( |
106 | - "/**\n * @param Baz \$baz\n */", |
|
107 | - $this->functions[1]->getDocblock() |
|
106 | + "/**\n * @param Baz \$baz\n */", |
|
107 | + $this->functions[1]->getDocblock() |
|
108 | 108 | ); |
109 | 109 | |
110 | 110 | $this->assertEquals( |
111 | - "/**\n * @param Foobar \$foobar\n */", |
|
112 | - $this->functions[2]->getDocblock() |
|
111 | + "/**\n * @param Foobar \$foobar\n */", |
|
112 | + $this->functions[2]->getDocblock() |
|
113 | 113 | ); |
114 | 114 | |
115 | 115 | $this->assertNull($this->functions[3]->getDocblock()); |
@@ -124,23 +124,23 @@ discard block |
||
124 | 124 | $i = $ts->getInterfaces(); |
125 | 125 | |
126 | 126 | $this->assertEquals( |
127 | - 'foo($a, array $b, array $c = array())', |
|
128 | - $f['foo']['signature'] |
|
127 | + 'foo($a, array $b, array $c = array())', |
|
128 | + $f['foo']['signature'] |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $this->assertEquals( |
132 | - 'm($a, array $b, array $c = array())', |
|
133 | - $c['c']['methods']['m']['signature'] |
|
132 | + 'm($a, array $b, array $c = array())', |
|
133 | + $c['c']['methods']['m']['signature'] |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | $this->assertEquals( |
137 | - 'm($a, array $b, array $c = array())', |
|
138 | - $c['a']['methods']['m']['signature'] |
|
137 | + 'm($a, array $b, array $c = array())', |
|
138 | + $c['a']['methods']['m']['signature'] |
|
139 | 139 | ); |
140 | 140 | |
141 | 141 | $this->assertEquals( |
142 | - 'm($a, array $b, array $c = array())', |
|
143 | - $i['i']['methods']['m']['signature'] |
|
142 | + 'm($a, array $b, array $c = array())', |
|
143 | + $i['i']['methods']['m']['signature'] |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | } |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | public function testGetIncludes() |
38 | 38 | { |
39 | 39 | $this->assertSame( |
40 | - array('test4.php', 'test3.php', 'test2.php', 'test1.php'), |
|
41 | - $this->ts->getIncludes() |
|
40 | + array('test4.php', 'test3.php', 'test2.php', 'test1.php'), |
|
41 | + $this->ts->getIncludes() |
|
42 | 42 | ); |
43 | 43 | } |
44 | 44 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | public function testGetIncludesCategorized() |
50 | 50 | { |
51 | 51 | $this->assertSame( |
52 | - array( |
|
52 | + array( |
|
53 | 53 | 'require_once' => array('test4.php'), |
54 | 54 | 'require' => array('test3.php'), |
55 | 55 | 'include_once' => array('test2.php'), |
56 | 56 | 'include' => array('test1.php') |
57 | - ), |
|
58 | - $this->ts->getIncludes(TRUE) |
|
57 | + ), |
|
58 | + $this->ts->getIncludes(TRUE) |
|
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | public function testGetIncludesCategory() |
67 | 67 | { |
68 | 68 | $this->assertSame( |
69 | - array('test4.php'), |
|
70 | - $this->ts->getIncludes(TRUE, 'require_once') |
|
69 | + array('test4.php'), |
|
70 | + $this->ts->getIncludes(TRUE, 'require_once') |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | } |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function testGetPackageNamespace() { |
118 | 118 | $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); |
119 | - foreach($tokenStream as $token) { |
|
120 | - if($token instanceOf PHP_Token_INTERFACE) { |
|
119 | + foreach ($tokenStream as $token) { |
|
120 | + if ($token instanceOf PHP_Token_INTERFACE) { |
|
121 | 121 | $package = $token->getPackage(); |
122 | 122 | $this->assertSame('Foo\\Bar', $package['namespace']); |
123 | 123 | } |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath) { |
140 | 140 | $tokenStream = new PHP_Token_Stream($filepath); |
141 | 141 | $firstClassFound = false; |
142 | - foreach($tokenStream as $token) { |
|
143 | - if($firstClassFound === false && $token instanceOf PHP_Token_INTERFACE) { |
|
142 | + foreach ($tokenStream as $token) { |
|
143 | + if ($firstClassFound === false && $token instanceOf PHP_Token_INTERFACE) { |
|
144 | 144 | $package = $token->getPackage(); |
145 | 145 | $this->assertSame('TestClassInBar', $token->getName()); |
146 | 146 | $this->assertSame('Foo\\Bar', $package['namespace']); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | // Secound class |
151 | - if($token instanceOf PHP_Token_INTERFACE) { |
|
151 | + if ($token instanceOf PHP_Token_INTERFACE) { |
|
152 | 152 | $package = $token->getPackage(); |
153 | 153 | $this->assertSame('TestClassInBaz', $token->getName()); |
154 | 154 | $this->assertSame('Foo\\Baz', $package['namespace']); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces() { |
162 | - foreach($this->interfaces as $token) { |
|
162 | + foreach ($this->interfaces as $token) { |
|
163 | 163 | $package = $token->getPackage(); |
164 | 164 | $this->assertSame("", $package['namespace']); |
165 | 165 | } |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | public function testGetPackageNamespaceWhenExtentingFromNamespaceClass() { |
172 | 172 | $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classExtendsNamespacedClass.php'); |
173 | 173 | $firstClassFound = false; |
174 | - foreach($tokenStream as $token) { |
|
175 | - if($firstClassFound === false && $token instanceOf PHP_Token_INTERFACE) { |
|
174 | + foreach ($tokenStream as $token) { |
|
175 | + if ($firstClassFound === false && $token instanceOf PHP_Token_INTERFACE) { |
|
176 | 176 | $package = $token->getPackage(); |
177 | 177 | $this->assertSame('Baz', $token->getName()); |
178 | 178 | $this->assertSame('Foo\\Bar', $package['namespace']); |
179 | 179 | $firstClassFound = true; |
180 | 180 | continue; |
181 | 181 | } |
182 | - if($token instanceOf PHP_Token_INTERFACE) { |
|
182 | + if ($token instanceOf PHP_Token_INTERFACE) { |
|
183 | 183 | $package = $token->getPackage(); |
184 | 184 | $this->assertSame('Extender', $token->getName()); |
185 | 185 | $this->assertSame('Other\\Space', $package['namespace']); |
@@ -33,8 +33,7 @@ |
||
33 | 33 | foreach ($ts as $token) { |
34 | 34 | if ($token instanceof PHP_Token_CLASS) { |
35 | 35 | $this->class = $token; |
36 | - } |
|
37 | - elseif ($token instanceof PHP_Token_INTERFACE) { |
|
36 | + } elseif ($token instanceof PHP_Token_INTERFACE) { |
|
38 | 37 | $this->interfaces[$i] = $token; |
39 | 38 | $i++; |
40 | 39 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function testGetName() |
29 | 29 | { |
30 | 30 | $tokenStream = new PHP_Token_Stream( |
31 | - TEST_FILES_PATH . 'classInNamespace.php' |
|
31 | + TEST_FILES_PATH . 'classInNamespace.php' |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | foreach ($tokenStream as $token) { |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | public function testGetStartLineWithUnscopedNamespace() |
42 | 42 | { |
43 | 43 | $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); |
44 | - foreach($tokenStream as $token) { |
|
45 | - if($token instanceOf PHP_Token_NAMESPACE) { |
|
44 | + foreach ($tokenStream as $token) { |
|
45 | + if ($token instanceOf PHP_Token_NAMESPACE) { |
|
46 | 46 | $this->assertSame(2, $token->getLine()); |
47 | 47 | } |
48 | 48 | } |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | public function testGetEndLineWithUnscopedNamespace() |
52 | 52 | { |
53 | 53 | $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); |
54 | - foreach($tokenStream as $token) { |
|
55 | - if($token instanceOf PHP_Token_NAMESPACE) { |
|
54 | + foreach ($tokenStream as $token) { |
|
55 | + if ($token instanceOf PHP_Token_NAMESPACE) { |
|
56 | 56 | $this->assertSame(2, $token->getEndLine()); |
57 | 57 | } |
58 | 58 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | public function testGetStartLineWithScopedNamespace() |
61 | 61 | { |
62 | 62 | $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php'); |
63 | - foreach($tokenStream as $token) { |
|
64 | - if($token instanceOf PHP_Token_NAMESPACE) { |
|
63 | + foreach ($tokenStream as $token) { |
|
64 | + if ($token instanceOf PHP_Token_NAMESPACE) { |
|
65 | 65 | $this->assertSame(2, $token->getLine()); |
66 | 66 | } |
67 | 67 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | public function testGetEndLineWithScopedNamespace() |
71 | 71 | { |
72 | 72 | $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php'); |
73 | - foreach($tokenStream as $token) { |
|
74 | - if($token instanceOf PHP_Token_NAMESPACE) { |
|
73 | + foreach ($tokenStream as $token) { |
|
74 | + if ($token instanceOf PHP_Token_NAMESPACE) { |
|
75 | 75 | $this->assertSame(8, $token->getEndLine()); |
76 | 76 | } |
77 | 77 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | public function method() |
8 | 8 | { |
9 | 9 | $o = new class { public function foo() {} }; |
10 | - $o = new class{public function foo(){}}; |
|
10 | + $o = new class{public function foo() {}}; |
|
11 | 11 | $o = new class extends stdClass {}; |
12 | 12 | $o = new class extends stdClass {}; |
13 | 13 | $o = new class implements foo {}; |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | class Test { |
3 | - public function methodOne() { |
|
4 | - $foo = new class { |
|
5 | - public function method_in_anonymous_class() { |
|
6 | - return true; |
|
7 | - } |
|
8 | - }; |
|
3 | + public function methodOne() { |
|
4 | + $foo = new class { |
|
5 | + public function method_in_anonymous_class() { |
|
6 | + return true; |
|
7 | + } |
|
8 | + }; |
|
9 | 9 | |
10 | - return $foo->method_in_anonymous_class(); |
|
11 | - } |
|
10 | + return $foo->method_in_anonymous_class(); |
|
11 | + } |
|
12 | 12 | |
13 | - public function methodTwo() { |
|
14 | - return false; |
|
15 | - } |
|
13 | + public function methodTwo() { |
|
14 | + return false; |
|
15 | + } |
|
16 | 16 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | $function1 = function($foo, $bar) use ($var) {}; |
3 | 3 | $function2 = function(Foo $foo, $bar) use ($var) {}; |
4 | -$function3 = function ($foo, $bar, $baz) {}; |
|
5 | -$function4 = function (Foo $foo, $bar, $baz) {}; |
|
6 | -$function5 = function () {}; |
|
4 | +$function3 = function($foo, $bar, $baz) {}; |
|
5 | +$function4 = function(Foo $foo, $bar, $baz) {}; |
|
6 | +$function5 = function() {}; |
|
7 | 7 | $function6 = function() {}; |