Skip to content

Commit 08a4b8b

Browse files
committed
Tests/SetSniffPropertyTest: use named data within data sets
This commit adds the parameter name for each item in the data set in an effort to make it more straight forward to update and add tests as it will be more obvious what each key in the data set signifies. Includes minor array normalization. Includes making the data type in the docblock more specific.
1 parent ecbdc37 commit 08a4b8b

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

tests/Core/Ruleset/SetSniffPropertyTest.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testSniffPropertiesGetSetWhenAllowed($name)
7272
*
7373
* @see self::testSniffPropertiesGetSetWhenAllowed()
7474
*
75-
* @return array
75+
* @return array<string, array<string>>
7676
*/
7777
public static function dataSniffPropertiesGetSetWhenAllowed()
7878
{
@@ -313,34 +313,40 @@ public function testDirectCallWithOldArrayFormatSetsProperty($propertyValue)
313313
*
314314
* @see self::testDirectCallWithOldArrayFormatSetsProperty()
315315
*
316-
* @return array
316+
* @return array<string, array<string, mixed>>
317317
*/
318318
public static function dataDirectCallWithOldArrayFormatSetsProperty()
319319
{
320320
return [
321-
'Property value is not an array (boolean)' => [false],
322-
'Property value is not an array (string)' => ['a string'],
323-
'Property value is an empty array' => [[]],
321+
'Property value is not an array (boolean)' => [
322+
'propertyValue' => false,
323+
],
324+
'Property value is not an array (string)' => [
325+
'propertyValue' => 'a string',
326+
],
327+
'Property value is an empty array' => [
328+
'propertyValue' => [],
329+
],
324330
'Property value is an array without keys' => [
325-
[
331+
'propertyValue' => [
326332
'value',
327333
false,
328334
],
329335
],
330336
'Property value is an array without the "scope" or "value" keys' => [
331-
[
337+
'propertyValue' => [
332338
'key1' => 'value',
333339
'key2' => false,
334340
],
335341
],
336342
'Property value is an array without the "scope" key' => [
337-
[
343+
'propertyValue' => [
338344
'key1' => 'value',
339345
'value' => true,
340346
],
341347
],
342348
'Property value is an array without the "value" key' => [
343-
[
349+
'propertyValue' => [
344350
'scope' => 'value',
345351
'key2' => 1234,
346352
],

0 commit comments

Comments
 (0)