Completed
Pull Request — develop (#1492)
by Zack
28:58 queued 09:00
created
squizlabs/php_codesniffer/tests/Core/File/FindExtendedClassNameTest.php 3 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -17,130 +17,130 @@
 block discarded – undo
17 17
 class FindExtendedClassNameTest extends TestCase
18 18
 {
19 19
 
20
-    /**
21
-     * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
-     *
23
-     * @var \PHP_CodeSniffer\Files\File
24
-     */
25
-    private $phpcsFile;
26
-
27
-
28
-    /**
29
-     * Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
30
-     *
31
-     * Methods used for these tests can be found in a test case file in the same
32
-     * directory and with the same name, using the .inc extension.
33
-     *
34
-     * @return void
35
-     */
36
-    public function setUp()
37
-    {
38
-        $config            = new Config();
39
-        $config->standards = ['Generic'];
40
-
41
-        $ruleset = new Ruleset($config);
42
-
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
-        $this->phpcsFile->process();
46
-
47
-    }//end setUp()
48
-
49
-
50
-    /**
51
-     * Clean up after finished test.
52
-     *
53
-     * @return void
54
-     */
55
-    public function tearDown()
56
-    {
57
-        unset($this->phpcsFile);
58
-
59
-    }//end tearDown()
60
-
61
-
62
-    /**
63
-     * Test retrieving the name of the class being extended by another class
64
-     * (or interface).
65
-     *
66
-     * @param string $identifier Comment which precedes the test case.
67
-     * @param bool   $expected   Expected function output.
68
-     *
69
-     * @dataProvider dataExtendedClass
70
-     *
71
-     * @return void
72
-     */
73
-    public function testFindExtendedClassName($identifier, $expected)
74
-    {
75
-        $start   = ($this->phpcsFile->numTokens - 1);
76
-        $delim   = $this->phpcsFile->findPrevious(
77
-            T_COMMENT,
78
-            $start,
79
-            null,
80
-            false,
81
-            $identifier
82
-        );
83
-        $OOToken = $this->phpcsFile->findNext([T_CLASS, T_ANON_CLASS, T_INTERFACE], ($delim + 1));
84
-
85
-        $result = $this->phpcsFile->findExtendedClassName($OOToken);
86
-        $this->assertSame($expected, $result);
87
-
88
-    }//end testFindExtendedClassName()
89
-
90
-
91
-    /**
92
-     * Data provider for the FindExtendedClassName test.
93
-     *
94
-     * @see testFindExtendedClassName()
95
-     *
96
-     * @return array
97
-     */
98
-    public function dataExtendedClass()
99
-    {
100
-        return [
101
-            [
102
-                '/* testExtendedClass */',
103
-                'testFECNClass',
104
-            ],
105
-            [
106
-                '/* testNamespacedClass */',
107
-                '\PHP_CodeSniffer\Tests\Core\File\testFECNClass',
108
-            ],
109
-            [
110
-                '/* testNonExtendedClass */',
111
-                false,
112
-            ],
113
-            [
114
-                '/* testInterface */',
115
-                false,
116
-            ],
117
-            [
118
-                '/* testInterfaceThatExtendsInterface */',
119
-                'testFECNInterface',
120
-            ],
121
-            [
122
-                '/* testInterfaceThatExtendsFQCNInterface */',
123
-                '\PHP_CodeSniffer\Tests\Core\File\testFECNInterface',
124
-            ],
125
-            [
126
-                '/* testNestedExtendedClass */',
127
-                false,
128
-            ],
129
-            [
130
-                '/* testNestedExtendedAnonClass */',
131
-                'testFECNAnonClass',
132
-            ],
133
-            [
134
-                '/* testClassThatExtendsAndImplements */',
135
-                'testFECNClass',
136
-            ],
137
-            [
138
-                '/* testClassThatImplementsAndExtends */',
139
-                'testFECNClass',
140
-            ],
141
-        ];
142
-
143
-    }//end dataExtendedClass()
20
+	/**
21
+	 * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
+	 *
23
+	 * @var \PHP_CodeSniffer\Files\File
24
+	 */
25
+	private $phpcsFile;
26
+
27
+
28
+	/**
29
+	 * Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
30
+	 *
31
+	 * Methods used for these tests can be found in a test case file in the same
32
+	 * directory and with the same name, using the .inc extension.
33
+	 *
34
+	 * @return void
35
+	 */
36
+	public function setUp()
37
+	{
38
+		$config            = new Config();
39
+		$config->standards = ['Generic'];
40
+
41
+		$ruleset = new Ruleset($config);
42
+
43
+		$pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
+		$this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
+		$this->phpcsFile->process();
46
+
47
+	}//end setUp()
48
+
49
+
50
+	/**
51
+	 * Clean up after finished test.
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function tearDown()
56
+	{
57
+		unset($this->phpcsFile);
58
+
59
+	}//end tearDown()
60
+
61
+
62
+	/**
63
+	 * Test retrieving the name of the class being extended by another class
64
+	 * (or interface).
65
+	 *
66
+	 * @param string $identifier Comment which precedes the test case.
67
+	 * @param bool   $expected   Expected function output.
68
+	 *
69
+	 * @dataProvider dataExtendedClass
70
+	 *
71
+	 * @return void
72
+	 */
73
+	public function testFindExtendedClassName($identifier, $expected)
74
+	{
75
+		$start   = ($this->phpcsFile->numTokens - 1);
76
+		$delim   = $this->phpcsFile->findPrevious(
77
+			T_COMMENT,
78
+			$start,
79
+			null,
80
+			false,
81
+			$identifier
82
+		);
83
+		$OOToken = $this->phpcsFile->findNext([T_CLASS, T_ANON_CLASS, T_INTERFACE], ($delim + 1));
84
+
85
+		$result = $this->phpcsFile->findExtendedClassName($OOToken);
86
+		$this->assertSame($expected, $result);
87
+
88
+	}//end testFindExtendedClassName()
89
+
90
+
91
+	/**
92
+	 * Data provider for the FindExtendedClassName test.
93
+	 *
94
+	 * @see testFindExtendedClassName()
95
+	 *
96
+	 * @return array
97
+	 */
98
+	public function dataExtendedClass()
99
+	{
100
+		return [
101
+			[
102
+				'/* testExtendedClass */',
103
+				'testFECNClass',
104
+			],
105
+			[
106
+				'/* testNamespacedClass */',
107
+				'\PHP_CodeSniffer\Tests\Core\File\testFECNClass',
108
+			],
109
+			[
110
+				'/* testNonExtendedClass */',
111
+				false,
112
+			],
113
+			[
114
+				'/* testInterface */',
115
+				false,
116
+			],
117
+			[
118
+				'/* testInterfaceThatExtendsInterface */',
119
+				'testFECNInterface',
120
+			],
121
+			[
122
+				'/* testInterfaceThatExtendsFQCNInterface */',
123
+				'\PHP_CodeSniffer\Tests\Core\File\testFECNInterface',
124
+			],
125
+			[
126
+				'/* testNestedExtendedClass */',
127
+				false,
128
+			],
129
+			[
130
+				'/* testNestedExtendedAnonClass */',
131
+				'testFECNAnonClass',
132
+			],
133
+			[
134
+				'/* testClassThatExtendsAndImplements */',
135
+				'testFECNClass',
136
+			],
137
+			[
138
+				'/* testClassThatImplementsAndExtends */',
139
+				'testFECNClass',
140
+			],
141
+		];
142
+
143
+	}//end dataExtendedClass()
144 144
 
145 145
 
146 146
 }//end class
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
     public function setUp()
37 37
     {
38 38
         $config            = new Config();
39
-        $config->standards = ['Generic'];
39
+        $config->standards = [ 'Generic' ];
40 40
 
41
-        $ruleset = new Ruleset($config);
41
+        $ruleset = new Ruleset( $config );
42 42
 
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
43
+        $pathToTestFile  = dirname( __FILE__ ) . '/' . basename( __FILE__, '.php' ) . '.inc';
44
+        $this->phpcsFile = new DummyFile( file_get_contents( $pathToTestFile ), $ruleset, $config );
45 45
         $this->phpcsFile->process();
46 46
 
47 47
     }//end setUp()
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function tearDown()
56 56
     {
57
-        unset($this->phpcsFile);
57
+        unset( $this->phpcsFile );
58 58
 
59 59
     }//end tearDown()
60 60
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return void
72 72
      */
73
-    public function testFindExtendedClassName($identifier, $expected)
73
+    public function testFindExtendedClassName( $identifier, $expected )
74 74
     {
75
-        $start   = ($this->phpcsFile->numTokens - 1);
75
+        $start   = ( $this->phpcsFile->numTokens - 1 );
76 76
         $delim   = $this->phpcsFile->findPrevious(
77 77
             T_COMMENT,
78 78
             $start,
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
             false,
81 81
             $identifier
82 82
         );
83
-        $OOToken = $this->phpcsFile->findNext([T_CLASS, T_ANON_CLASS, T_INTERFACE], ($delim + 1));
83
+        $OOToken = $this->phpcsFile->findNext( [ T_CLASS, T_ANON_CLASS, T_INTERFACE ], ( $delim + 1 ) );
84 84
 
85
-        $result = $this->phpcsFile->findExtendedClassName($OOToken);
86
-        $this->assertSame($expected, $result);
85
+        $result = $this->phpcsFile->findExtendedClassName( $OOToken );
86
+        $this->assertSame( $expected, $result );
87 87
 
88 88
     }//end testFindExtendedClassName()
89 89
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use PHP_CodeSniffer\Files\DummyFile;
15 15
 use PHPUnit\Framework\TestCase;
16 16
 
17
-class FindExtendedClassNameTest extends TestCase
18
-{
17
+class FindExtendedClassNameTest extends TestCase {
19 18
 
20 19
     /**
21 20
      * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return void
35 34
      */
36
-    public function setUp()
37
-    {
35
+    public function setUp() {
38 36
         $config            = new Config();
39 37
         $config->standards = ['Generic'];
40 38
 
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      *
53 51
      * @return void
54 52
      */
55
-    public function tearDown()
56
-    {
53
+    public function tearDown() {
57 54
         unset($this->phpcsFile);
58 55
 
59 56
     }//end tearDown()
@@ -70,8 +67,7 @@  discard block
 block discarded – undo
70 67
      *
71 68
      * @return void
72 69
      */
73
-    public function testFindExtendedClassName($identifier, $expected)
74
-    {
70
+    public function testFindExtendedClassName($identifier, $expected) {
75 71
         $start   = ($this->phpcsFile->numTokens - 1);
76 72
         $delim   = $this->phpcsFile->findPrevious(
77 73
             T_COMMENT,
@@ -95,8 +91,7 @@  discard block
 block discarded – undo
95 91
      *
96 92
      * @return array
97 93
      */
98
-    public function dataExtendedClass()
99
-    {
94
+    public function dataExtendedClass() {
100 95
         return [
101 96
             [
102 97
                 '/* testExtendedClass */',
Please login to merge, or discard this patch.
php_codesniffer/tests/Core/File/FindImplementedInterfaceNamesTest.php 3 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -17,126 +17,126 @@
 block discarded – undo
17 17
 class FindImplementedInterfaceNamesTest extends TestCase
18 18
 {
19 19
 
20
-    /**
21
-     * The \PHP_CodeSniffer\Files\File object containing parsed contents of the test case file.
22
-     *
23
-     * @var \PHP_CodeSniffer\Files\File
24
-     */
25
-    private $phpcsFile;
26
-
27
-
28
-    /**
29
-     * Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
30
-     *
31
-     * Methods used for these tests can be found in a test case file in the same
32
-     * directory and with the same name, using the .inc extension.
33
-     *
34
-     * @return void
35
-     */
36
-    public function setUp()
37
-    {
38
-        $config            = new Config();
39
-        $config->standards = ['Generic'];
40
-
41
-        $ruleset = new Ruleset($config);
42
-
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
-        $this->phpcsFile->process();
46
-
47
-    }//end setUp()
48
-
49
-
50
-    /**
51
-     * Clean up after finished test.
52
-     *
53
-     * @return void
54
-     */
55
-    public function tearDown()
56
-    {
57
-        unset($this->phpcsFile);
58
-
59
-    }//end tearDown()
60
-
61
-
62
-    /**
63
-     * Test retrieving the name(s) of the interfaces being implemented by a class.
64
-     *
65
-     * @param string $identifier Comment which precedes the test case.
66
-     * @param bool   $expected   Expected function output.
67
-     *
68
-     * @dataProvider dataImplementedInterface
69
-     *
70
-     * @return void
71
-     */
72
-    public function testFindImplementedInterfaceNames($identifier, $expected)
73
-    {
74
-        $start   = ($this->phpcsFile->numTokens - 1);
75
-        $delim   = $this->phpcsFile->findPrevious(
76
-            T_COMMENT,
77
-            $start,
78
-            null,
79
-            false,
80
-            $identifier
81
-        );
82
-        $OOToken = $this->phpcsFile->findNext([T_CLASS, T_ANON_CLASS, T_INTERFACE], ($delim + 1));
83
-
84
-        $result = $this->phpcsFile->findImplementedInterfaceNames($OOToken);
85
-        $this->assertSame($expected, $result);
86
-
87
-    }//end testFindImplementedInterfaceNames()
88
-
89
-
90
-    /**
91
-     * Data provider for the FindImplementedInterfaceNames test.
92
-     *
93
-     * @see testFindImplementedInterfaceNames()
94
-     *
95
-     * @return array
96
-     */
97
-    public function dataImplementedInterface()
98
-    {
99
-        return [
100
-            [
101
-                '/* testImplementedClass */',
102
-                ['testFIINInterface'],
103
-            ],
104
-            [
105
-                '/* testMultiImplementedClass */',
106
-                [
107
-                    'testFIINInterface',
108
-                    'testFIINInterface2',
109
-                ],
110
-            ],
111
-            [
112
-                '/* testNamespacedClass */',
113
-                ['\PHP_CodeSniffer\Tests\Core\File\testFIINInterface'],
114
-            ],
115
-            [
116
-                '/* testNonImplementedClass */',
117
-                false,
118
-            ],
119
-            [
120
-                '/* testInterface */',
121
-                false,
122
-            ],
123
-            [
124
-                '/* testClassThatExtendsAndImplements */',
125
-                [
126
-                    'InterfaceA',
127
-                    '\NameSpaced\Cat\InterfaceB',
128
-                ],
129
-            ],
130
-            [
131
-                '/* testClassThatImplementsAndExtends */',
132
-                [
133
-                    '\InterfaceA',
134
-                    'InterfaceB',
135
-                ],
136
-            ],
137
-        ];
138
-
139
-    }//end dataImplementedInterface()
20
+	/**
21
+	 * The \PHP_CodeSniffer\Files\File object containing parsed contents of the test case file.
22
+	 *
23
+	 * @var \PHP_CodeSniffer\Files\File
24
+	 */
25
+	private $phpcsFile;
26
+
27
+
28
+	/**
29
+	 * Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
30
+	 *
31
+	 * Methods used for these tests can be found in a test case file in the same
32
+	 * directory and with the same name, using the .inc extension.
33
+	 *
34
+	 * @return void
35
+	 */
36
+	public function setUp()
37
+	{
38
+		$config            = new Config();
39
+		$config->standards = ['Generic'];
40
+
41
+		$ruleset = new Ruleset($config);
42
+
43
+		$pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
+		$this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
+		$this->phpcsFile->process();
46
+
47
+	}//end setUp()
48
+
49
+
50
+	/**
51
+	 * Clean up after finished test.
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function tearDown()
56
+	{
57
+		unset($this->phpcsFile);
58
+
59
+	}//end tearDown()
60
+
61
+
62
+	/**
63
+	 * Test retrieving the name(s) of the interfaces being implemented by a class.
64
+	 *
65
+	 * @param string $identifier Comment which precedes the test case.
66
+	 * @param bool   $expected   Expected function output.
67
+	 *
68
+	 * @dataProvider dataImplementedInterface
69
+	 *
70
+	 * @return void
71
+	 */
72
+	public function testFindImplementedInterfaceNames($identifier, $expected)
73
+	{
74
+		$start   = ($this->phpcsFile->numTokens - 1);
75
+		$delim   = $this->phpcsFile->findPrevious(
76
+			T_COMMENT,
77
+			$start,
78
+			null,
79
+			false,
80
+			$identifier
81
+		);
82
+		$OOToken = $this->phpcsFile->findNext([T_CLASS, T_ANON_CLASS, T_INTERFACE], ($delim + 1));
83
+
84
+		$result = $this->phpcsFile->findImplementedInterfaceNames($OOToken);
85
+		$this->assertSame($expected, $result);
86
+
87
+	}//end testFindImplementedInterfaceNames()
88
+
89
+
90
+	/**
91
+	 * Data provider for the FindImplementedInterfaceNames test.
92
+	 *
93
+	 * @see testFindImplementedInterfaceNames()
94
+	 *
95
+	 * @return array
96
+	 */
97
+	public function dataImplementedInterface()
98
+	{
99
+		return [
100
+			[
101
+				'/* testImplementedClass */',
102
+				['testFIINInterface'],
103
+			],
104
+			[
105
+				'/* testMultiImplementedClass */',
106
+				[
107
+					'testFIINInterface',
108
+					'testFIINInterface2',
109
+				],
110
+			],
111
+			[
112
+				'/* testNamespacedClass */',
113
+				['\PHP_CodeSniffer\Tests\Core\File\testFIINInterface'],
114
+			],
115
+			[
116
+				'/* testNonImplementedClass */',
117
+				false,
118
+			],
119
+			[
120
+				'/* testInterface */',
121
+				false,
122
+			],
123
+			[
124
+				'/* testClassThatExtendsAndImplements */',
125
+				[
126
+					'InterfaceA',
127
+					'\NameSpaced\Cat\InterfaceB',
128
+				],
129
+			],
130
+			[
131
+				'/* testClassThatImplementsAndExtends */',
132
+				[
133
+					'\InterfaceA',
134
+					'InterfaceB',
135
+				],
136
+			],
137
+		];
138
+
139
+	}//end dataImplementedInterface()
140 140
 
141 141
 
142 142
 }//end class
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
     public function setUp()
37 37
     {
38 38
         $config            = new Config();
39
-        $config->standards = ['Generic'];
39
+        $config->standards = [ 'Generic' ];
40 40
 
41
-        $ruleset = new Ruleset($config);
41
+        $ruleset = new Ruleset( $config );
42 42
 
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
43
+        $pathToTestFile  = dirname( __FILE__ ) . '/' . basename( __FILE__, '.php' ) . '.inc';
44
+        $this->phpcsFile = new DummyFile( file_get_contents( $pathToTestFile ), $ruleset, $config );
45 45
         $this->phpcsFile->process();
46 46
 
47 47
     }//end setUp()
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function tearDown()
56 56
     {
57
-        unset($this->phpcsFile);
57
+        unset( $this->phpcsFile );
58 58
 
59 59
     }//end tearDown()
60 60
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return void
71 71
      */
72
-    public function testFindImplementedInterfaceNames($identifier, $expected)
72
+    public function testFindImplementedInterfaceNames( $identifier, $expected )
73 73
     {
74
-        $start   = ($this->phpcsFile->numTokens - 1);
74
+        $start   = ( $this->phpcsFile->numTokens - 1 );
75 75
         $delim   = $this->phpcsFile->findPrevious(
76 76
             T_COMMENT,
77 77
             $start,
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
             false,
80 80
             $identifier
81 81
         );
82
-        $OOToken = $this->phpcsFile->findNext([T_CLASS, T_ANON_CLASS, T_INTERFACE], ($delim + 1));
82
+        $OOToken = $this->phpcsFile->findNext( [ T_CLASS, T_ANON_CLASS, T_INTERFACE ], ( $delim + 1 ) );
83 83
 
84
-        $result = $this->phpcsFile->findImplementedInterfaceNames($OOToken);
85
-        $this->assertSame($expected, $result);
84
+        $result = $this->phpcsFile->findImplementedInterfaceNames( $OOToken );
85
+        $this->assertSame( $expected, $result );
86 86
 
87 87
     }//end testFindImplementedInterfaceNames()
88 88
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         return [
100 100
             [
101 101
                 '/* testImplementedClass */',
102
-                ['testFIINInterface'],
102
+                [ 'testFIINInterface' ],
103 103
             ],
104 104
             [
105 105
                 '/* testMultiImplementedClass */',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             ],
111 111
             [
112 112
                 '/* testNamespacedClass */',
113
-                ['\PHP_CodeSniffer\Tests\Core\File\testFIINInterface'],
113
+                [ '\PHP_CodeSniffer\Tests\Core\File\testFIINInterface' ],
114 114
             ],
115 115
             [
116 116
                 '/* testNonImplementedClass */',
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use PHP_CodeSniffer\Files\DummyFile;
15 15
 use PHPUnit\Framework\TestCase;
16 16
 
17
-class FindImplementedInterfaceNamesTest extends TestCase
18
-{
17
+class FindImplementedInterfaceNamesTest extends TestCase {
19 18
 
20 19
     /**
21 20
      * The \PHP_CodeSniffer\Files\File object containing parsed contents of the test case file.
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return void
35 34
      */
36
-    public function setUp()
37
-    {
35
+    public function setUp() {
38 36
         $config            = new Config();
39 37
         $config->standards = ['Generic'];
40 38
 
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      *
53 51
      * @return void
54 52
      */
55
-    public function tearDown()
56
-    {
53
+    public function tearDown() {
57 54
         unset($this->phpcsFile);
58 55
 
59 56
     }//end tearDown()
@@ -69,8 +66,7 @@  discard block
 block discarded – undo
69 66
      *
70 67
      * @return void
71 68
      */
72
-    public function testFindImplementedInterfaceNames($identifier, $expected)
73
-    {
69
+    public function testFindImplementedInterfaceNames($identifier, $expected) {
74 70
         $start   = ($this->phpcsFile->numTokens - 1);
75 71
         $delim   = $this->phpcsFile->findPrevious(
76 72
             T_COMMENT,
@@ -94,8 +90,7 @@  discard block
 block discarded – undo
94 90
      *
95 91
      * @return array
96 92
      */
97
-    public function dataImplementedInterface()
98
-    {
93
+    public function dataImplementedInterface() {
99 94
         return [
100 95
             [
101 96
                 '/* testImplementedClass */',
Please login to merge, or discard this patch.
squizlabs/php_codesniffer/tests/Core/File/GetMethodPropertiesTest.inc 3 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -6,56 +6,56 @@
 block discarded – undo
6 6
 /* testReturnFunction */
7 7
 function myFunction(array ...$arrays): array
8 8
 {
9
-    return array_map(/* testNestedClosure */function(array $array): int {
10
-        return array_sum($array);
11
-    }, $arrays);
9
+	return array_map(/* testNestedClosure */function(array $array): int {
10
+		return array_sum($array);
11
+	}, $arrays);
12 12
 }
13 13
 
14 14
 class MyClass {
15
-    /* testBasicMethod */
16
-    function myFunction() {}
15
+	/* testBasicMethod */
16
+	function myFunction() {}
17 17
 
18
-    /* testPrivateStaticMethod */
19
-    private static function myFunction() {}
18
+	/* testPrivateStaticMethod */
19
+	private static function myFunction() {}
20 20
 
21
-    /* testFinalMethod */
22
-    final public function myFunction() {}
21
+	/* testFinalMethod */
22
+	final public function myFunction() {}
23 23
 
24
-    /* testProtectedReturnMethod */
25
-    protected function myFunction() : int {}
24
+	/* testProtectedReturnMethod */
25
+	protected function myFunction() : int {}
26 26
 
27
-    /* testPublicReturnMethod */
28
-    public function myFunction(): array {}
27
+	/* testPublicReturnMethod */
28
+	public function myFunction(): array {}
29 29
 
30
-    /* testNullableReturnMethod */
31
-    public function myFunction(): ?array {}
30
+	/* testNullableReturnMethod */
31
+	public function myFunction(): ?array {}
32 32
 
33
-    /* testMessyNullableReturnMethod */
34
-    public function myFunction() /* comment
33
+	/* testMessyNullableReturnMethod */
34
+	public function myFunction() /* comment
35 35
         */ :  
36
-        /* comment */ ? //comment
37
-        array {}
36
+		/* comment */ ? //comment
37
+		array {}
38 38
 
39
-    /* testReturnNamespace */
40
-    function myFunction(): \MyNamespace\MyClass {}
39
+	/* testReturnNamespace */
40
+	function myFunction(): \MyNamespace\MyClass {}
41 41
 
42
-    /* testReturnMultilineNamespace */
43
-    function myFunction(): \MyNamespace /** comment *\/ comment */
44
-                           \MyClass /* comment */
45
-                           \Foo {}
42
+	/* testReturnMultilineNamespace */
43
+	function myFunction(): \MyNamespace /** comment *\/ comment */
44
+						   \MyClass /* comment */
45
+						   \Foo {}
46 46
 }
47 47
 
48 48
 abstract class MyClass
49 49
 {
50
-    /* testAbstractMethod */
51
-    abstract function myFunction();
50
+	/* testAbstractMethod */
51
+	abstract function myFunction();
52 52
 
53
-    /* testAbstractReturnMethod */
54
-    abstract protected function myFunction(): bool;
53
+	/* testAbstractReturnMethod */
54
+	abstract protected function myFunction(): bool;
55 55
 }
56 56
 
57 57
 interface MyInterface
58 58
 {
59
-    /* testInterfaceMethod */
60
-    function myFunction();
59
+	/* testInterfaceMethod */
60
+	function myFunction();
61 61
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 function myFunction() {}
5 5
 
6 6
 /* testReturnFunction */
7
-function myFunction(array ...$arrays): array
7
+function myFunction( array ...$arrays ): array
8 8
 {
9
-    return array_map(/* testNestedClosure */function(array $array): int {
10
-        return array_sum($array);
9
+    return array_map(/* testNestedClosure */function( array $array ): int {
10
+        return array_sum( $array );
11 11
     }, $arrays);
12 12
 }
13 13
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
                            \Foo {}
46 46
 }
47 47
 
48
-abstract class MyClass
49
-{
48
+abstract class MyClass {
50 49
     /* testAbstractMethod */
51 50
     abstract function myFunction();
52 51
 
@@ -54,8 +53,7 @@  discard block
 block discarded – undo
54 53
     abstract protected function myFunction(): bool;
55 54
 }
56 55
 
57
-interface MyInterface
58
-{
56
+interface MyInterface {
59 57
     /* testInterfaceMethod */
60 58
     function myFunction();
61 59
 }
Please login to merge, or discard this patch.
squizlabs/php_codesniffer/tests/Core/File/GetMethodParametersTest.php 3 patches
Indentation   +382 added lines, -382 removed lines patch added patch discarded remove patch
@@ -17,388 +17,388 @@
 block discarded – undo
17 17
 class GetMethodParametersTest extends TestCase
18 18
 {
19 19
 
20
-    /**
21
-     * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
-     *
23
-     * @var \PHP_CodeSniffer\Files\File
24
-     */
25
-    private $phpcsFile;
26
-
27
-
28
-    /**
29
-     * Initialize & tokenize PHP_CodeSniffer_File with code from the test case file.
30
-     *
31
-     * Methods used for these tests can be found in a test case file in the same
32
-     * directory and with the same name, using the .inc extension.
33
-     *
34
-     * @return void
35
-     */
36
-    public function setUp()
37
-    {
38
-        $config            = new Config();
39
-        $config->standards = ['Generic'];
40
-
41
-        $ruleset = new Ruleset($config);
42
-
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
-        $this->phpcsFile->process();
46
-
47
-    }//end setUp()
48
-
49
-
50
-    /**
51
-     * Clean up after finished test.
52
-     *
53
-     * @return void
54
-     */
55
-    public function tearDown()
56
-    {
57
-        unset($this->phpcsFile);
58
-
59
-    }//end tearDown()
60
-
61
-
62
-    /**
63
-     * Verify pass-by-reference parsing.
64
-     *
65
-     * @return void
66
-     */
67
-    public function testPassByReference()
68
-    {
69
-        $expected    = [];
70
-        $expected[0] = [
71
-            'name'              => '$var',
72
-            'content'           => '&$var',
73
-            'pass_by_reference' => true,
74
-            'variable_length'   => false,
75
-            'type_hint'         => '',
76
-            'nullable_type'     => false,
77
-        ];
78
-
79
-        $start    = ($this->phpcsFile->numTokens - 1);
80
-        $function = $this->phpcsFile->findPrevious(
81
-            T_COMMENT,
82
-            $start,
83
-            null,
84
-            false,
85
-            '/* testPassByReference */'
86
-        );
87
-
88
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
89
-        unset($found[0]['token']);
90
-        unset($found[0]['type_hint_token']);
91
-        $this->assertSame($expected, $found);
92
-
93
-    }//end testPassByReference()
94
-
95
-
96
-    /**
97
-     * Verify array hint parsing.
98
-     *
99
-     * @return void
100
-     */
101
-    public function testArrayHint()
102
-    {
103
-        $expected    = [];
104
-        $expected[0] = [
105
-            'name'              => '$var',
106
-            'content'           => 'array $var',
107
-            'pass_by_reference' => false,
108
-            'variable_length'   => false,
109
-            'type_hint'         => 'array',
110
-            'nullable_type'     => false,
111
-        ];
112
-
113
-        $start    = ($this->phpcsFile->numTokens - 1);
114
-        $function = $this->phpcsFile->findPrevious(
115
-            T_COMMENT,
116
-            $start,
117
-            null,
118
-            false,
119
-            '/* testArrayHint */'
120
-        );
121
-
122
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
123
-        unset($found[0]['token']);
124
-        unset($found[0]['type_hint_token']);
125
-        $this->assertSame($expected, $found);
126
-
127
-    }//end testArrayHint()
128
-
129
-
130
-    /**
131
-     * Verify type hint parsing.
132
-     *
133
-     * @return void
134
-     */
135
-    public function testTypeHint()
136
-    {
137
-        $expected    = [];
138
-        $expected[0] = [
139
-            'name'              => '$var1',
140
-            'content'           => 'foo $var1',
141
-            'pass_by_reference' => false,
142
-            'variable_length'   => false,
143
-            'type_hint'         => 'foo',
144
-            'nullable_type'     => false,
145
-        ];
146
-
147
-        $expected[1] = [
148
-            'name'              => '$var2',
149
-            'content'           => 'bar $var2',
150
-            'pass_by_reference' => false,
151
-            'variable_length'   => false,
152
-            'type_hint'         => 'bar',
153
-            'nullable_type'     => false,
154
-        ];
155
-
156
-        $start    = ($this->phpcsFile->numTokens - 1);
157
-        $function = $this->phpcsFile->findPrevious(
158
-            T_COMMENT,
159
-            $start,
160
-            null,
161
-            false,
162
-            '/* testTypeHint */'
163
-        );
164
-
165
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
166
-        unset($found[0]['token']);
167
-        unset($found[1]['token']);
168
-        unset($found[0]['type_hint_token']);
169
-        unset($found[1]['type_hint_token']);
170
-        $this->assertSame($expected, $found);
171
-
172
-    }//end testTypeHint()
173
-
174
-
175
-    /**
176
-     * Verify self type hint parsing.
177
-     *
178
-     * @return void
179
-     */
180
-    public function testSelfTypeHint()
181
-    {
182
-        $expected    = [];
183
-        $expected[0] = [
184
-            'name'              => '$var',
185
-            'content'           => 'self $var',
186
-            'pass_by_reference' => false,
187
-            'variable_length'   => false,
188
-            'type_hint'         => 'self',
189
-            'nullable_type'     => false,
190
-        ];
191
-
192
-        $start    = ($this->phpcsFile->numTokens - 1);
193
-        $function = $this->phpcsFile->findPrevious(
194
-            T_COMMENT,
195
-            $start,
196
-            null,
197
-            false,
198
-            '/* testSelfTypeHint */'
199
-        );
200
-
201
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
202
-        unset($found[0]['token']);
203
-        unset($found[0]['type_hint_token']);
204
-        $this->assertSame($expected, $found);
205
-
206
-    }//end testSelfTypeHint()
207
-
208
-
209
-    /**
210
-     * Verify nullable type hint parsing.
211
-     *
212
-     * @return void
213
-     */
214
-    public function testNullableTypeHint()
215
-    {
216
-        $expected    = [];
217
-        $expected[0] = [
218
-            'name'              => '$var1',
219
-            'content'           => '?int $var1',
220
-            'pass_by_reference' => false,
221
-            'variable_length'   => false,
222
-            'type_hint'         => '?int',
223
-            'nullable_type'     => true,
224
-        ];
225
-
226
-        $expected[1] = [
227
-            'name'              => '$var2',
228
-            'content'           => '?\bar $var2',
229
-            'pass_by_reference' => false,
230
-            'variable_length'   => false,
231
-            'type_hint'         => '?\bar',
232
-            'nullable_type'     => true,
233
-        ];
234
-
235
-        $start    = ($this->phpcsFile->numTokens - 1);
236
-        $function = $this->phpcsFile->findPrevious(
237
-            T_COMMENT,
238
-            $start,
239
-            null,
240
-            false,
241
-            '/* testNullableTypeHint */'
242
-        );
243
-
244
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
245
-        unset($found[0]['token']);
246
-        unset($found[1]['token']);
247
-        unset($found[0]['type_hint_token']);
248
-        unset($found[1]['type_hint_token']);
249
-        $this->assertSame($expected, $found);
250
-
251
-    }//end testNullableTypeHint()
252
-
253
-
254
-    /**
255
-     * Verify variable.
256
-     *
257
-     * @return void
258
-     */
259
-    public function testVariable()
260
-    {
261
-        $expected    = [];
262
-        $expected[0] = [
263
-            'name'              => '$var',
264
-            'content'           => '$var',
265
-            'pass_by_reference' => false,
266
-            'variable_length'   => false,
267
-            'type_hint'         => '',
268
-            'nullable_type'     => false,
269
-        ];
270
-
271
-        $start    = ($this->phpcsFile->numTokens - 1);
272
-        $function = $this->phpcsFile->findPrevious(
273
-            T_COMMENT,
274
-            $start,
275
-            null,
276
-            false,
277
-            '/* testVariable */'
278
-        );
279
-
280
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
281
-        unset($found[0]['token']);
282
-        unset($found[0]['type_hint_token']);
283
-        $this->assertSame($expected, $found);
284
-
285
-    }//end testVariable()
286
-
287
-
288
-    /**
289
-     * Verify default value parsing with a single function param.
290
-     *
291
-     * @return void
292
-     */
293
-    public function testSingleDefaultValue()
294
-    {
295
-        $expected    = [];
296
-        $expected[0] = [
297
-            'name'              => '$var1',
298
-            'content'           => '$var1=self::CONSTANT',
299
-            'default'           => 'self::CONSTANT',
300
-            'pass_by_reference' => false,
301
-            'variable_length'   => false,
302
-            'type_hint'         => '',
303
-            'nullable_type'     => false,
304
-        ];
305
-
306
-        $start    = ($this->phpcsFile->numTokens - 1);
307
-        $function = $this->phpcsFile->findPrevious(
308
-            T_COMMENT,
309
-            $start,
310
-            null,
311
-            false,
312
-            '/* testSingleDefaultValue */'
313
-        );
314
-
315
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
316
-        unset($found[0]['token']);
317
-        unset($found[0]['type_hint_token']);
318
-        $this->assertSame($expected, $found);
319
-
320
-    }//end testSingleDefaultValue()
321
-
322
-
323
-    /**
324
-     * Verify default value parsing.
325
-     *
326
-     * @return void
327
-     */
328
-    public function testDefaultValues()
329
-    {
330
-        $expected    = [];
331
-        $expected[0] = [
332
-            'name'              => '$var1',
333
-            'content'           => '$var1=1',
334
-            'default'           => '1',
335
-            'pass_by_reference' => false,
336
-            'variable_length'   => false,
337
-            'type_hint'         => '',
338
-            'nullable_type'     => false,
339
-        ];
340
-        $expected[1] = [
341
-            'name'              => '$var2',
342
-            'content'           => "\$var2='value'",
343
-            'default'           => "'value'",
344
-            'pass_by_reference' => false,
345
-            'variable_length'   => false,
346
-            'type_hint'         => '',
347
-            'nullable_type'     => false,
348
-        ];
349
-
350
-        $start    = ($this->phpcsFile->numTokens - 1);
351
-        $function = $this->phpcsFile->findPrevious(
352
-            T_COMMENT,
353
-            $start,
354
-            null,
355
-            false,
356
-            '/* testDefaultValues */'
357
-        );
358
-
359
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
360
-        unset($found[0]['token']);
361
-        unset($found[1]['token']);
362
-        unset($found[0]['type_hint_token']);
363
-        unset($found[1]['type_hint_token']);
364
-        $this->assertSame($expected, $found);
365
-
366
-    }//end testDefaultValues()
367
-
368
-
369
-    /**
370
-     * Verify "bitwise and" in default value !== pass-by-reference.
371
-     *
372
-     * @return void
373
-     */
374
-    public function testBitwiseAndConstantExpressionDefaultValue()
375
-    {
376
-        $expected    = [];
377
-        $expected[0] = [
378
-            'name'              => '$a',
379
-            'content'           => '$a = 10 & 20',
380
-            'default'           => '10 & 20',
381
-            'pass_by_reference' => false,
382
-            'variable_length'   => false,
383
-            'type_hint'         => '',
384
-            'nullable_type'     => false,
385
-        ];
386
-
387
-        $start    = ($this->phpcsFile->numTokens - 1);
388
-        $function = $this->phpcsFile->findPrevious(
389
-            T_COMMENT,
390
-            $start,
391
-            null,
392
-            false,
393
-            '/* testBitwiseAndConstantExpressionDefaultValue */'
394
-        );
395
-
396
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
397
-        unset($found[0]['token']);
398
-        unset($found[0]['type_hint_token']);
399
-        $this->assertSame($expected, $found);
400
-
401
-    }//end testBitwiseAndConstantExpressionDefaultValue()
20
+	/**
21
+	 * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
+	 *
23
+	 * @var \PHP_CodeSniffer\Files\File
24
+	 */
25
+	private $phpcsFile;
26
+
27
+
28
+	/**
29
+	 * Initialize & tokenize PHP_CodeSniffer_File with code from the test case file.
30
+	 *
31
+	 * Methods used for these tests can be found in a test case file in the same
32
+	 * directory and with the same name, using the .inc extension.
33
+	 *
34
+	 * @return void
35
+	 */
36
+	public function setUp()
37
+	{
38
+		$config            = new Config();
39
+		$config->standards = ['Generic'];
40
+
41
+		$ruleset = new Ruleset($config);
42
+
43
+		$pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
+		$this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
+		$this->phpcsFile->process();
46
+
47
+	}//end setUp()
48
+
49
+
50
+	/**
51
+	 * Clean up after finished test.
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function tearDown()
56
+	{
57
+		unset($this->phpcsFile);
58
+
59
+	}//end tearDown()
60
+
61
+
62
+	/**
63
+	 * Verify pass-by-reference parsing.
64
+	 *
65
+	 * @return void
66
+	 */
67
+	public function testPassByReference()
68
+	{
69
+		$expected    = [];
70
+		$expected[0] = [
71
+			'name'              => '$var',
72
+			'content'           => '&$var',
73
+			'pass_by_reference' => true,
74
+			'variable_length'   => false,
75
+			'type_hint'         => '',
76
+			'nullable_type'     => false,
77
+		];
78
+
79
+		$start    = ($this->phpcsFile->numTokens - 1);
80
+		$function = $this->phpcsFile->findPrevious(
81
+			T_COMMENT,
82
+			$start,
83
+			null,
84
+			false,
85
+			'/* testPassByReference */'
86
+		);
87
+
88
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
89
+		unset($found[0]['token']);
90
+		unset($found[0]['type_hint_token']);
91
+		$this->assertSame($expected, $found);
92
+
93
+	}//end testPassByReference()
94
+
95
+
96
+	/**
97
+	 * Verify array hint parsing.
98
+	 *
99
+	 * @return void
100
+	 */
101
+	public function testArrayHint()
102
+	{
103
+		$expected    = [];
104
+		$expected[0] = [
105
+			'name'              => '$var',
106
+			'content'           => 'array $var',
107
+			'pass_by_reference' => false,
108
+			'variable_length'   => false,
109
+			'type_hint'         => 'array',
110
+			'nullable_type'     => false,
111
+		];
112
+
113
+		$start    = ($this->phpcsFile->numTokens - 1);
114
+		$function = $this->phpcsFile->findPrevious(
115
+			T_COMMENT,
116
+			$start,
117
+			null,
118
+			false,
119
+			'/* testArrayHint */'
120
+		);
121
+
122
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
123
+		unset($found[0]['token']);
124
+		unset($found[0]['type_hint_token']);
125
+		$this->assertSame($expected, $found);
126
+
127
+	}//end testArrayHint()
128
+
129
+
130
+	/**
131
+	 * Verify type hint parsing.
132
+	 *
133
+	 * @return void
134
+	 */
135
+	public function testTypeHint()
136
+	{
137
+		$expected    = [];
138
+		$expected[0] = [
139
+			'name'              => '$var1',
140
+			'content'           => 'foo $var1',
141
+			'pass_by_reference' => false,
142
+			'variable_length'   => false,
143
+			'type_hint'         => 'foo',
144
+			'nullable_type'     => false,
145
+		];
146
+
147
+		$expected[1] = [
148
+			'name'              => '$var2',
149
+			'content'           => 'bar $var2',
150
+			'pass_by_reference' => false,
151
+			'variable_length'   => false,
152
+			'type_hint'         => 'bar',
153
+			'nullable_type'     => false,
154
+		];
155
+
156
+		$start    = ($this->phpcsFile->numTokens - 1);
157
+		$function = $this->phpcsFile->findPrevious(
158
+			T_COMMENT,
159
+			$start,
160
+			null,
161
+			false,
162
+			'/* testTypeHint */'
163
+		);
164
+
165
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
166
+		unset($found[0]['token']);
167
+		unset($found[1]['token']);
168
+		unset($found[0]['type_hint_token']);
169
+		unset($found[1]['type_hint_token']);
170
+		$this->assertSame($expected, $found);
171
+
172
+	}//end testTypeHint()
173
+
174
+
175
+	/**
176
+	 * Verify self type hint parsing.
177
+	 *
178
+	 * @return void
179
+	 */
180
+	public function testSelfTypeHint()
181
+	{
182
+		$expected    = [];
183
+		$expected[0] = [
184
+			'name'              => '$var',
185
+			'content'           => 'self $var',
186
+			'pass_by_reference' => false,
187
+			'variable_length'   => false,
188
+			'type_hint'         => 'self',
189
+			'nullable_type'     => false,
190
+		];
191
+
192
+		$start    = ($this->phpcsFile->numTokens - 1);
193
+		$function = $this->phpcsFile->findPrevious(
194
+			T_COMMENT,
195
+			$start,
196
+			null,
197
+			false,
198
+			'/* testSelfTypeHint */'
199
+		);
200
+
201
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
202
+		unset($found[0]['token']);
203
+		unset($found[0]['type_hint_token']);
204
+		$this->assertSame($expected, $found);
205
+
206
+	}//end testSelfTypeHint()
207
+
208
+
209
+	/**
210
+	 * Verify nullable type hint parsing.
211
+	 *
212
+	 * @return void
213
+	 */
214
+	public function testNullableTypeHint()
215
+	{
216
+		$expected    = [];
217
+		$expected[0] = [
218
+			'name'              => '$var1',
219
+			'content'           => '?int $var1',
220
+			'pass_by_reference' => false,
221
+			'variable_length'   => false,
222
+			'type_hint'         => '?int',
223
+			'nullable_type'     => true,
224
+		];
225
+
226
+		$expected[1] = [
227
+			'name'              => '$var2',
228
+			'content'           => '?\bar $var2',
229
+			'pass_by_reference' => false,
230
+			'variable_length'   => false,
231
+			'type_hint'         => '?\bar',
232
+			'nullable_type'     => true,
233
+		];
234
+
235
+		$start    = ($this->phpcsFile->numTokens - 1);
236
+		$function = $this->phpcsFile->findPrevious(
237
+			T_COMMENT,
238
+			$start,
239
+			null,
240
+			false,
241
+			'/* testNullableTypeHint */'
242
+		);
243
+
244
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
245
+		unset($found[0]['token']);
246
+		unset($found[1]['token']);
247
+		unset($found[0]['type_hint_token']);
248
+		unset($found[1]['type_hint_token']);
249
+		$this->assertSame($expected, $found);
250
+
251
+	}//end testNullableTypeHint()
252
+
253
+
254
+	/**
255
+	 * Verify variable.
256
+	 *
257
+	 * @return void
258
+	 */
259
+	public function testVariable()
260
+	{
261
+		$expected    = [];
262
+		$expected[0] = [
263
+			'name'              => '$var',
264
+			'content'           => '$var',
265
+			'pass_by_reference' => false,
266
+			'variable_length'   => false,
267
+			'type_hint'         => '',
268
+			'nullable_type'     => false,
269
+		];
270
+
271
+		$start    = ($this->phpcsFile->numTokens - 1);
272
+		$function = $this->phpcsFile->findPrevious(
273
+			T_COMMENT,
274
+			$start,
275
+			null,
276
+			false,
277
+			'/* testVariable */'
278
+		);
279
+
280
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
281
+		unset($found[0]['token']);
282
+		unset($found[0]['type_hint_token']);
283
+		$this->assertSame($expected, $found);
284
+
285
+	}//end testVariable()
286
+
287
+
288
+	/**
289
+	 * Verify default value parsing with a single function param.
290
+	 *
291
+	 * @return void
292
+	 */
293
+	public function testSingleDefaultValue()
294
+	{
295
+		$expected    = [];
296
+		$expected[0] = [
297
+			'name'              => '$var1',
298
+			'content'           => '$var1=self::CONSTANT',
299
+			'default'           => 'self::CONSTANT',
300
+			'pass_by_reference' => false,
301
+			'variable_length'   => false,
302
+			'type_hint'         => '',
303
+			'nullable_type'     => false,
304
+		];
305
+
306
+		$start    = ($this->phpcsFile->numTokens - 1);
307
+		$function = $this->phpcsFile->findPrevious(
308
+			T_COMMENT,
309
+			$start,
310
+			null,
311
+			false,
312
+			'/* testSingleDefaultValue */'
313
+		);
314
+
315
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
316
+		unset($found[0]['token']);
317
+		unset($found[0]['type_hint_token']);
318
+		$this->assertSame($expected, $found);
319
+
320
+	}//end testSingleDefaultValue()
321
+
322
+
323
+	/**
324
+	 * Verify default value parsing.
325
+	 *
326
+	 * @return void
327
+	 */
328
+	public function testDefaultValues()
329
+	{
330
+		$expected    = [];
331
+		$expected[0] = [
332
+			'name'              => '$var1',
333
+			'content'           => '$var1=1',
334
+			'default'           => '1',
335
+			'pass_by_reference' => false,
336
+			'variable_length'   => false,
337
+			'type_hint'         => '',
338
+			'nullable_type'     => false,
339
+		];
340
+		$expected[1] = [
341
+			'name'              => '$var2',
342
+			'content'           => "\$var2='value'",
343
+			'default'           => "'value'",
344
+			'pass_by_reference' => false,
345
+			'variable_length'   => false,
346
+			'type_hint'         => '',
347
+			'nullable_type'     => false,
348
+		];
349
+
350
+		$start    = ($this->phpcsFile->numTokens - 1);
351
+		$function = $this->phpcsFile->findPrevious(
352
+			T_COMMENT,
353
+			$start,
354
+			null,
355
+			false,
356
+			'/* testDefaultValues */'
357
+		);
358
+
359
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
360
+		unset($found[0]['token']);
361
+		unset($found[1]['token']);
362
+		unset($found[0]['type_hint_token']);
363
+		unset($found[1]['type_hint_token']);
364
+		$this->assertSame($expected, $found);
365
+
366
+	}//end testDefaultValues()
367
+
368
+
369
+	/**
370
+	 * Verify "bitwise and" in default value !== pass-by-reference.
371
+	 *
372
+	 * @return void
373
+	 */
374
+	public function testBitwiseAndConstantExpressionDefaultValue()
375
+	{
376
+		$expected    = [];
377
+		$expected[0] = [
378
+			'name'              => '$a',
379
+			'content'           => '$a = 10 & 20',
380
+			'default'           => '10 & 20',
381
+			'pass_by_reference' => false,
382
+			'variable_length'   => false,
383
+			'type_hint'         => '',
384
+			'nullable_type'     => false,
385
+		];
386
+
387
+		$start    = ($this->phpcsFile->numTokens - 1);
388
+		$function = $this->phpcsFile->findPrevious(
389
+			T_COMMENT,
390
+			$start,
391
+			null,
392
+			false,
393
+			'/* testBitwiseAndConstantExpressionDefaultValue */'
394
+		);
395
+
396
+		$found = $this->phpcsFile->getMethodParameters(($function + 2));
397
+		unset($found[0]['token']);
398
+		unset($found[0]['type_hint_token']);
399
+		$this->assertSame($expected, $found);
400
+
401
+	}//end testBitwiseAndConstantExpressionDefaultValue()
402 402
 
403 403
 
404 404
 }//end class
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
     public function setUp()
37 37
     {
38 38
         $config            = new Config();
39
-        $config->standards = ['Generic'];
39
+        $config->standards = [ 'Generic' ];
40 40
 
41
-        $ruleset = new Ruleset($config);
41
+        $ruleset = new Ruleset( $config );
42 42
 
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
43
+        $pathToTestFile  = dirname( __FILE__ ) . '/' . basename( __FILE__, '.php' ) . '.inc';
44
+        $this->phpcsFile = new DummyFile( file_get_contents( $pathToTestFile ), $ruleset, $config );
45 45
         $this->phpcsFile->process();
46 46
 
47 47
     }//end setUp()
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function tearDown()
56 56
     {
57
-        unset($this->phpcsFile);
57
+        unset( $this->phpcsFile );
58 58
 
59 59
     }//end tearDown()
60 60
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function testPassByReference()
68 68
     {
69
-        $expected    = [];
70
-        $expected[0] = [
69
+        $expected    = [ ];
70
+        $expected[ 0 ] = [
71 71
             'name'              => '$var',
72 72
             'content'           => '&$var',
73 73
             'pass_by_reference' => true,
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             'nullable_type'     => false,
77 77
         ];
78 78
 
79
-        $start    = ($this->phpcsFile->numTokens - 1);
79
+        $start    = ( $this->phpcsFile->numTokens - 1 );
80 80
         $function = $this->phpcsFile->findPrevious(
81 81
             T_COMMENT,
82 82
             $start,
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
             '/* testPassByReference */'
86 86
         );
87 87
 
88
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
89
-        unset($found[0]['token']);
90
-        unset($found[0]['type_hint_token']);
91
-        $this->assertSame($expected, $found);
88
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
89
+        unset( $found[ 0 ][ 'token' ] );
90
+        unset( $found[ 0 ][ 'type_hint_token' ] );
91
+        $this->assertSame( $expected, $found );
92 92
 
93 93
     }//end testPassByReference()
94 94
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function testArrayHint()
102 102
     {
103
-        $expected    = [];
104
-        $expected[0] = [
103
+        $expected    = [ ];
104
+        $expected[ 0 ] = [
105 105
             'name'              => '$var',
106 106
             'content'           => 'array $var',
107 107
             'pass_by_reference' => false,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             'nullable_type'     => false,
111 111
         ];
112 112
 
113
-        $start    = ($this->phpcsFile->numTokens - 1);
113
+        $start    = ( $this->phpcsFile->numTokens - 1 );
114 114
         $function = $this->phpcsFile->findPrevious(
115 115
             T_COMMENT,
116 116
             $start,
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
             '/* testArrayHint */'
120 120
         );
121 121
 
122
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
123
-        unset($found[0]['token']);
124
-        unset($found[0]['type_hint_token']);
125
-        $this->assertSame($expected, $found);
122
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
123
+        unset( $found[ 0 ][ 'token' ] );
124
+        unset( $found[ 0 ][ 'type_hint_token' ] );
125
+        $this->assertSame( $expected, $found );
126 126
 
127 127
     }//end testArrayHint()
128 128
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function testTypeHint()
136 136
     {
137
-        $expected    = [];
138
-        $expected[0] = [
137
+        $expected    = [ ];
138
+        $expected[ 0 ] = [
139 139
             'name'              => '$var1',
140 140
             'content'           => 'foo $var1',
141 141
             'pass_by_reference' => false,
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             'nullable_type'     => false,
145 145
         ];
146 146
 
147
-        $expected[1] = [
147
+        $expected[ 1 ] = [
148 148
             'name'              => '$var2',
149 149
             'content'           => 'bar $var2',
150 150
             'pass_by_reference' => false,
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             'nullable_type'     => false,
154 154
         ];
155 155
 
156
-        $start    = ($this->phpcsFile->numTokens - 1);
156
+        $start    = ( $this->phpcsFile->numTokens - 1 );
157 157
         $function = $this->phpcsFile->findPrevious(
158 158
             T_COMMENT,
159 159
             $start,
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
             '/* testTypeHint */'
163 163
         );
164 164
 
165
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
166
-        unset($found[0]['token']);
167
-        unset($found[1]['token']);
168
-        unset($found[0]['type_hint_token']);
169
-        unset($found[1]['type_hint_token']);
170
-        $this->assertSame($expected, $found);
165
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
166
+        unset( $found[ 0 ][ 'token' ] );
167
+        unset( $found[ 1 ][ 'token' ] );
168
+        unset( $found[ 0 ][ 'type_hint_token' ] );
169
+        unset( $found[ 1 ][ 'type_hint_token' ] );
170
+        $this->assertSame( $expected, $found );
171 171
 
172 172
     }//end testTypeHint()
173 173
 
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function testSelfTypeHint()
181 181
     {
182
-        $expected    = [];
183
-        $expected[0] = [
182
+        $expected    = [ ];
183
+        $expected[ 0 ] = [
184 184
             'name'              => '$var',
185 185
             'content'           => 'self $var',
186 186
             'pass_by_reference' => false,
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
             'nullable_type'     => false,
190 190
         ];
191 191
 
192
-        $start    = ($this->phpcsFile->numTokens - 1);
192
+        $start    = ( $this->phpcsFile->numTokens - 1 );
193 193
         $function = $this->phpcsFile->findPrevious(
194 194
             T_COMMENT,
195 195
             $start,
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
             '/* testSelfTypeHint */'
199 199
         );
200 200
 
201
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
202
-        unset($found[0]['token']);
203
-        unset($found[0]['type_hint_token']);
204
-        $this->assertSame($expected, $found);
201
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
202
+        unset( $found[ 0 ][ 'token' ] );
203
+        unset( $found[ 0 ][ 'type_hint_token' ] );
204
+        $this->assertSame( $expected, $found );
205 205
 
206 206
     }//end testSelfTypeHint()
207 207
 
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function testNullableTypeHint()
215 215
     {
216
-        $expected    = [];
217
-        $expected[0] = [
216
+        $expected    = [ ];
217
+        $expected[ 0 ] = [
218 218
             'name'              => '$var1',
219 219
             'content'           => '?int $var1',
220 220
             'pass_by_reference' => false,
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             'nullable_type'     => true,
224 224
         ];
225 225
 
226
-        $expected[1] = [
226
+        $expected[ 1 ] = [
227 227
             'name'              => '$var2',
228 228
             'content'           => '?\bar $var2',
229 229
             'pass_by_reference' => false,
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             'nullable_type'     => true,
233 233
         ];
234 234
 
235
-        $start    = ($this->phpcsFile->numTokens - 1);
235
+        $start    = ( $this->phpcsFile->numTokens - 1 );
236 236
         $function = $this->phpcsFile->findPrevious(
237 237
             T_COMMENT,
238 238
             $start,
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
             '/* testNullableTypeHint */'
242 242
         );
243 243
 
244
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
245
-        unset($found[0]['token']);
246
-        unset($found[1]['token']);
247
-        unset($found[0]['type_hint_token']);
248
-        unset($found[1]['type_hint_token']);
249
-        $this->assertSame($expected, $found);
244
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
245
+        unset( $found[ 0 ][ 'token' ] );
246
+        unset( $found[ 1 ][ 'token' ] );
247
+        unset( $found[ 0 ][ 'type_hint_token' ] );
248
+        unset( $found[ 1 ][ 'type_hint_token' ] );
249
+        $this->assertSame( $expected, $found );
250 250
 
251 251
     }//end testNullableTypeHint()
252 252
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function testVariable()
260 260
     {
261
-        $expected    = [];
262
-        $expected[0] = [
261
+        $expected    = [ ];
262
+        $expected[ 0 ] = [
263 263
             'name'              => '$var',
264 264
             'content'           => '$var',
265 265
             'pass_by_reference' => false,
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             'nullable_type'     => false,
269 269
         ];
270 270
 
271
-        $start    = ($this->phpcsFile->numTokens - 1);
271
+        $start    = ( $this->phpcsFile->numTokens - 1 );
272 272
         $function = $this->phpcsFile->findPrevious(
273 273
             T_COMMENT,
274 274
             $start,
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
             '/* testVariable */'
278 278
         );
279 279
 
280
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
281
-        unset($found[0]['token']);
282
-        unset($found[0]['type_hint_token']);
283
-        $this->assertSame($expected, $found);
280
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
281
+        unset( $found[ 0 ][ 'token' ] );
282
+        unset( $found[ 0 ][ 'type_hint_token' ] );
283
+        $this->assertSame( $expected, $found );
284 284
 
285 285
     }//end testVariable()
286 286
 
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public function testSingleDefaultValue()
294 294
     {
295
-        $expected    = [];
296
-        $expected[0] = [
295
+        $expected    = [ ];
296
+        $expected[ 0 ] = [
297 297
             'name'              => '$var1',
298 298
             'content'           => '$var1=self::CONSTANT',
299 299
             'default'           => 'self::CONSTANT',
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             'nullable_type'     => false,
304 304
         ];
305 305
 
306
-        $start    = ($this->phpcsFile->numTokens - 1);
306
+        $start    = ( $this->phpcsFile->numTokens - 1 );
307 307
         $function = $this->phpcsFile->findPrevious(
308 308
             T_COMMENT,
309 309
             $start,
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
             '/* testSingleDefaultValue */'
313 313
         );
314 314
 
315
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
316
-        unset($found[0]['token']);
317
-        unset($found[0]['type_hint_token']);
318
-        $this->assertSame($expected, $found);
315
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
316
+        unset( $found[ 0 ][ 'token' ] );
317
+        unset( $found[ 0 ][ 'type_hint_token' ] );
318
+        $this->assertSame( $expected, $found );
319 319
 
320 320
     }//end testSingleDefaultValue()
321 321
 
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
      */
328 328
     public function testDefaultValues()
329 329
     {
330
-        $expected    = [];
331
-        $expected[0] = [
330
+        $expected    = [ ];
331
+        $expected[ 0 ] = [
332 332
             'name'              => '$var1',
333 333
             'content'           => '$var1=1',
334 334
             'default'           => '1',
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             'type_hint'         => '',
338 338
             'nullable_type'     => false,
339 339
         ];
340
-        $expected[1] = [
340
+        $expected[ 1 ] = [
341 341
             'name'              => '$var2',
342 342
             'content'           => "\$var2='value'",
343 343
             'default'           => "'value'",
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             'nullable_type'     => false,
348 348
         ];
349 349
 
350
-        $start    = ($this->phpcsFile->numTokens - 1);
350
+        $start    = ( $this->phpcsFile->numTokens - 1 );
351 351
         $function = $this->phpcsFile->findPrevious(
352 352
             T_COMMENT,
353 353
             $start,
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
             '/* testDefaultValues */'
357 357
         );
358 358
 
359
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
360
-        unset($found[0]['token']);
361
-        unset($found[1]['token']);
362
-        unset($found[0]['type_hint_token']);
363
-        unset($found[1]['type_hint_token']);
364
-        $this->assertSame($expected, $found);
359
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
360
+        unset( $found[ 0 ][ 'token' ] );
361
+        unset( $found[ 1 ][ 'token' ] );
362
+        unset( $found[ 0 ][ 'type_hint_token' ] );
363
+        unset( $found[ 1 ][ 'type_hint_token' ] );
364
+        $this->assertSame( $expected, $found );
365 365
 
366 366
     }//end testDefaultValues()
367 367
 
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
      */
374 374
     public function testBitwiseAndConstantExpressionDefaultValue()
375 375
     {
376
-        $expected    = [];
377
-        $expected[0] = [
376
+        $expected    = [ ];
377
+        $expected[ 0 ] = [
378 378
             'name'              => '$a',
379 379
             'content'           => '$a = 10 & 20',
380 380
             'default'           => '10 & 20',
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             'nullable_type'     => false,
385 385
         ];
386 386
 
387
-        $start    = ($this->phpcsFile->numTokens - 1);
387
+        $start    = ( $this->phpcsFile->numTokens - 1 );
388 388
         $function = $this->phpcsFile->findPrevious(
389 389
             T_COMMENT,
390 390
             $start,
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
             '/* testBitwiseAndConstantExpressionDefaultValue */'
394 394
         );
395 395
 
396
-        $found = $this->phpcsFile->getMethodParameters(($function + 2));
397
-        unset($found[0]['token']);
398
-        unset($found[0]['type_hint_token']);
399
-        $this->assertSame($expected, $found);
396
+        $found = $this->phpcsFile->getMethodParameters( ( $function + 2 ) );
397
+        unset( $found[ 0 ][ 'token' ] );
398
+        unset( $found[ 0 ][ 'type_hint_token' ] );
399
+        $this->assertSame( $expected, $found );
400 400
 
401 401
     }//end testBitwiseAndConstantExpressionDefaultValue()
402 402
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use PHP_CodeSniffer\Files\DummyFile;
15 15
 use PHPUnit\Framework\TestCase;
16 16
 
17
-class GetMethodParametersTest extends TestCase
18
-{
17
+class GetMethodParametersTest extends TestCase {
19 18
 
20 19
     /**
21 20
      * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return void
35 34
      */
36
-    public function setUp()
37
-    {
35
+    public function setUp() {
38 36
         $config            = new Config();
39 37
         $config->standards = ['Generic'];
40 38
 
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      *
53 51
      * @return void
54 52
      */
55
-    public function tearDown()
56
-    {
53
+    public function tearDown() {
57 54
         unset($this->phpcsFile);
58 55
 
59 56
     }//end tearDown()
@@ -64,8 +61,7 @@  discard block
 block discarded – undo
64 61
      *
65 62
      * @return void
66 63
      */
67
-    public function testPassByReference()
68
-    {
64
+    public function testPassByReference() {
69 65
         $expected    = [];
70 66
         $expected[0] = [
71 67
             'name'              => '$var',
@@ -98,8 +94,7 @@  discard block
 block discarded – undo
98 94
      *
99 95
      * @return void
100 96
      */
101
-    public function testArrayHint()
102
-    {
97
+    public function testArrayHint() {
103 98
         $expected    = [];
104 99
         $expected[0] = [
105 100
             'name'              => '$var',
@@ -132,8 +127,7 @@  discard block
 block discarded – undo
132 127
      *
133 128
      * @return void
134 129
      */
135
-    public function testTypeHint()
136
-    {
130
+    public function testTypeHint() {
137 131
         $expected    = [];
138 132
         $expected[0] = [
139 133
             'name'              => '$var1',
@@ -177,8 +171,7 @@  discard block
 block discarded – undo
177 171
      *
178 172
      * @return void
179 173
      */
180
-    public function testSelfTypeHint()
181
-    {
174
+    public function testSelfTypeHint() {
182 175
         $expected    = [];
183 176
         $expected[0] = [
184 177
             'name'              => '$var',
@@ -211,8 +204,7 @@  discard block
 block discarded – undo
211 204
      *
212 205
      * @return void
213 206
      */
214
-    public function testNullableTypeHint()
215
-    {
207
+    public function testNullableTypeHint() {
216 208
         $expected    = [];
217 209
         $expected[0] = [
218 210
             'name'              => '$var1',
@@ -256,8 +248,7 @@  discard block
 block discarded – undo
256 248
      *
257 249
      * @return void
258 250
      */
259
-    public function testVariable()
260
-    {
251
+    public function testVariable() {
261 252
         $expected    = [];
262 253
         $expected[0] = [
263 254
             'name'              => '$var',
@@ -290,8 +281,7 @@  discard block
 block discarded – undo
290 281
      *
291 282
      * @return void
292 283
      */
293
-    public function testSingleDefaultValue()
294
-    {
284
+    public function testSingleDefaultValue() {
295 285
         $expected    = [];
296 286
         $expected[0] = [
297 287
             'name'              => '$var1',
@@ -325,8 +315,7 @@  discard block
 block discarded – undo
325 315
      *
326 316
      * @return void
327 317
      */
328
-    public function testDefaultValues()
329
-    {
318
+    public function testDefaultValues() {
330 319
         $expected    = [];
331 320
         $expected[0] = [
332 321
             'name'              => '$var1',
@@ -371,8 +360,7 @@  discard block
 block discarded – undo
371 360
      *
372 361
      * @return void
373 362
      */
374
-    public function testBitwiseAndConstantExpressionDefaultValue()
375
-    {
363
+    public function testBitwiseAndConstantExpressionDefaultValue() {
376 364
         $expected    = [];
377 365
         $expected[0] = [
378 366
             'name'              => '$a',
Please login to merge, or discard this patch.
squizlabs/php_codesniffer/tests/Core/File/GetMethodPropertiesTest.php 3 patches
Indentation   +550 added lines, -550 removed lines patch added patch discarded remove patch
@@ -17,556 +17,556 @@
 block discarded – undo
17 17
 class GetMethodPropertiesTest extends TestCase
18 18
 {
19 19
 
20
-    /**
21
-     * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
-     *
23
-     * @var \PHP_CodeSniffer\Files\File
24
-     */
25
-    private $phpcsFile;
26
-
27
-
28
-    /**
29
-     * Initialize & tokenize PHP_CodeSniffer_File with code from the test case file.
30
-     *
31
-     * Methods used for these tests can be found in a test case file in the same
32
-     * directory and with the same name, using the .inc extension.
33
-     *
34
-     * @return void
35
-     */
36
-    public function setUp()
37
-    {
38
-        $config            = new Config();
39
-        $config->standards = ['Generic'];
40
-
41
-        $ruleset = new Ruleset($config);
42
-
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
-        $this->phpcsFile->process();
46
-
47
-    }//end setUp()
48
-
49
-
50
-    /**
51
-     * Clean up after finished test.
52
-     *
53
-     * @return void
54
-     */
55
-    public function tearDown()
56
-    {
57
-        unset($this->phpcsFile);
58
-
59
-    }//end tearDown()
60
-
61
-
62
-    /**
63
-     * Test a basic function.
64
-     *
65
-     * @return void
66
-     */
67
-    public function testBasicFunction()
68
-    {
69
-        $expected = [
70
-            'scope'                => 'public',
71
-            'scope_specified'      => false,
72
-            'return_type'          => '',
73
-            'nullable_return_type' => false,
74
-            'is_abstract'          => false,
75
-            'is_final'             => false,
76
-            'is_static'            => false,
77
-            'has_body'             => true,
78
-        ];
79
-
80
-        $start    = ($this->phpcsFile->numTokens - 1);
81
-        $function = $this->phpcsFile->findPrevious(
82
-            T_COMMENT,
83
-            $start,
84
-            null,
85
-            false,
86
-            '/* testBasicFunction */'
87
-        );
88
-
89
-        $found = $this->phpcsFile->getMethodProperties(($function + 2));
90
-        unset($found['return_type_token']);
91
-        $this->assertSame($expected, $found);
92
-
93
-    }//end testBasicFunction()
94
-
95
-
96
-    /**
97
-     * Test a function with a return type.
98
-     *
99
-     * @return void
100
-     */
101
-    public function testReturnFunction()
102
-    {
103
-        $expected = [
104
-            'scope'                => 'public',
105
-            'scope_specified'      => false,
106
-            'return_type'          => 'array',
107
-            'nullable_return_type' => false,
108
-            'is_abstract'          => false,
109
-            'is_final'             => false,
110
-            'is_static'            => false,
111
-            'has_body'             => true,
112
-        ];
113
-
114
-        $start    = ($this->phpcsFile->numTokens - 1);
115
-        $function = $this->phpcsFile->findPrevious(
116
-            T_COMMENT,
117
-            $start,
118
-            null,
119
-            false,
120
-            '/* testReturnFunction */'
121
-        );
122
-
123
-        $found = $this->phpcsFile->getMethodProperties(($function + 2));
124
-        unset($found['return_type_token']);
125
-        $this->assertSame($expected, $found);
126
-
127
-    }//end testReturnFunction()
128
-
129
-
130
-    /**
131
-     * Test a closure used as a function argument.
132
-     *
133
-     * @return void
134
-     */
135
-    public function testNestedClosure()
136
-    {
137
-        $expected = [
138
-            'scope'                => 'public',
139
-            'scope_specified'      => false,
140
-            'return_type'          => 'int',
141
-            'nullable_return_type' => false,
142
-            'is_abstract'          => false,
143
-            'is_final'             => false,
144
-            'is_static'            => false,
145
-            'has_body'             => true,
146
-        ];
147
-
148
-        $start    = ($this->phpcsFile->numTokens - 1);
149
-        $function = $this->phpcsFile->findPrevious(
150
-            T_COMMENT,
151
-            $start,
152
-            null,
153
-            false,
154
-            '/* testNestedClosure */'
155
-        );
156
-
157
-        $found = $this->phpcsFile->getMethodProperties(($function + 1));
158
-        unset($found['return_type_token']);
159
-        $this->assertSame($expected, $found);
160
-
161
-    }//end testNestedClosure()
162
-
163
-
164
-    /**
165
-     * Test a basic method.
166
-     *
167
-     * @return void
168
-     */
169
-    public function testBasicMethod()
170
-    {
171
-        $expected = [
172
-            'scope'                => 'public',
173
-            'scope_specified'      => false,
174
-            'return_type'          => '',
175
-            'nullable_return_type' => false,
176
-            'is_abstract'          => false,
177
-            'is_final'             => false,
178
-            'is_static'            => false,
179
-            'has_body'             => true,
180
-        ];
181
-
182
-        $start    = ($this->phpcsFile->numTokens - 1);
183
-        $function = $this->phpcsFile->findPrevious(
184
-            T_COMMENT,
185
-            $start,
186
-            null,
187
-            false,
188
-            '/* testBasicMethod */'
189
-        );
190
-
191
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
192
-        unset($found['return_type_token']);
193
-        $this->assertSame($expected, $found);
194
-
195
-    }//end testBasicMethod()
196
-
197
-
198
-    /**
199
-     * Test a private static method.
200
-     *
201
-     * @return void
202
-     */
203
-    public function testPrivateStaticMethod()
204
-    {
205
-        $expected = [
206
-            'scope'                => 'private',
207
-            'scope_specified'      => true,
208
-            'return_type'          => '',
209
-            'nullable_return_type' => false,
210
-            'is_abstract'          => false,
211
-            'is_final'             => false,
212
-            'is_static'            => true,
213
-            'has_body'             => true,
214
-        ];
215
-
216
-        $start    = ($this->phpcsFile->numTokens - 1);
217
-        $function = $this->phpcsFile->findPrevious(
218
-            T_COMMENT,
219
-            $start,
220
-            null,
221
-            false,
222
-            '/* testPrivateStaticMethod */'
223
-        );
224
-
225
-        $found = $this->phpcsFile->getMethodProperties(($function + 7));
226
-        unset($found['return_type_token']);
227
-        $this->assertSame($expected, $found);
228
-
229
-    }//end testPrivateStaticMethod()
230
-
231
-
232
-    /**
233
-     * Test a basic final method.
234
-     *
235
-     * @return void
236
-     */
237
-    public function testFinalMethod()
238
-    {
239
-        $expected = [
240
-            'scope'                => 'public',
241
-            'scope_specified'      => true,
242
-            'return_type'          => '',
243
-            'nullable_return_type' => false,
244
-            'is_abstract'          => false,
245
-            'is_final'             => true,
246
-            'is_static'            => false,
247
-            'has_body'             => true,
248
-        ];
249
-
250
-        $start    = ($this->phpcsFile->numTokens - 1);
251
-        $function = $this->phpcsFile->findPrevious(
252
-            T_COMMENT,
253
-            $start,
254
-            null,
255
-            false,
256
-            '/* testFinalMethod */'
257
-        );
258
-
259
-        $found = $this->phpcsFile->getMethodProperties(($function + 7));
260
-        unset($found['return_type_token']);
261
-        $this->assertSame($expected, $found);
262
-
263
-    }//end testFinalMethod()
264
-
265
-
266
-    /**
267
-     * Test a protected method with a return type.
268
-     *
269
-     * @return void
270
-     */
271
-    public function testProtectedReturnMethod()
272
-    {
273
-        $expected = [
274
-            'scope'                => 'protected',
275
-            'scope_specified'      => true,
276
-            'return_type'          => 'int',
277
-            'nullable_return_type' => false,
278
-            'is_abstract'          => false,
279
-            'is_final'             => false,
280
-            'is_static'            => false,
281
-            'has_body'             => true,
282
-        ];
283
-
284
-        $start    = ($this->phpcsFile->numTokens - 1);
285
-        $function = $this->phpcsFile->findPrevious(
286
-            T_COMMENT,
287
-            $start,
288
-            null,
289
-            false,
290
-            '/* testProtectedReturnMethod */'
291
-        );
292
-
293
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
294
-        unset($found['return_type_token']);
295
-        $this->assertSame($expected, $found);
296
-
297
-    }//end testProtectedReturnMethod()
298
-
299
-
300
-    /**
301
-     * Test a public method with a return type.
302
-     *
303
-     * @return void
304
-     */
305
-    public function testPublicReturnMethod()
306
-    {
307
-        $expected = [
308
-            'scope'                => 'public',
309
-            'scope_specified'      => true,
310
-            'return_type'          => 'array',
311
-            'nullable_return_type' => false,
312
-            'is_abstract'          => false,
313
-            'is_final'             => false,
314
-            'is_static'            => false,
315
-            'has_body'             => true,
316
-        ];
317
-
318
-        $start    = ($this->phpcsFile->numTokens - 1);
319
-        $function = $this->phpcsFile->findPrevious(
320
-            T_COMMENT,
321
-            $start,
322
-            null,
323
-            false,
324
-            '/* testPublicReturnMethod */'
325
-        );
326
-
327
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
328
-        unset($found['return_type_token']);
329
-        $this->assertSame($expected, $found);
330
-
331
-    }//end testPublicReturnMethod()
332
-
333
-
334
-    /**
335
-     * Test a public method with a nullable return type.
336
-     *
337
-     * @return void
338
-     */
339
-    public function testNullableReturnMethod()
340
-    {
341
-        $expected = [
342
-            'scope'                => 'public',
343
-            'scope_specified'      => true,
344
-            'return_type'          => '?array',
345
-            'nullable_return_type' => true,
346
-            'is_abstract'          => false,
347
-            'is_final'             => false,
348
-            'is_static'            => false,
349
-            'has_body'             => true,
350
-        ];
351
-
352
-        $start    = ($this->phpcsFile->numTokens - 1);
353
-        $function = $this->phpcsFile->findPrevious(
354
-            T_COMMENT,
355
-            $start,
356
-            null,
357
-            false,
358
-            '/* testNullableReturnMethod */'
359
-        );
360
-
361
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
362
-        unset($found['return_type_token']);
363
-        $this->assertSame($expected, $found);
364
-
365
-    }//end testNullableReturnMethod()
366
-
367
-
368
-    /**
369
-     * Test a public method with a nullable return type.
370
-     *
371
-     * @return void
372
-     */
373
-    public function testMessyNullableReturnMethod()
374
-    {
375
-        $expected = [
376
-            'scope'                => 'public',
377
-            'scope_specified'      => true,
378
-            'return_type'          => '?array',
379
-            'nullable_return_type' => true,
380
-            'is_abstract'          => false,
381
-            'is_final'             => false,
382
-            'is_static'            => false,
383
-            'has_body'             => true,
384
-        ];
385
-
386
-        $start    = ($this->phpcsFile->numTokens - 1);
387
-        $function = $this->phpcsFile->findPrevious(
388
-            T_COMMENT,
389
-            $start,
390
-            null,
391
-            false,
392
-            '/* testMessyNullableReturnMethod */'
393
-        );
394
-
395
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
396
-        unset($found['return_type_token']);
397
-        $this->assertSame($expected, $found);
398
-
399
-    }//end testMessyNullableReturnMethod()
400
-
401
-
402
-    /**
403
-     * Test a method with a namespaced return type.
404
-     *
405
-     * @return void
406
-     */
407
-    public function testReturnNamespace()
408
-    {
409
-        $expected = [
410
-            'scope'                => 'public',
411
-            'scope_specified'      => false,
412
-            'return_type'          => '\MyNamespace\MyClass',
413
-            'nullable_return_type' => false,
414
-            'is_abstract'          => false,
415
-            'is_final'             => false,
416
-            'is_static'            => false,
417
-            'has_body'             => true,
418
-        ];
419
-
420
-        $start    = ($this->phpcsFile->numTokens - 1);
421
-        $function = $this->phpcsFile->findPrevious(
422
-            T_COMMENT,
423
-            $start,
424
-            null,
425
-            false,
426
-            '/* testReturnNamespace */'
427
-        );
428
-
429
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
430
-        unset($found['return_type_token']);
431
-        $this->assertSame($expected, $found);
432
-
433
-    }//end testReturnNamespace()
434
-
435
-
436
-    /**
437
-     * Test a method with a messy namespaces return type.
438
-     *
439
-     * @return void
440
-     */
441
-    public function testReturnMultilineNamespace()
442
-    {
443
-        $expected = [
444
-            'scope'                => 'public',
445
-            'scope_specified'      => false,
446
-            'return_type'          => '\MyNamespace\MyClass\Foo',
447
-            'nullable_return_type' => false,
448
-            'is_abstract'          => false,
449
-            'is_final'             => false,
450
-            'is_static'            => false,
451
-            'has_body'             => true,
452
-        ];
453
-
454
-        $start    = ($this->phpcsFile->numTokens - 1);
455
-        $function = $this->phpcsFile->findPrevious(
456
-            T_COMMENT,
457
-            $start,
458
-            null,
459
-            false,
460
-            '/* testReturnMultilineNamespace */'
461
-        );
462
-
463
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
464
-        unset($found['return_type_token']);
465
-        $this->assertSame($expected, $found);
466
-
467
-    }//end testReturnMultilineNamespace()
468
-
469
-
470
-    /**
471
-     * Test a basic abstract method.
472
-     *
473
-     * @return void
474
-     */
475
-    public function testAbstractMethod()
476
-    {
477
-        $expected = [
478
-            'scope'                => 'public',
479
-            'scope_specified'      => false,
480
-            'return_type'          => '',
481
-            'nullable_return_type' => false,
482
-            'is_abstract'          => true,
483
-            'is_final'             => false,
484
-            'is_static'            => false,
485
-            'has_body'             => false,
486
-        ];
487
-
488
-        $start    = ($this->phpcsFile->numTokens - 1);
489
-        $function = $this->phpcsFile->findPrevious(
490
-            T_COMMENT,
491
-            $start,
492
-            null,
493
-            false,
494
-            '/* testAbstractMethod */'
495
-        );
496
-
497
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
498
-        unset($found['return_type_token']);
499
-        $this->assertSame($expected, $found);
500
-
501
-    }//end testAbstractMethod()
502
-
503
-
504
-    /**
505
-     * Test an abstract method with a return type.
506
-     *
507
-     * @return void
508
-     */
509
-    public function testAbstractReturnMethod()
510
-    {
511
-        $expected = [
512
-            'scope'                => 'protected',
513
-            'scope_specified'      => true,
514
-            'return_type'          => 'bool',
515
-            'nullable_return_type' => false,
516
-            'is_abstract'          => true,
517
-            'is_final'             => false,
518
-            'is_static'            => false,
519
-            'has_body'             => false,
520
-        ];
521
-
522
-        $start    = ($this->phpcsFile->numTokens - 1);
523
-        $function = $this->phpcsFile->findPrevious(
524
-            T_COMMENT,
525
-            $start,
526
-            null,
527
-            false,
528
-            '/* testAbstractReturnMethod */'
529
-        );
530
-
531
-        $found = $this->phpcsFile->getMethodProperties(($function + 7));
532
-        unset($found['return_type_token']);
533
-        $this->assertSame($expected, $found);
534
-
535
-    }//end testAbstractReturnMethod()
536
-
537
-
538
-    /**
539
-     * Test a basic interface method.
540
-     *
541
-     * @return void
542
-     */
543
-    public function testInterfaceMethod()
544
-    {
545
-        $expected = [
546
-            'scope'                => 'public',
547
-            'scope_specified'      => false,
548
-            'return_type'          => '',
549
-            'nullable_return_type' => false,
550
-            'is_abstract'          => false,
551
-            'is_final'             => false,
552
-            'is_static'            => false,
553
-            'has_body'             => false,
554
-        ];
555
-
556
-        $start    = ($this->phpcsFile->numTokens - 1);
557
-        $function = $this->phpcsFile->findPrevious(
558
-            T_COMMENT,
559
-            $start,
560
-            null,
561
-            false,
562
-            '/* testInterfaceMethod */'
563
-        );
564
-
565
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
566
-        unset($found['return_type_token']);
567
-        $this->assertSame($expected, $found);
568
-
569
-    }//end testInterfaceMethod()
20
+	/**
21
+	 * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
+	 *
23
+	 * @var \PHP_CodeSniffer\Files\File
24
+	 */
25
+	private $phpcsFile;
26
+
27
+
28
+	/**
29
+	 * Initialize & tokenize PHP_CodeSniffer_File with code from the test case file.
30
+	 *
31
+	 * Methods used for these tests can be found in a test case file in the same
32
+	 * directory and with the same name, using the .inc extension.
33
+	 *
34
+	 * @return void
35
+	 */
36
+	public function setUp()
37
+	{
38
+		$config            = new Config();
39
+		$config->standards = ['Generic'];
40
+
41
+		$ruleset = new Ruleset($config);
42
+
43
+		$pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
+		$this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
+		$this->phpcsFile->process();
46
+
47
+	}//end setUp()
48
+
49
+
50
+	/**
51
+	 * Clean up after finished test.
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function tearDown()
56
+	{
57
+		unset($this->phpcsFile);
58
+
59
+	}//end tearDown()
60
+
61
+
62
+	/**
63
+	 * Test a basic function.
64
+	 *
65
+	 * @return void
66
+	 */
67
+	public function testBasicFunction()
68
+	{
69
+		$expected = [
70
+			'scope'                => 'public',
71
+			'scope_specified'      => false,
72
+			'return_type'          => '',
73
+			'nullable_return_type' => false,
74
+			'is_abstract'          => false,
75
+			'is_final'             => false,
76
+			'is_static'            => false,
77
+			'has_body'             => true,
78
+		];
79
+
80
+		$start    = ($this->phpcsFile->numTokens - 1);
81
+		$function = $this->phpcsFile->findPrevious(
82
+			T_COMMENT,
83
+			$start,
84
+			null,
85
+			false,
86
+			'/* testBasicFunction */'
87
+		);
88
+
89
+		$found = $this->phpcsFile->getMethodProperties(($function + 2));
90
+		unset($found['return_type_token']);
91
+		$this->assertSame($expected, $found);
92
+
93
+	}//end testBasicFunction()
94
+
95
+
96
+	/**
97
+	 * Test a function with a return type.
98
+	 *
99
+	 * @return void
100
+	 */
101
+	public function testReturnFunction()
102
+	{
103
+		$expected = [
104
+			'scope'                => 'public',
105
+			'scope_specified'      => false,
106
+			'return_type'          => 'array',
107
+			'nullable_return_type' => false,
108
+			'is_abstract'          => false,
109
+			'is_final'             => false,
110
+			'is_static'            => false,
111
+			'has_body'             => true,
112
+		];
113
+
114
+		$start    = ($this->phpcsFile->numTokens - 1);
115
+		$function = $this->phpcsFile->findPrevious(
116
+			T_COMMENT,
117
+			$start,
118
+			null,
119
+			false,
120
+			'/* testReturnFunction */'
121
+		);
122
+
123
+		$found = $this->phpcsFile->getMethodProperties(($function + 2));
124
+		unset($found['return_type_token']);
125
+		$this->assertSame($expected, $found);
126
+
127
+	}//end testReturnFunction()
128
+
129
+
130
+	/**
131
+	 * Test a closure used as a function argument.
132
+	 *
133
+	 * @return void
134
+	 */
135
+	public function testNestedClosure()
136
+	{
137
+		$expected = [
138
+			'scope'                => 'public',
139
+			'scope_specified'      => false,
140
+			'return_type'          => 'int',
141
+			'nullable_return_type' => false,
142
+			'is_abstract'          => false,
143
+			'is_final'             => false,
144
+			'is_static'            => false,
145
+			'has_body'             => true,
146
+		];
147
+
148
+		$start    = ($this->phpcsFile->numTokens - 1);
149
+		$function = $this->phpcsFile->findPrevious(
150
+			T_COMMENT,
151
+			$start,
152
+			null,
153
+			false,
154
+			'/* testNestedClosure */'
155
+		);
156
+
157
+		$found = $this->phpcsFile->getMethodProperties(($function + 1));
158
+		unset($found['return_type_token']);
159
+		$this->assertSame($expected, $found);
160
+
161
+	}//end testNestedClosure()
162
+
163
+
164
+	/**
165
+	 * Test a basic method.
166
+	 *
167
+	 * @return void
168
+	 */
169
+	public function testBasicMethod()
170
+	{
171
+		$expected = [
172
+			'scope'                => 'public',
173
+			'scope_specified'      => false,
174
+			'return_type'          => '',
175
+			'nullable_return_type' => false,
176
+			'is_abstract'          => false,
177
+			'is_final'             => false,
178
+			'is_static'            => false,
179
+			'has_body'             => true,
180
+		];
181
+
182
+		$start    = ($this->phpcsFile->numTokens - 1);
183
+		$function = $this->phpcsFile->findPrevious(
184
+			T_COMMENT,
185
+			$start,
186
+			null,
187
+			false,
188
+			'/* testBasicMethod */'
189
+		);
190
+
191
+		$found = $this->phpcsFile->getMethodProperties(($function + 3));
192
+		unset($found['return_type_token']);
193
+		$this->assertSame($expected, $found);
194
+
195
+	}//end testBasicMethod()
196
+
197
+
198
+	/**
199
+	 * Test a private static method.
200
+	 *
201
+	 * @return void
202
+	 */
203
+	public function testPrivateStaticMethod()
204
+	{
205
+		$expected = [
206
+			'scope'                => 'private',
207
+			'scope_specified'      => true,
208
+			'return_type'          => '',
209
+			'nullable_return_type' => false,
210
+			'is_abstract'          => false,
211
+			'is_final'             => false,
212
+			'is_static'            => true,
213
+			'has_body'             => true,
214
+		];
215
+
216
+		$start    = ($this->phpcsFile->numTokens - 1);
217
+		$function = $this->phpcsFile->findPrevious(
218
+			T_COMMENT,
219
+			$start,
220
+			null,
221
+			false,
222
+			'/* testPrivateStaticMethod */'
223
+		);
224
+
225
+		$found = $this->phpcsFile->getMethodProperties(($function + 7));
226
+		unset($found['return_type_token']);
227
+		$this->assertSame($expected, $found);
228
+
229
+	}//end testPrivateStaticMethod()
230
+
231
+
232
+	/**
233
+	 * Test a basic final method.
234
+	 *
235
+	 * @return void
236
+	 */
237
+	public function testFinalMethod()
238
+	{
239
+		$expected = [
240
+			'scope'                => 'public',
241
+			'scope_specified'      => true,
242
+			'return_type'          => '',
243
+			'nullable_return_type' => false,
244
+			'is_abstract'          => false,
245
+			'is_final'             => true,
246
+			'is_static'            => false,
247
+			'has_body'             => true,
248
+		];
249
+
250
+		$start    = ($this->phpcsFile->numTokens - 1);
251
+		$function = $this->phpcsFile->findPrevious(
252
+			T_COMMENT,
253
+			$start,
254
+			null,
255
+			false,
256
+			'/* testFinalMethod */'
257
+		);
258
+
259
+		$found = $this->phpcsFile->getMethodProperties(($function + 7));
260
+		unset($found['return_type_token']);
261
+		$this->assertSame($expected, $found);
262
+
263
+	}//end testFinalMethod()
264
+
265
+
266
+	/**
267
+	 * Test a protected method with a return type.
268
+	 *
269
+	 * @return void
270
+	 */
271
+	public function testProtectedReturnMethod()
272
+	{
273
+		$expected = [
274
+			'scope'                => 'protected',
275
+			'scope_specified'      => true,
276
+			'return_type'          => 'int',
277
+			'nullable_return_type' => false,
278
+			'is_abstract'          => false,
279
+			'is_final'             => false,
280
+			'is_static'            => false,
281
+			'has_body'             => true,
282
+		];
283
+
284
+		$start    = ($this->phpcsFile->numTokens - 1);
285
+		$function = $this->phpcsFile->findPrevious(
286
+			T_COMMENT,
287
+			$start,
288
+			null,
289
+			false,
290
+			'/* testProtectedReturnMethod */'
291
+		);
292
+
293
+		$found = $this->phpcsFile->getMethodProperties(($function + 5));
294
+		unset($found['return_type_token']);
295
+		$this->assertSame($expected, $found);
296
+
297
+	}//end testProtectedReturnMethod()
298
+
299
+
300
+	/**
301
+	 * Test a public method with a return type.
302
+	 *
303
+	 * @return void
304
+	 */
305
+	public function testPublicReturnMethod()
306
+	{
307
+		$expected = [
308
+			'scope'                => 'public',
309
+			'scope_specified'      => true,
310
+			'return_type'          => 'array',
311
+			'nullable_return_type' => false,
312
+			'is_abstract'          => false,
313
+			'is_final'             => false,
314
+			'is_static'            => false,
315
+			'has_body'             => true,
316
+		];
317
+
318
+		$start    = ($this->phpcsFile->numTokens - 1);
319
+		$function = $this->phpcsFile->findPrevious(
320
+			T_COMMENT,
321
+			$start,
322
+			null,
323
+			false,
324
+			'/* testPublicReturnMethod */'
325
+		);
326
+
327
+		$found = $this->phpcsFile->getMethodProperties(($function + 5));
328
+		unset($found['return_type_token']);
329
+		$this->assertSame($expected, $found);
330
+
331
+	}//end testPublicReturnMethod()
332
+
333
+
334
+	/**
335
+	 * Test a public method with a nullable return type.
336
+	 *
337
+	 * @return void
338
+	 */
339
+	public function testNullableReturnMethod()
340
+	{
341
+		$expected = [
342
+			'scope'                => 'public',
343
+			'scope_specified'      => true,
344
+			'return_type'          => '?array',
345
+			'nullable_return_type' => true,
346
+			'is_abstract'          => false,
347
+			'is_final'             => false,
348
+			'is_static'            => false,
349
+			'has_body'             => true,
350
+		];
351
+
352
+		$start    = ($this->phpcsFile->numTokens - 1);
353
+		$function = $this->phpcsFile->findPrevious(
354
+			T_COMMENT,
355
+			$start,
356
+			null,
357
+			false,
358
+			'/* testNullableReturnMethod */'
359
+		);
360
+
361
+		$found = $this->phpcsFile->getMethodProperties(($function + 5));
362
+		unset($found['return_type_token']);
363
+		$this->assertSame($expected, $found);
364
+
365
+	}//end testNullableReturnMethod()
366
+
367
+
368
+	/**
369
+	 * Test a public method with a nullable return type.
370
+	 *
371
+	 * @return void
372
+	 */
373
+	public function testMessyNullableReturnMethod()
374
+	{
375
+		$expected = [
376
+			'scope'                => 'public',
377
+			'scope_specified'      => true,
378
+			'return_type'          => '?array',
379
+			'nullable_return_type' => true,
380
+			'is_abstract'          => false,
381
+			'is_final'             => false,
382
+			'is_static'            => false,
383
+			'has_body'             => true,
384
+		];
385
+
386
+		$start    = ($this->phpcsFile->numTokens - 1);
387
+		$function = $this->phpcsFile->findPrevious(
388
+			T_COMMENT,
389
+			$start,
390
+			null,
391
+			false,
392
+			'/* testMessyNullableReturnMethod */'
393
+		);
394
+
395
+		$found = $this->phpcsFile->getMethodProperties(($function + 5));
396
+		unset($found['return_type_token']);
397
+		$this->assertSame($expected, $found);
398
+
399
+	}//end testMessyNullableReturnMethod()
400
+
401
+
402
+	/**
403
+	 * Test a method with a namespaced return type.
404
+	 *
405
+	 * @return void
406
+	 */
407
+	public function testReturnNamespace()
408
+	{
409
+		$expected = [
410
+			'scope'                => 'public',
411
+			'scope_specified'      => false,
412
+			'return_type'          => '\MyNamespace\MyClass',
413
+			'nullable_return_type' => false,
414
+			'is_abstract'          => false,
415
+			'is_final'             => false,
416
+			'is_static'            => false,
417
+			'has_body'             => true,
418
+		];
419
+
420
+		$start    = ($this->phpcsFile->numTokens - 1);
421
+		$function = $this->phpcsFile->findPrevious(
422
+			T_COMMENT,
423
+			$start,
424
+			null,
425
+			false,
426
+			'/* testReturnNamespace */'
427
+		);
428
+
429
+		$found = $this->phpcsFile->getMethodProperties(($function + 3));
430
+		unset($found['return_type_token']);
431
+		$this->assertSame($expected, $found);
432
+
433
+	}//end testReturnNamespace()
434
+
435
+
436
+	/**
437
+	 * Test a method with a messy namespaces return type.
438
+	 *
439
+	 * @return void
440
+	 */
441
+	public function testReturnMultilineNamespace()
442
+	{
443
+		$expected = [
444
+			'scope'                => 'public',
445
+			'scope_specified'      => false,
446
+			'return_type'          => '\MyNamespace\MyClass\Foo',
447
+			'nullable_return_type' => false,
448
+			'is_abstract'          => false,
449
+			'is_final'             => false,
450
+			'is_static'            => false,
451
+			'has_body'             => true,
452
+		];
453
+
454
+		$start    = ($this->phpcsFile->numTokens - 1);
455
+		$function = $this->phpcsFile->findPrevious(
456
+			T_COMMENT,
457
+			$start,
458
+			null,
459
+			false,
460
+			'/* testReturnMultilineNamespace */'
461
+		);
462
+
463
+		$found = $this->phpcsFile->getMethodProperties(($function + 3));
464
+		unset($found['return_type_token']);
465
+		$this->assertSame($expected, $found);
466
+
467
+	}//end testReturnMultilineNamespace()
468
+
469
+
470
+	/**
471
+	 * Test a basic abstract method.
472
+	 *
473
+	 * @return void
474
+	 */
475
+	public function testAbstractMethod()
476
+	{
477
+		$expected = [
478
+			'scope'                => 'public',
479
+			'scope_specified'      => false,
480
+			'return_type'          => '',
481
+			'nullable_return_type' => false,
482
+			'is_abstract'          => true,
483
+			'is_final'             => false,
484
+			'is_static'            => false,
485
+			'has_body'             => false,
486
+		];
487
+
488
+		$start    = ($this->phpcsFile->numTokens - 1);
489
+		$function = $this->phpcsFile->findPrevious(
490
+			T_COMMENT,
491
+			$start,
492
+			null,
493
+			false,
494
+			'/* testAbstractMethod */'
495
+		);
496
+
497
+		$found = $this->phpcsFile->getMethodProperties(($function + 5));
498
+		unset($found['return_type_token']);
499
+		$this->assertSame($expected, $found);
500
+
501
+	}//end testAbstractMethod()
502
+
503
+
504
+	/**
505
+	 * Test an abstract method with a return type.
506
+	 *
507
+	 * @return void
508
+	 */
509
+	public function testAbstractReturnMethod()
510
+	{
511
+		$expected = [
512
+			'scope'                => 'protected',
513
+			'scope_specified'      => true,
514
+			'return_type'          => 'bool',
515
+			'nullable_return_type' => false,
516
+			'is_abstract'          => true,
517
+			'is_final'             => false,
518
+			'is_static'            => false,
519
+			'has_body'             => false,
520
+		];
521
+
522
+		$start    = ($this->phpcsFile->numTokens - 1);
523
+		$function = $this->phpcsFile->findPrevious(
524
+			T_COMMENT,
525
+			$start,
526
+			null,
527
+			false,
528
+			'/* testAbstractReturnMethod */'
529
+		);
530
+
531
+		$found = $this->phpcsFile->getMethodProperties(($function + 7));
532
+		unset($found['return_type_token']);
533
+		$this->assertSame($expected, $found);
534
+
535
+	}//end testAbstractReturnMethod()
536
+
537
+
538
+	/**
539
+	 * Test a basic interface method.
540
+	 *
541
+	 * @return void
542
+	 */
543
+	public function testInterfaceMethod()
544
+	{
545
+		$expected = [
546
+			'scope'                => 'public',
547
+			'scope_specified'      => false,
548
+			'return_type'          => '',
549
+			'nullable_return_type' => false,
550
+			'is_abstract'          => false,
551
+			'is_final'             => false,
552
+			'is_static'            => false,
553
+			'has_body'             => false,
554
+		];
555
+
556
+		$start    = ($this->phpcsFile->numTokens - 1);
557
+		$function = $this->phpcsFile->findPrevious(
558
+			T_COMMENT,
559
+			$start,
560
+			null,
561
+			false,
562
+			'/* testInterfaceMethod */'
563
+		);
564
+
565
+		$found = $this->phpcsFile->getMethodProperties(($function + 3));
566
+		unset($found['return_type_token']);
567
+		$this->assertSame($expected, $found);
568
+
569
+	}//end testInterfaceMethod()
570 570
 
571 571
 
572 572
 }//end class
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
     public function setUp()
37 37
     {
38 38
         $config            = new Config();
39
-        $config->standards = ['Generic'];
39
+        $config->standards = [ 'Generic' ];
40 40
 
41
-        $ruleset = new Ruleset($config);
41
+        $ruleset = new Ruleset( $config );
42 42
 
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
43
+        $pathToTestFile  = dirname( __FILE__ ) . '/' . basename( __FILE__, '.php' ) . '.inc';
44
+        $this->phpcsFile = new DummyFile( file_get_contents( $pathToTestFile ), $ruleset, $config );
45 45
         $this->phpcsFile->process();
46 46
 
47 47
     }//end setUp()
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function tearDown()
56 56
     {
57
-        unset($this->phpcsFile);
57
+        unset( $this->phpcsFile );
58 58
 
59 59
     }//end tearDown()
60 60
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             'has_body'             => true,
78 78
         ];
79 79
 
80
-        $start    = ($this->phpcsFile->numTokens - 1);
80
+        $start    = ( $this->phpcsFile->numTokens - 1 );
81 81
         $function = $this->phpcsFile->findPrevious(
82 82
             T_COMMENT,
83 83
             $start,
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
             '/* testBasicFunction */'
87 87
         );
88 88
 
89
-        $found = $this->phpcsFile->getMethodProperties(($function + 2));
90
-        unset($found['return_type_token']);
91
-        $this->assertSame($expected, $found);
89
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 2 ) );
90
+        unset( $found[ 'return_type_token' ] );
91
+        $this->assertSame( $expected, $found );
92 92
 
93 93
     }//end testBasicFunction()
94 94
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             'has_body'             => true,
112 112
         ];
113 113
 
114
-        $start    = ($this->phpcsFile->numTokens - 1);
114
+        $start    = ( $this->phpcsFile->numTokens - 1 );
115 115
         $function = $this->phpcsFile->findPrevious(
116 116
             T_COMMENT,
117 117
             $start,
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
             '/* testReturnFunction */'
121 121
         );
122 122
 
123
-        $found = $this->phpcsFile->getMethodProperties(($function + 2));
124
-        unset($found['return_type_token']);
125
-        $this->assertSame($expected, $found);
123
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 2 ) );
124
+        unset( $found[ 'return_type_token' ] );
125
+        $this->assertSame( $expected, $found );
126 126
 
127 127
     }//end testReturnFunction()
128 128
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             'has_body'             => true,
146 146
         ];
147 147
 
148
-        $start    = ($this->phpcsFile->numTokens - 1);
148
+        $start    = ( $this->phpcsFile->numTokens - 1 );
149 149
         $function = $this->phpcsFile->findPrevious(
150 150
             T_COMMENT,
151 151
             $start,
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
             '/* testNestedClosure */'
155 155
         );
156 156
 
157
-        $found = $this->phpcsFile->getMethodProperties(($function + 1));
158
-        unset($found['return_type_token']);
159
-        $this->assertSame($expected, $found);
157
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 1 ) );
158
+        unset( $found[ 'return_type_token' ] );
159
+        $this->assertSame( $expected, $found );
160 160
 
161 161
     }//end testNestedClosure()
162 162
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             'has_body'             => true,
180 180
         ];
181 181
 
182
-        $start    = ($this->phpcsFile->numTokens - 1);
182
+        $start    = ( $this->phpcsFile->numTokens - 1 );
183 183
         $function = $this->phpcsFile->findPrevious(
184 184
             T_COMMENT,
185 185
             $start,
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
             '/* testBasicMethod */'
189 189
         );
190 190
 
191
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
192
-        unset($found['return_type_token']);
193
-        $this->assertSame($expected, $found);
191
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 3 ) );
192
+        unset( $found[ 'return_type_token' ] );
193
+        $this->assertSame( $expected, $found );
194 194
 
195 195
     }//end testBasicMethod()
196 196
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             'has_body'             => true,
214 214
         ];
215 215
 
216
-        $start    = ($this->phpcsFile->numTokens - 1);
216
+        $start    = ( $this->phpcsFile->numTokens - 1 );
217 217
         $function = $this->phpcsFile->findPrevious(
218 218
             T_COMMENT,
219 219
             $start,
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
             '/* testPrivateStaticMethod */'
223 223
         );
224 224
 
225
-        $found = $this->phpcsFile->getMethodProperties(($function + 7));
226
-        unset($found['return_type_token']);
227
-        $this->assertSame($expected, $found);
225
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 7 ) );
226
+        unset( $found[ 'return_type_token' ] );
227
+        $this->assertSame( $expected, $found );
228 228
 
229 229
     }//end testPrivateStaticMethod()
230 230
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             'has_body'             => true,
248 248
         ];
249 249
 
250
-        $start    = ($this->phpcsFile->numTokens - 1);
250
+        $start    = ( $this->phpcsFile->numTokens - 1 );
251 251
         $function = $this->phpcsFile->findPrevious(
252 252
             T_COMMENT,
253 253
             $start,
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
             '/* testFinalMethod */'
257 257
         );
258 258
 
259
-        $found = $this->phpcsFile->getMethodProperties(($function + 7));
260
-        unset($found['return_type_token']);
261
-        $this->assertSame($expected, $found);
259
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 7 ) );
260
+        unset( $found[ 'return_type_token' ] );
261
+        $this->assertSame( $expected, $found );
262 262
 
263 263
     }//end testFinalMethod()
264 264
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             'has_body'             => true,
282 282
         ];
283 283
 
284
-        $start    = ($this->phpcsFile->numTokens - 1);
284
+        $start    = ( $this->phpcsFile->numTokens - 1 );
285 285
         $function = $this->phpcsFile->findPrevious(
286 286
             T_COMMENT,
287 287
             $start,
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
             '/* testProtectedReturnMethod */'
291 291
         );
292 292
 
293
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
294
-        unset($found['return_type_token']);
295
-        $this->assertSame($expected, $found);
293
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 5 ) );
294
+        unset( $found[ 'return_type_token' ] );
295
+        $this->assertSame( $expected, $found );
296 296
 
297 297
     }//end testProtectedReturnMethod()
298 298
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             'has_body'             => true,
316 316
         ];
317 317
 
318
-        $start    = ($this->phpcsFile->numTokens - 1);
318
+        $start    = ( $this->phpcsFile->numTokens - 1 );
319 319
         $function = $this->phpcsFile->findPrevious(
320 320
             T_COMMENT,
321 321
             $start,
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
             '/* testPublicReturnMethod */'
325 325
         );
326 326
 
327
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
328
-        unset($found['return_type_token']);
329
-        $this->assertSame($expected, $found);
327
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 5 ) );
328
+        unset( $found[ 'return_type_token' ] );
329
+        $this->assertSame( $expected, $found );
330 330
 
331 331
     }//end testPublicReturnMethod()
332 332
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             'has_body'             => true,
350 350
         ];
351 351
 
352
-        $start    = ($this->phpcsFile->numTokens - 1);
352
+        $start    = ( $this->phpcsFile->numTokens - 1 );
353 353
         $function = $this->phpcsFile->findPrevious(
354 354
             T_COMMENT,
355 355
             $start,
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
             '/* testNullableReturnMethod */'
359 359
         );
360 360
 
361
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
362
-        unset($found['return_type_token']);
363
-        $this->assertSame($expected, $found);
361
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 5 ) );
362
+        unset( $found[ 'return_type_token' ] );
363
+        $this->assertSame( $expected, $found );
364 364
 
365 365
     }//end testNullableReturnMethod()
366 366
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             'has_body'             => true,
384 384
         ];
385 385
 
386
-        $start    = ($this->phpcsFile->numTokens - 1);
386
+        $start    = ( $this->phpcsFile->numTokens - 1 );
387 387
         $function = $this->phpcsFile->findPrevious(
388 388
             T_COMMENT,
389 389
             $start,
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
             '/* testMessyNullableReturnMethod */'
393 393
         );
394 394
 
395
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
396
-        unset($found['return_type_token']);
397
-        $this->assertSame($expected, $found);
395
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 5 ) );
396
+        unset( $found[ 'return_type_token' ] );
397
+        $this->assertSame( $expected, $found );
398 398
 
399 399
     }//end testMessyNullableReturnMethod()
400 400
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
             'has_body'             => true,
418 418
         ];
419 419
 
420
-        $start    = ($this->phpcsFile->numTokens - 1);
420
+        $start    = ( $this->phpcsFile->numTokens - 1 );
421 421
         $function = $this->phpcsFile->findPrevious(
422 422
             T_COMMENT,
423 423
             $start,
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
             '/* testReturnNamespace */'
427 427
         );
428 428
 
429
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
430
-        unset($found['return_type_token']);
431
-        $this->assertSame($expected, $found);
429
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 3 ) );
430
+        unset( $found[ 'return_type_token' ] );
431
+        $this->assertSame( $expected, $found );
432 432
 
433 433
     }//end testReturnNamespace()
434 434
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
             'has_body'             => true,
452 452
         ];
453 453
 
454
-        $start    = ($this->phpcsFile->numTokens - 1);
454
+        $start    = ( $this->phpcsFile->numTokens - 1 );
455 455
         $function = $this->phpcsFile->findPrevious(
456 456
             T_COMMENT,
457 457
             $start,
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
             '/* testReturnMultilineNamespace */'
461 461
         );
462 462
 
463
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
464
-        unset($found['return_type_token']);
465
-        $this->assertSame($expected, $found);
463
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 3 ) );
464
+        unset( $found[ 'return_type_token' ] );
465
+        $this->assertSame( $expected, $found );
466 466
 
467 467
     }//end testReturnMultilineNamespace()
468 468
 
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
             'has_body'             => false,
486 486
         ];
487 487
 
488
-        $start    = ($this->phpcsFile->numTokens - 1);
488
+        $start    = ( $this->phpcsFile->numTokens - 1 );
489 489
         $function = $this->phpcsFile->findPrevious(
490 490
             T_COMMENT,
491 491
             $start,
@@ -494,9 +494,9 @@  discard block
 block discarded – undo
494 494
             '/* testAbstractMethod */'
495 495
         );
496 496
 
497
-        $found = $this->phpcsFile->getMethodProperties(($function + 5));
498
-        unset($found['return_type_token']);
499
-        $this->assertSame($expected, $found);
497
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 5 ) );
498
+        unset( $found[ 'return_type_token' ] );
499
+        $this->assertSame( $expected, $found );
500 500
 
501 501
     }//end testAbstractMethod()
502 502
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
             'has_body'             => false,
520 520
         ];
521 521
 
522
-        $start    = ($this->phpcsFile->numTokens - 1);
522
+        $start    = ( $this->phpcsFile->numTokens - 1 );
523 523
         $function = $this->phpcsFile->findPrevious(
524 524
             T_COMMENT,
525 525
             $start,
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
             '/* testAbstractReturnMethod */'
529 529
         );
530 530
 
531
-        $found = $this->phpcsFile->getMethodProperties(($function + 7));
532
-        unset($found['return_type_token']);
533
-        $this->assertSame($expected, $found);
531
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 7 ) );
532
+        unset( $found[ 'return_type_token' ] );
533
+        $this->assertSame( $expected, $found );
534 534
 
535 535
     }//end testAbstractReturnMethod()
536 536
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
             'has_body'             => false,
554 554
         ];
555 555
 
556
-        $start    = ($this->phpcsFile->numTokens - 1);
556
+        $start    = ( $this->phpcsFile->numTokens - 1 );
557 557
         $function = $this->phpcsFile->findPrevious(
558 558
             T_COMMENT,
559 559
             $start,
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
             '/* testInterfaceMethod */'
563 563
         );
564 564
 
565
-        $found = $this->phpcsFile->getMethodProperties(($function + 3));
566
-        unset($found['return_type_token']);
567
-        $this->assertSame($expected, $found);
565
+        $found = $this->phpcsFile->getMethodProperties( ( $function + 3 ) );
566
+        unset( $found[ 'return_type_token' ] );
567
+        $this->assertSame( $expected, $found );
568 568
 
569 569
     }//end testInterfaceMethod()
570 570
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use PHP_CodeSniffer\Files\DummyFile;
15 15
 use PHPUnit\Framework\TestCase;
16 16
 
17
-class GetMethodPropertiesTest extends TestCase
18
-{
17
+class GetMethodPropertiesTest extends TestCase {
19 18
 
20 19
     /**
21 20
      * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return void
35 34
      */
36
-    public function setUp()
37
-    {
35
+    public function setUp() {
38 36
         $config            = new Config();
39 37
         $config->standards = ['Generic'];
40 38
 
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      *
53 51
      * @return void
54 52
      */
55
-    public function tearDown()
56
-    {
53
+    public function tearDown() {
57 54
         unset($this->phpcsFile);
58 55
 
59 56
     }//end tearDown()
@@ -64,8 +61,7 @@  discard block
 block discarded – undo
64 61
      *
65 62
      * @return void
66 63
      */
67
-    public function testBasicFunction()
68
-    {
64
+    public function testBasicFunction() {
69 65
         $expected = [
70 66
             'scope'                => 'public',
71 67
             'scope_specified'      => false,
@@ -98,8 +94,7 @@  discard block
 block discarded – undo
98 94
      *
99 95
      * @return void
100 96
      */
101
-    public function testReturnFunction()
102
-    {
97
+    public function testReturnFunction() {
103 98
         $expected = [
104 99
             'scope'                => 'public',
105 100
             'scope_specified'      => false,
@@ -132,8 +127,7 @@  discard block
 block discarded – undo
132 127
      *
133 128
      * @return void
134 129
      */
135
-    public function testNestedClosure()
136
-    {
130
+    public function testNestedClosure() {
137 131
         $expected = [
138 132
             'scope'                => 'public',
139 133
             'scope_specified'      => false,
@@ -166,8 +160,7 @@  discard block
 block discarded – undo
166 160
      *
167 161
      * @return void
168 162
      */
169
-    public function testBasicMethod()
170
-    {
163
+    public function testBasicMethod() {
171 164
         $expected = [
172 165
             'scope'                => 'public',
173 166
             'scope_specified'      => false,
@@ -200,8 +193,7 @@  discard block
 block discarded – undo
200 193
      *
201 194
      * @return void
202 195
      */
203
-    public function testPrivateStaticMethod()
204
-    {
196
+    public function testPrivateStaticMethod() {
205 197
         $expected = [
206 198
             'scope'                => 'private',
207 199
             'scope_specified'      => true,
@@ -234,8 +226,7 @@  discard block
 block discarded – undo
234 226
      *
235 227
      * @return void
236 228
      */
237
-    public function testFinalMethod()
238
-    {
229
+    public function testFinalMethod() {
239 230
         $expected = [
240 231
             'scope'                => 'public',
241 232
             'scope_specified'      => true,
@@ -268,8 +259,7 @@  discard block
 block discarded – undo
268 259
      *
269 260
      * @return void
270 261
      */
271
-    public function testProtectedReturnMethod()
272
-    {
262
+    public function testProtectedReturnMethod() {
273 263
         $expected = [
274 264
             'scope'                => 'protected',
275 265
             'scope_specified'      => true,
@@ -302,8 +292,7 @@  discard block
 block discarded – undo
302 292
      *
303 293
      * @return void
304 294
      */
305
-    public function testPublicReturnMethod()
306
-    {
295
+    public function testPublicReturnMethod() {
307 296
         $expected = [
308 297
             'scope'                => 'public',
309 298
             'scope_specified'      => true,
@@ -336,8 +325,7 @@  discard block
 block discarded – undo
336 325
      *
337 326
      * @return void
338 327
      */
339
-    public function testNullableReturnMethod()
340
-    {
328
+    public function testNullableReturnMethod() {
341 329
         $expected = [
342 330
             'scope'                => 'public',
343 331
             'scope_specified'      => true,
@@ -370,8 +358,7 @@  discard block
 block discarded – undo
370 358
      *
371 359
      * @return void
372 360
      */
373
-    public function testMessyNullableReturnMethod()
374
-    {
361
+    public function testMessyNullableReturnMethod() {
375 362
         $expected = [
376 363
             'scope'                => 'public',
377 364
             'scope_specified'      => true,
@@ -404,8 +391,7 @@  discard block
 block discarded – undo
404 391
      *
405 392
      * @return void
406 393
      */
407
-    public function testReturnNamespace()
408
-    {
394
+    public function testReturnNamespace() {
409 395
         $expected = [
410 396
             'scope'                => 'public',
411 397
             'scope_specified'      => false,
@@ -438,8 +424,7 @@  discard block
 block discarded – undo
438 424
      *
439 425
      * @return void
440 426
      */
441
-    public function testReturnMultilineNamespace()
442
-    {
427
+    public function testReturnMultilineNamespace() {
443 428
         $expected = [
444 429
             'scope'                => 'public',
445 430
             'scope_specified'      => false,
@@ -472,8 +457,7 @@  discard block
 block discarded – undo
472 457
      *
473 458
      * @return void
474 459
      */
475
-    public function testAbstractMethod()
476
-    {
460
+    public function testAbstractMethod() {
477 461
         $expected = [
478 462
             'scope'                => 'public',
479 463
             'scope_specified'      => false,
@@ -506,8 +490,7 @@  discard block
 block discarded – undo
506 490
      *
507 491
      * @return void
508 492
      */
509
-    public function testAbstractReturnMethod()
510
-    {
493
+    public function testAbstractReturnMethod() {
511 494
         $expected = [
512 495
             'scope'                => 'protected',
513 496
             'scope_specified'      => true,
@@ -540,8 +523,7 @@  discard block
 block discarded – undo
540 523
      *
541 524
      * @return void
542 525
      */
543
-    public function testInterfaceMethod()
544
-    {
526
+    public function testInterfaceMethod() {
545 527
         $expected = [
546 528
             'scope'                => 'public',
547 529
             'scope_specified'      => false,
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/tests/Core/File/IsReferenceTest.php 3 patches
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -17,269 +17,269 @@
 block discarded – undo
17 17
 class IsReferenceTest extends TestCase
18 18
 {
19 19
 
20
-    /**
21
-     * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
-     *
23
-     * @var \PHP_CodeSniffer\Files\File
24
-     */
25
-    private $phpcsFile;
20
+	/**
21
+	 * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
22
+	 *
23
+	 * @var \PHP_CodeSniffer\Files\File
24
+	 */
25
+	private $phpcsFile;
26 26
 
27 27
 
28
-    /**
29
-     * Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
30
-     *
31
-     * Methods used for these tests can be found in a test case file in the same
32
-     * directory and with the same name, using the .inc extension.
33
-     *
34
-     * @return void
35
-     */
36
-    public function setUp()
37
-    {
38
-        $config            = new Config();
39
-        $config->standards = ['Generic'];
28
+	/**
29
+	 * Initialize & tokenize \PHP_CodeSniffer\Files\File with code from the test case file.
30
+	 *
31
+	 * Methods used for these tests can be found in a test case file in the same
32
+	 * directory and with the same name, using the .inc extension.
33
+	 *
34
+	 * @return void
35
+	 */
36
+	public function setUp()
37
+	{
38
+		$config            = new Config();
39
+		$config->standards = ['Generic'];
40 40
 
41
-        $ruleset = new Ruleset($config);
41
+		$ruleset = new Ruleset($config);
42 42
 
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
-        $this->phpcsFile->process();
43
+		$pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
+		$this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
45
+		$this->phpcsFile->process();
46 46
 
47
-    }//end setUp()
47
+	}//end setUp()
48 48
 
49 49
 
50
-    /**
51
-     * Clean up after finished test.
52
-     *
53
-     * @return void
54
-     */
55
-    public function tearDown()
56
-    {
57
-        unset($this->phpcsFile);
50
+	/**
51
+	 * Clean up after finished test.
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function tearDown()
56
+	{
57
+		unset($this->phpcsFile);
58 58
 
59
-    }//end tearDown()
59
+	}//end tearDown()
60 60
 
61 61
 
62
-    /**
63
-     * Test a class that extends another.
64
-     *
65
-     * @param string $identifier Comment which precedes the test case.
66
-     * @param bool   $expected   Expected function output.
67
-     *
68
-     * @dataProvider dataIsReference
69
-     *
70
-     * @return void
71
-     */
72
-    public function testIsReference($identifier, $expected)
73
-    {
74
-        $start      = ($this->phpcsFile->numTokens - 1);
75
-        $delim      = $this->phpcsFile->findPrevious(
76
-            T_COMMENT,
77
-            $start,
78
-            null,
79
-            false,
80
-            $identifier
81
-        );
82
-        $bitwiseAnd = $this->phpcsFile->findNext(T_BITWISE_AND, ($delim + 1));
62
+	/**
63
+	 * Test a class that extends another.
64
+	 *
65
+	 * @param string $identifier Comment which precedes the test case.
66
+	 * @param bool   $expected   Expected function output.
67
+	 *
68
+	 * @dataProvider dataIsReference
69
+	 *
70
+	 * @return void
71
+	 */
72
+	public function testIsReference($identifier, $expected)
73
+	{
74
+		$start      = ($this->phpcsFile->numTokens - 1);
75
+		$delim      = $this->phpcsFile->findPrevious(
76
+			T_COMMENT,
77
+			$start,
78
+			null,
79
+			false,
80
+			$identifier
81
+		);
82
+		$bitwiseAnd = $this->phpcsFile->findNext(T_BITWISE_AND, ($delim + 1));
83 83
 
84
-        $result = $this->phpcsFile->isReference($bitwiseAnd);
85
-        $this->assertSame($expected, $result);
84
+		$result = $this->phpcsFile->isReference($bitwiseAnd);
85
+		$this->assertSame($expected, $result);
86 86
 
87
-    }//end testIsReference()
87
+	}//end testIsReference()
88 88
 
89 89
 
90
-    /**
91
-     * Data provider for the IsReference test.
92
-     *
93
-     * @see testIsReference()
94
-     *
95
-     * @return array
96
-     */
97
-    public function dataIsReference()
98
-    {
99
-        return [
100
-            [
101
-                '/* bitwiseAndA */',
102
-                false,
103
-            ],
104
-            [
105
-                '/* bitwiseAndB */',
106
-                false,
107
-            ],
108
-            [
109
-                '/* bitwiseAndC */',
110
-                false,
111
-            ],
112
-            [
113
-                '/* bitwiseAndD */',
114
-                false,
115
-            ],
116
-            [
117
-                '/* bitwiseAndE */',
118
-                false,
119
-            ],
120
-            [
121
-                '/* bitwiseAndF */',
122
-                false,
123
-            ],
124
-            [
125
-                '/* bitwiseAndG */',
126
-                false,
127
-            ],
128
-            [
129
-                '/* bitwiseAndH */',
130
-                false,
131
-            ],
132
-            [
133
-                '/* bitwiseAndI */',
134
-                false,
135
-            ],
136
-            [
137
-                '/* functionReturnByReference */',
138
-                true,
139
-            ],
140
-            [
141
-                '/* functionPassByReferenceA */',
142
-                true,
143
-            ],
144
-            [
145
-                '/* functionPassByReferenceB */',
146
-                true,
147
-            ],
148
-            [
149
-                '/* functionPassByReferenceC */',
150
-                true,
151
-            ],
152
-            [
153
-                '/* functionPassByReferenceD */',
154
-                true,
155
-            ],
156
-            [
157
-                '/* functionPassByReferenceE */',
158
-                true,
159
-            ],
160
-            [
161
-                '/* functionPassByReferenceF */',
162
-                true,
163
-            ],
164
-            [
165
-                '/* functionPassByReferenceG */',
166
-                true,
167
-            ],
168
-            [
169
-                '/* foreachValueByReference */',
170
-                true,
171
-            ],
172
-            [
173
-                '/* foreachKeyByReference */',
174
-                true,
175
-            ],
176
-            [
177
-                '/* arrayValueByReferenceA */',
178
-                true,
179
-            ],
180
-            [
181
-                '/* arrayValueByReferenceB */',
182
-                true,
183
-            ],
184
-            [
185
-                '/* arrayValueByReferenceC */',
186
-                true,
187
-            ],
188
-            [
189
-                '/* arrayValueByReferenceD */',
190
-                true,
191
-            ],
192
-            [
193
-                '/* arrayValueByReferenceE */',
194
-                true,
195
-            ],
196
-            [
197
-                '/* arrayValueByReferenceF */',
198
-                true,
199
-            ],
200
-            [
201
-                '/* arrayValueByReferenceG */',
202
-                true,
203
-            ],
204
-            [
205
-                '/* arrayValueByReferenceH */',
206
-                true,
207
-            ],
208
-            [
209
-                '/* assignByReferenceA */',
210
-                true,
211
-            ],
212
-            [
213
-                '/* assignByReferenceB */',
214
-                true,
215
-            ],
216
-            [
217
-                '/* assignByReferenceC */',
218
-                true,
219
-            ],
220
-            [
221
-                '/* assignByReferenceD */',
222
-                true,
223
-            ],
224
-            [
225
-                '/* assignByReferenceE */',
226
-                true,
227
-            ],
228
-            [
229
-                '/* passByReferenceA */',
230
-                true,
231
-            ],
232
-            [
233
-                '/* passByReferenceB */',
234
-                true,
235
-            ],
236
-            [
237
-                '/* passByReferenceC */',
238
-                true,
239
-            ],
240
-            [
241
-                '/* passByReferenceD */',
242
-                true,
243
-            ],
244
-            [
245
-                '/* passByReferenceE */',
246
-                true,
247
-            ],
248
-            [
249
-                '/* passByReferenceF */',
250
-                true,
251
-            ],
252
-            [
253
-                '/* passByReferenceG */',
254
-                true,
255
-            ],
256
-            [
257
-                '/* passByReferenceH */',
258
-                true,
259
-            ],
260
-            [
261
-                '/* passByReferenceI */',
262
-                true,
263
-            ],
264
-            [
265
-                '/* passByReferenceJ */',
266
-                true,
267
-            ],
268
-            [
269
-                '/* newByReferenceA */',
270
-                true,
271
-            ],
272
-            [
273
-                '/* newByReferenceB */',
274
-                true,
275
-            ],
276
-            [
277
-                '/* useByReference */',
278
-                true,
279
-            ],
280
-        ];
90
+	/**
91
+	 * Data provider for the IsReference test.
92
+	 *
93
+	 * @see testIsReference()
94
+	 *
95
+	 * @return array
96
+	 */
97
+	public function dataIsReference()
98
+	{
99
+		return [
100
+			[
101
+				'/* bitwiseAndA */',
102
+				false,
103
+			],
104
+			[
105
+				'/* bitwiseAndB */',
106
+				false,
107
+			],
108
+			[
109
+				'/* bitwiseAndC */',
110
+				false,
111
+			],
112
+			[
113
+				'/* bitwiseAndD */',
114
+				false,
115
+			],
116
+			[
117
+				'/* bitwiseAndE */',
118
+				false,
119
+			],
120
+			[
121
+				'/* bitwiseAndF */',
122
+				false,
123
+			],
124
+			[
125
+				'/* bitwiseAndG */',
126
+				false,
127
+			],
128
+			[
129
+				'/* bitwiseAndH */',
130
+				false,
131
+			],
132
+			[
133
+				'/* bitwiseAndI */',
134
+				false,
135
+			],
136
+			[
137
+				'/* functionReturnByReference */',
138
+				true,
139
+			],
140
+			[
141
+				'/* functionPassByReferenceA */',
142
+				true,
143
+			],
144
+			[
145
+				'/* functionPassByReferenceB */',
146
+				true,
147
+			],
148
+			[
149
+				'/* functionPassByReferenceC */',
150
+				true,
151
+			],
152
+			[
153
+				'/* functionPassByReferenceD */',
154
+				true,
155
+			],
156
+			[
157
+				'/* functionPassByReferenceE */',
158
+				true,
159
+			],
160
+			[
161
+				'/* functionPassByReferenceF */',
162
+				true,
163
+			],
164
+			[
165
+				'/* functionPassByReferenceG */',
166
+				true,
167
+			],
168
+			[
169
+				'/* foreachValueByReference */',
170
+				true,
171
+			],
172
+			[
173
+				'/* foreachKeyByReference */',
174
+				true,
175
+			],
176
+			[
177
+				'/* arrayValueByReferenceA */',
178
+				true,
179
+			],
180
+			[
181
+				'/* arrayValueByReferenceB */',
182
+				true,
183
+			],
184
+			[
185
+				'/* arrayValueByReferenceC */',
186
+				true,
187
+			],
188
+			[
189
+				'/* arrayValueByReferenceD */',
190
+				true,
191
+			],
192
+			[
193
+				'/* arrayValueByReferenceE */',
194
+				true,
195
+			],
196
+			[
197
+				'/* arrayValueByReferenceF */',
198
+				true,
199
+			],
200
+			[
201
+				'/* arrayValueByReferenceG */',
202
+				true,
203
+			],
204
+			[
205
+				'/* arrayValueByReferenceH */',
206
+				true,
207
+			],
208
+			[
209
+				'/* assignByReferenceA */',
210
+				true,
211
+			],
212
+			[
213
+				'/* assignByReferenceB */',
214
+				true,
215
+			],
216
+			[
217
+				'/* assignByReferenceC */',
218
+				true,
219
+			],
220
+			[
221
+				'/* assignByReferenceD */',
222
+				true,
223
+			],
224
+			[
225
+				'/* assignByReferenceE */',
226
+				true,
227
+			],
228
+			[
229
+				'/* passByReferenceA */',
230
+				true,
231
+			],
232
+			[
233
+				'/* passByReferenceB */',
234
+				true,
235
+			],
236
+			[
237
+				'/* passByReferenceC */',
238
+				true,
239
+			],
240
+			[
241
+				'/* passByReferenceD */',
242
+				true,
243
+			],
244
+			[
245
+				'/* passByReferenceE */',
246
+				true,
247
+			],
248
+			[
249
+				'/* passByReferenceF */',
250
+				true,
251
+			],
252
+			[
253
+				'/* passByReferenceG */',
254
+				true,
255
+			],
256
+			[
257
+				'/* passByReferenceH */',
258
+				true,
259
+			],
260
+			[
261
+				'/* passByReferenceI */',
262
+				true,
263
+			],
264
+			[
265
+				'/* passByReferenceJ */',
266
+				true,
267
+			],
268
+			[
269
+				'/* newByReferenceA */',
270
+				true,
271
+			],
272
+			[
273
+				'/* newByReferenceB */',
274
+				true,
275
+			],
276
+			[
277
+				'/* useByReference */',
278
+				true,
279
+			],
280
+		];
281 281
 
282
-    }//end dataIsReference()
282
+	}//end dataIsReference()
283 283
 
284 284
 
285 285
 }//end class
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
     public function setUp()
37 37
     {
38 38
         $config            = new Config();
39
-        $config->standards = ['Generic'];
39
+        $config->standards = [ 'Generic' ];
40 40
 
41
-        $ruleset = new Ruleset($config);
41
+        $ruleset = new Ruleset( $config );
42 42
 
43
-        $pathToTestFile  = dirname(__FILE__).'/'.basename(__FILE__, '.php').'.inc';
44
-        $this->phpcsFile = new DummyFile(file_get_contents($pathToTestFile), $ruleset, $config);
43
+        $pathToTestFile  = dirname( __FILE__ ) . '/' . basename( __FILE__, '.php' ) . '.inc';
44
+        $this->phpcsFile = new DummyFile( file_get_contents( $pathToTestFile ), $ruleset, $config );
45 45
         $this->phpcsFile->process();
46 46
 
47 47
     }//end setUp()
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function tearDown()
56 56
     {
57
-        unset($this->phpcsFile);
57
+        unset( $this->phpcsFile );
58 58
 
59 59
     }//end tearDown()
60 60
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return void
71 71
      */
72
-    public function testIsReference($identifier, $expected)
72
+    public function testIsReference( $identifier, $expected )
73 73
     {
74
-        $start      = ($this->phpcsFile->numTokens - 1);
74
+        $start      = ( $this->phpcsFile->numTokens - 1 );
75 75
         $delim      = $this->phpcsFile->findPrevious(
76 76
             T_COMMENT,
77 77
             $start,
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
             false,
80 80
             $identifier
81 81
         );
82
-        $bitwiseAnd = $this->phpcsFile->findNext(T_BITWISE_AND, ($delim + 1));
82
+        $bitwiseAnd = $this->phpcsFile->findNext( T_BITWISE_AND, ( $delim + 1 ) );
83 83
 
84
-        $result = $this->phpcsFile->isReference($bitwiseAnd);
85
-        $this->assertSame($expected, $result);
84
+        $result = $this->phpcsFile->isReference( $bitwiseAnd );
85
+        $this->assertSame( $expected, $result );
86 86
 
87 87
     }//end testIsReference()
88 88
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use PHP_CodeSniffer\Files\DummyFile;
15 15
 use PHPUnit\Framework\TestCase;
16 16
 
17
-class IsReferenceTest extends TestCase
18
-{
17
+class IsReferenceTest extends TestCase {
19 18
 
20 19
     /**
21 20
      * The PHP_CodeSniffer_File object containing parsed contents of the test case file.
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return void
35 34
      */
36
-    public function setUp()
37
-    {
35
+    public function setUp() {
38 36
         $config            = new Config();
39 37
         $config->standards = ['Generic'];
40 38
 
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      *
53 51
      * @return void
54 52
      */
55
-    public function tearDown()
56
-    {
53
+    public function tearDown() {
57 54
         unset($this->phpcsFile);
58 55
 
59 56
     }//end tearDown()
@@ -69,8 +66,7 @@  discard block
 block discarded – undo
69 66
      *
70 67
      * @return void
71 68
      */
72
-    public function testIsReference($identifier, $expected)
73
-    {
69
+    public function testIsReference($identifier, $expected) {
74 70
         $start      = ($this->phpcsFile->numTokens - 1);
75 71
         $delim      = $this->phpcsFile->findPrevious(
76 72
             T_COMMENT,
@@ -94,8 +90,7 @@  discard block
 block discarded – undo
94 90
      *
95 91
      * @return array
96 92
      */
97
-    public function dataIsReference()
98
-    {
93
+    public function dataIsReference() {
99 94
         return [
100 95
             [
101 96
                 '/* bitwiseAndA */',
Please login to merge, or discard this patch.
squizlabs/php_codesniffer/tests/Core/File/FindExtendedClassNameTest.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 interface testFECNInterface {}
18 18
 
19 19
 /* testInterfaceThatExtendsInterface */
20
-interface testInterfaceThatExtendsInterface extends testFECNInterface{}
20
+interface testInterfaceThatExtendsInterface extends testFECNInterface {}
21 21
 
22 22
 /* testInterfaceThatExtendsFQCNInterface */
23
-interface testInterfaceThatExtendsFQCNInterface extends \PHP_CodeSniffer\Tests\Core\File\testFECNInterface{}
23
+interface testInterfaceThatExtendsFQCNInterface extends \PHP_CodeSniffer\Tests\Core\File\testFECNInterface {}
24 24
 
25 25
 /* testNestedExtendedClass */
26 26
 class testFECNNestedExtendedClass {
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/tests/Core/File/IsReferenceTest.inc 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 $a = $something & $somethingElse;
25 25
 
26 26
 /* bitwiseAndH */
27
-function myFunction($a = 10 & 20) {}
27
+function myFunction( $a = 10 & 20 ) {}
28 28
 
29 29
 /* bitwiseAndI */
30
-$closure = function ($a = MY_CONSTANT & parent::OTHER_CONSTANT) {};
30
+$closure = function( $a = MY_CONSTANT & parent::OTHER_CONSTANT ) {};
31 31
 
32 32
 /* functionReturnByReference */
33 33
 function &myFunction() {}
@@ -39,25 +39,25 @@  discard block
 block discarded – undo
39 39
 function myFunction( $a, &$b ) {}
40 40
 
41 41
 /* functionPassByReferenceC */
42
-$closure = function ( &$a ) {};
42
+$closure = function( &$a ) {};
43 43
 
44 44
 /* functionPassByReferenceD */
45
-$closure = function ( $a, &$b ) {};
45
+$closure = function( $a, &$b ) {};
46 46
 
47 47
 /* functionPassByReferenceE */
48
-function myFunction(array &$one) {}
48
+function myFunction( array &$one ) {}
49 49
 
50 50
 /* functionPassByReferenceF */
51
-$closure = function (\MyClass &$one) {};
51
+$closure = function( \MyClass &$one ) {};
52 52
 
53 53
 /* functionPassByReferenceG */
54
-$closure = function myFunc($param, &...$moreParams) {};
54
+$closure = function myFunc( $param, &...$moreParams ) {};
55 55
 
56 56
 /* foreachValueByReference */
57
-foreach( $array as $key => &$value ) {}
57
+foreach ( $array as $key => &$value ) {}
58 58
 
59 59
 /* foreachKeyByReference */
60
-foreach( $array as &$key => $value ) {}
60
+foreach ( $array as &$key => $value ) {}
61 61
 
62 62
 /* arrayValueByReferenceA */
63 63
 $a = [ 'a' => &$something ];
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 $b = &$something;
88 88
 
89 89
 /* assignByReferenceB */
90
-$b =& $something;
90
+$b = & $something;
91 91
 
92 92
 /* assignByReferenceC */
93 93
 $b .= &$something;
@@ -99,40 +99,40 @@  discard block
 block discarded – undo
99 99
 $collection = &collector();
100 100
 
101 101
 /* passByReferenceA */
102
-functionCall(&$something, $somethingElse);
102
+functionCall( &$something, $somethingElse );
103 103
 
104 104
 /* passByReferenceB */
105
-functionCall($something, &$somethingElse);
105
+functionCall( $something, &$somethingElse );
106 106
 
107 107
 /* passByReferenceC */
108
-functionCall($something, &$this->somethingElse);
108
+functionCall( $something, &$this->somethingElse );
109 109
 
110 110
 /* passByReferenceD */
111
-functionCall($something, &self::$somethingElse);
111
+functionCall( $something, &self::$somethingElse );
112 112
 
113 113
 /* passByReferenceE */
114
-functionCall($something, &parent::$somethingElse);
114
+functionCall( $something, &parent::$somethingElse );
115 115
 
116 116
 /* passByReferenceF */
117
-functionCall($something, &static::$somethingElse);
117
+functionCall( $something, &static::$somethingElse );
118 118
 
119 119
 /* passByReferenceG */
120
-functionCall($something, &SomeClass::$somethingElse);
120
+functionCall( $something, &SomeClass::$somethingElse );
121 121
 
122 122
 /* passByReferenceH */
123
-functionCall(&\SomeClass::$somethingElse);
123
+functionCall( &\SomeClass::$somethingElse );
124 124
 
125 125
 /* passByReferenceI */
126
-functionCall($something, &\SomeNS\SomeClass::$somethingElse);
126
+functionCall( $something, &\SomeNS\SomeClass::$somethingElse );
127 127
 
128 128
 /* passByReferenceJ */
129
-functionCall($something, &namespace\SomeClass::$somethingElse);
129
+functionCall( $something, &namespace\SomeClass::$somethingElse );
130 130
 
131 131
 /* newByReferenceA */
132 132
 $foobar2 = &new Foobar();
133 133
 
134 134
 /* newByReferenceB */
135
-functionCall( $something , &new Foobar() );
135
+functionCall( $something, &new Foobar() );
136 136
 
137 137
 /* useByReference */
138
-$closure = function() use (&$var){};
138
+$closure = function() use ( &$var ){};
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/tests/Core/AllTests.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -26,38 +26,38 @@
 block discarded – undo
26 26
 {
27 27
 
28 28
 
29
-    /**
30
-     * Prepare the test runner.
31
-     *
32
-     * @return void
33
-     */
34
-    public static function main()
35
-    {
36
-        TestRunner::run(self::suite());
37
-
38
-    }//end main()
39
-
40
-
41
-    /**
42
-     * Add all core unit tests into a test suite.
43
-     *
44
-     * @return \PHPUnit\Framework\TestSuite
45
-     */
46
-    public static function suite()
47
-    {
48
-        $suite = new TestSuite('PHP CodeSniffer Core');
49
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\IsCamelCapsTest');
50
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\ErrorSuppressionTest');
51
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindEndOfStatementTest');
52
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindExtendedClassNameTest');
53
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindImplementedInterfaceNamesTest');
54
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMemberPropertiesTest');
55
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMethodParametersTest');
56
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMethodPropertiesTest');
57
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\IsReferenceTest');
58
-        return $suite;
59
-
60
-    }//end suite()
29
+	/**
30
+	 * Prepare the test runner.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public static function main()
35
+	{
36
+		TestRunner::run(self::suite());
37
+
38
+	}//end main()
39
+
40
+
41
+	/**
42
+	 * Add all core unit tests into a test suite.
43
+	 *
44
+	 * @return \PHPUnit\Framework\TestSuite
45
+	 */
46
+	public static function suite()
47
+	{
48
+		$suite = new TestSuite('PHP CodeSniffer Core');
49
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\IsCamelCapsTest');
50
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\ErrorSuppressionTest');
51
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindEndOfStatementTest');
52
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindExtendedClassNameTest');
53
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindImplementedInterfaceNamesTest');
54
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMemberPropertiesTest');
55
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMethodParametersTest');
56
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMethodPropertiesTest');
57
+		$suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\IsReferenceTest');
58
+		return $suite;
59
+
60
+	}//end suite()
61 61
 
62 62
 
63 63
 }//end class
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public static function main()
35 35
     {
36
-        TestRunner::run(self::suite());
36
+        TestRunner::run( self::suite() );
37 37
 
38 38
     }//end main()
39 39
 
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public static function suite()
47 47
     {
48
-        $suite = new TestSuite('PHP CodeSniffer Core');
49
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\IsCamelCapsTest');
50
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\ErrorSuppressionTest');
51
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindEndOfStatementTest');
52
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindExtendedClassNameTest');
53
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\FindImplementedInterfaceNamesTest');
54
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMemberPropertiesTest');
55
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMethodParametersTest');
56
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\GetMethodPropertiesTest');
57
-        $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\File\IsReferenceTest');
48
+        $suite = new TestSuite( 'PHP CodeSniffer Core' );
49
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\IsCamelCapsTest' );
50
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\ErrorSuppressionTest' );
51
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\File\FindEndOfStatementTest' );
52
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\File\FindExtendedClassNameTest' );
53
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\File\FindImplementedInterfaceNamesTest' );
54
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\File\GetMemberPropertiesTest' );
55
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\File\GetMethodParametersTest' );
56
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\File\GetMethodPropertiesTest' );
57
+        $suite->addTestSuite( 'PHP_CodeSniffer\Tests\Core\File\IsReferenceTest' );
58 58
         return $suite;
59 59
 
60 60
     }//end suite()
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 require_once 'File/GetMethodPropertiesTest.php';
23 23
 require_once 'File/IsReferenceTest.php';
24 24
 
25
-class AllTests
26
-{
25
+class AllTests {
27 26
 
28 27
 
29 28
     /**
@@ -31,8 +30,7 @@  discard block
 block discarded – undo
31 30
      *
32 31
      * @return void
33 32
      */
34
-    public static function main()
35
-    {
33
+    public static function main() {
36 34
         TestRunner::run(self::suite());
37 35
 
38 36
     }//end main()
@@ -43,8 +41,7 @@  discard block
 block discarded – undo
43 41
      *
44 42
      * @return \PHPUnit\Framework\TestSuite
45 43
      */
46
-    public static function suite()
47
-    {
44
+    public static function suite() {
48 45
         $suite = new TestSuite('PHP CodeSniffer Core');
49 46
         $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\IsCamelCapsTest');
50 47
         $suite->addTestSuite('PHP_CodeSniffer\Tests\Core\ErrorSuppressionTest');
Please login to merge, or discard this patch.