Skip to content

Commit 8e61fdc

Browse files
authored
Merge pull request #215 from PHPCSStandards/feature/file-getclassproperties-improve-tests
Tests/GetClassPropertiesTest: minor improvements
2 parents b43fb8e + 5630c3b commit 8e61fdc

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

tests/Core/File/GetClassPropertiesTest.php

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class GetClassPropertiesTest extends AbstractMethodUnitTest
2323
/**
2424
* Test receiving an expected exception when a non class token is passed.
2525
*
26-
* @param string $testMarker The comment which prefaces the target token in the test file.
27-
* @param array $tokenType The type of token to look for after the marker.
26+
* @param string $testMarker The comment which prefaces the target token in the test file.
27+
* @param int|string $tokenType The type of token to look for after the marker.
2828
*
2929
* @dataProvider dataNotAClassException
3030
*
@@ -45,22 +45,22 @@ public function testNotAClassException($testMarker, $tokenType)
4545
*
4646
* @see testNotAClassException() For the array format.
4747
*
48-
* @return array
48+
* @return array<string, array<string, string|int>>
4949
*/
5050
public function dataNotAClassException()
5151
{
5252
return [
5353
'interface' => [
54-
'/* testNotAClass */',
55-
\T_INTERFACE,
54+
'testMarker' => '/* testNotAClass */',
55+
'tokenType' => \T_INTERFACE,
5656
],
5757
'anon-class' => [
58-
'/* testAnonClass */',
59-
\T_ANON_CLASS,
58+
'testMarker' => '/* testAnonClass */',
59+
'tokenType' => \T_ANON_CLASS,
6060
],
6161
'enum' => [
62-
'/* testEnum */',
63-
\T_ENUM,
62+
'testMarker' => '/* testEnum */',
63+
'tokenType' => \T_ENUM,
6464
],
6565
];
6666

@@ -70,8 +70,8 @@ public function dataNotAClassException()
7070
/**
7171
* Test retrieving the properties for a class declaration.
7272
*
73-
* @param string $testMarker The comment which prefaces the target token in the test file.
74-
* @param array $expected Expected function output.
73+
* @param string $testMarker The comment which prefaces the target token in the test file.
74+
* @param array<string, bool> $expected Expected function output.
7575
*
7676
* @dataProvider dataGetClassProperties
7777
*
@@ -91,94 +91,94 @@ public function testGetClassProperties($testMarker, $expected)
9191
*
9292
* @see testGetClassProperties() For the array format.
9393
*
94-
* @return array
94+
* @return array<string, array<string, string|array<string, bool|int>>>
9595
*/
9696
public function dataGetClassProperties()
9797
{
9898
return [
9999
'no-properties' => [
100-
'/* testClassWithoutProperties */',
101-
[
100+
'testMarker' => '/* testClassWithoutProperties */',
101+
'expected' => [
102102
'is_abstract' => false,
103103
'is_final' => false,
104104
'is_readonly' => false,
105105
],
106106
],
107107
'abstract' => [
108-
'/* testAbstractClass */',
109-
[
108+
'testMarker' => '/* testAbstractClass */',
109+
'expected' => [
110110
'is_abstract' => true,
111111
'is_final' => false,
112112
'is_readonly' => false,
113113
],
114114
],
115115
'final' => [
116-
'/* testFinalClass */',
117-
[
116+
'testMarker' => '/* testFinalClass */',
117+
'expected' => [
118118
'is_abstract' => false,
119119
'is_final' => true,
120120
'is_readonly' => false,
121121
],
122122
],
123123
'readonly' => [
124-
'/* testReadonlyClass */',
125-
[
124+
'testMarker' => '/* testReadonlyClass */',
125+
'expected' => [
126126
'is_abstract' => false,
127127
'is_final' => false,
128128
'is_readonly' => true,
129129
],
130130
],
131131
'final-readonly' => [
132-
'/* testFinalReadonlyClass */',
133-
[
132+
'testMarker' => '/* testFinalReadonlyClass */',
133+
'expected' => [
134134
'is_abstract' => false,
135135
'is_final' => true,
136136
'is_readonly' => true,
137137
],
138138
],
139139
'readonly-final' => [
140-
'/* testReadonlyFinalClass */',
141-
[
140+
'testMarker' => '/* testReadonlyFinalClass */',
141+
'expected' => [
142142
'is_abstract' => false,
143143
'is_final' => true,
144144
'is_readonly' => true,
145145
],
146146
],
147147
'abstract-readonly' => [
148-
'/* testAbstractReadonlyClass */',
149-
[
148+
'testMarker' => '/* testAbstractReadonlyClass */',
149+
'expected' => [
150150
'is_abstract' => true,
151151
'is_final' => false,
152152
'is_readonly' => true,
153153
],
154154
],
155155
'readonly-abstract' => [
156-
'/* testReadonlyAbstractClass */',
157-
[
156+
'testMarker' => '/* testReadonlyAbstractClass */',
157+
'expected' => [
158158
'is_abstract' => true,
159159
'is_final' => false,
160160
'is_readonly' => true,
161161
],
162162
],
163163
'comments-and-new-lines' => [
164-
'/* testWithCommentsAndNewLines */',
165-
[
164+
'testMarker' => '/* testWithCommentsAndNewLines */',
165+
'expected' => [
166166
'is_abstract' => true,
167167
'is_final' => false,
168168
'is_readonly' => false,
169169
],
170170
],
171171
'no-properties-with-docblock' => [
172-
'/* testWithDocblockWithoutProperties */',
173-
[
172+
'testMarker' => '/* testWithDocblockWithoutProperties */',
173+
'expected' => [
174174
'is_abstract' => false,
175175
'is_final' => false,
176176
'is_readonly' => false,
177177
],
178178
],
179179
'abstract-final-parse-error' => [
180-
'/* testParseErrorAbstractFinal */',
181-
[
180+
'testMarker' => '/* testParseErrorAbstractFinal */',
181+
'expected' => [
182182
'is_abstract' => true,
183183
'is_final' => true,
184184
'is_readonly' => false,

0 commit comments

Comments
 (0)