Skip to content

Commit e6e2a6e

Browse files
committed
Prohibit square-bracket and key-less array; use list instead
1 parent 94e2e6c commit e6e2a6e

22 files changed

+101
-93
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
'yoda_style' => false,
2323
'concat_space' => ['spacing' => 'one'],
2424
'phpdoc_types_order' => ['null_adjustment' => 'always_first'],
25+
'phpdoc_array_type' => true,
26+
'phpdoc_list_type' => true,
2527
])
2628
->setFinder($finder);

src/Behat/Gherkin/Cache/MemoryCache.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@
2020
*/
2121
class MemoryCache implements CacheInterface
2222
{
23-
private $features = [];
24-
private $timestamps = [];
23+
/**
24+
* @var array<string, FeatureNode>
25+
*/
26+
private array $features = [];
27+
/**
28+
* @var array<string, int>
29+
*/
30+
private array $timestamps = [];
2531

2632
/**
2733
* Checks that cache for feature exists and is fresh.

src/Behat/Gherkin/Filter/PathsFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PathsFilter extends SimpleFilter
2525
/**
2626
* Initializes filter.
2727
*
28-
* @param string[] $paths List of approved paths
28+
* @param list<string> $paths List of approved paths
2929
*/
3030
public function __construct(array $paths)
3131
{

src/Behat/Gherkin/Filter/TagFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function isScenarioMatch(FeatureNode $feature, ScenarioInterface $scenari
126126
/**
127127
* Checks that node matches condition.
128128
*
129-
* @param string[] $tags
129+
* @param list<string> $tags
130130
*
131131
* @return bool
132132
*/

src/Behat/Gherkin/Gherkin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class Gherkin
2626
public const VERSION = '4.8.0';
2727

2828
/**
29-
* @var LoaderInterface[]
29+
* @var list<LoaderInterface>
3030
*/
3131
protected $loaders = [];
3232
/**
33-
* @var FeatureFilterInterface[]
33+
* @var list<FeatureFilterInterface>
3434
*/
3535
protected $filters = [];
3636

@@ -57,7 +57,7 @@ public function addFilter(FeatureFilterInterface $filter)
5757
/**
5858
* Sets filters to the parser.
5959
*
60-
* @param FeatureFilterInterface[] $filters
60+
* @param list<FeatureFilterInterface> $filters
6161
*/
6262
public function setFilters(array $filters)
6363
{
@@ -82,8 +82,8 @@ public function setBasePath($path)
8282
/**
8383
* Loads & filters resource with added loaders.
8484
*
85-
* @param mixed $resource Resource to load
86-
* @param FeatureFilterInterface[] $filters Additional filters
85+
* @param mixed $resource Resource to load
86+
* @param list<FeatureFilterInterface> $filters Additional filters
8787
*
8888
* @return array
8989
*/

src/Behat/Gherkin/Loader/ArrayLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function supports($resource)
4343
*
4444
* @param mixed $resource Resource to load
4545
*
46-
* @return FeatureNode[]
46+
* @return list<FeatureNode>
4747
*/
4848
public function load($resource)
4949
{
@@ -195,7 +195,7 @@ protected function loadOutlineHash(array $hash, $line = 0)
195195
/**
196196
* Loads steps from provided hash.
197197
*
198-
* @return StepNode[]
198+
* @return list<StepNode>
199199
*/
200200
private function loadStepsHash(array $hash)
201201
{

src/Behat/Gherkin/Loader/CucumberNDJsonAstLoader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private static function getFeature(array $json, $filePath)
6565
}
6666

6767
/**
68-
* @return string[]
68+
* @return list<string>
6969
*/
7070
private static function getTags(array $json)
7171
{
@@ -76,7 +76,7 @@ static function (array $tag) { return preg_replace('/^@/', '', $tag['name']); },
7676
}
7777

7878
/**
79-
* @return ScenarioInterface[]
79+
* @return list<ScenarioInterface>
8080
*/
8181
private static function getScenarios(array $json)
8282
{
@@ -140,7 +140,7 @@ static function ($child) {
140140
}
141141

142142
/**
143-
* @return StepNode[]
143+
* @return list<StepNode>
144144
*/
145145
private static function getSteps(array $json)
146146
{
@@ -159,7 +159,7 @@ static function (array $json) {
159159
}
160160

161161
/**
162-
* @return ExampleTableNode[]
162+
* @return list<ExampleTableNode>
163163
*/
164164
private static function getTables(array $json)
165165
{

src/Behat/Gherkin/Loader/DirectoryLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function supports($path)
5050
*
5151
* @param string $path Resource to load
5252
*
53-
* @return FeatureNode[]
53+
* @return list<FeatureNode>
5454
*/
5555
public function load($path)
5656
{

src/Behat/Gherkin/Loader/GherkinFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function supports($path)
6565
*
6666
* @param string $path Resource to load
6767
*
68-
* @return FeatureNode[]
68+
* @return list<FeatureNode>
6969
*/
7070
public function load($path)
7171
{

src/Behat/Gherkin/Loader/LoaderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function supports($resource);
3333
*
3434
* @param mixed $resource Resource to load
3535
*
36-
* @return FeatureNode[]
36+
* @return list<FeatureNode>
3737
*/
3838
public function load($resource);
3939
}

0 commit comments

Comments
 (0)