diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 33682aa5..f1824f12 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -6,6 +6,7 @@ return (new PhpCsFixer\Config()) ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) + ->setRiskyAllowed(true) ->setRules([ '@PER-CS' => true, '@Symfony' => true, @@ -30,5 +31,7 @@ 'single_line_throw' => false, 'ternary_to_null_coalescing' => true, 'global_namespace_import' => false, + 'phpdoc_array_type' => true, + 'phpdoc_list_type' => true, ]) ->setFinder($finder); diff --git a/src/Behat/Gherkin/Filter/PathsFilter.php b/src/Behat/Gherkin/Filter/PathsFilter.php index c06ee902..4e3f9a06 100644 --- a/src/Behat/Gherkin/Filter/PathsFilter.php +++ b/src/Behat/Gherkin/Filter/PathsFilter.php @@ -25,19 +25,17 @@ class PathsFilter extends SimpleFilter /** * Initializes filter. * - * @param string[] $paths List of approved paths + * @param array $paths List of approved paths */ public function __construct(array $paths) { - $this->filterPaths = array_map( - function ($realpath) { - return rtrim($realpath, DIRECTORY_SEPARATOR) . - (is_dir($realpath) ? DIRECTORY_SEPARATOR : ''); - }, - array_filter( - array_map('realpath', $paths) - ) - ); + foreach ($paths as $path) { + if (($realpath = realpath($path)) === false) { + continue; + } + $this->filterPaths[] = rtrim($realpath, DIRECTORY_SEPARATOR) + . (is_dir($realpath) ? DIRECTORY_SEPARATOR : ''); + } } /** diff --git a/src/Behat/Gherkin/Filter/TagFilter.php b/src/Behat/Gherkin/Filter/TagFilter.php index 978856c1..0e1f0c04 100644 --- a/src/Behat/Gherkin/Filter/TagFilter.php +++ b/src/Behat/Gherkin/Filter/TagFilter.php @@ -128,7 +128,7 @@ public function isScenarioMatch(FeatureNode $feature, ScenarioInterface $scenari /** * Checks that node matches condition. * - * @param string[] $tags + * @param array $tags * * @return bool */ diff --git a/src/Behat/Gherkin/Gherkin.php b/src/Behat/Gherkin/Gherkin.php index e13db611..3664b0a1 100644 --- a/src/Behat/Gherkin/Gherkin.php +++ b/src/Behat/Gherkin/Gherkin.php @@ -31,11 +31,11 @@ class Gherkin public const VERSION = '4.8.0'; /** - * @var LoaderInterface[] + * @var list */ protected $loaders = []; /** - * @var FeatureFilterInterface[] + * @var list */ protected $filters = []; @@ -62,12 +62,12 @@ public function addFilter(FeatureFilterInterface $filter) /** * Sets filters to the parser. * - * @param FeatureFilterInterface[] $filters + * @param array $filters */ public function setFilters(array $filters) { $this->filters = []; - array_map([$this, 'addFilter'], $filters); + array_map($this->addFilter(...), $filters); } /** @@ -88,7 +88,7 @@ public function setBasePath($path) * Loads & filters resource with added loaders. * * @param mixed $resource Resource to load - * @param FeatureFilterInterface[] $filters Additional filters + * @param array $filters Additional filters * * @return array */ @@ -97,10 +97,10 @@ public function load($resource, array $filters = []) $filters = array_merge($this->filters, $filters); $matches = []; - if (preg_match('/^(.*)\:(\d+)-(\d+|\*)$/', $resource, $matches)) { + if (preg_match('/^(.*):(\d+)-(\d+|\*)$/', $resource, $matches)) { $resource = $matches[1]; $filters[] = new LineRangeFilter($matches[2], $matches[3]); - } elseif (preg_match('/^(.*)\:(\d+)$/', $resource, $matches)) { + } elseif (preg_match('/^(.*):(\d+)$/', $resource, $matches)) { $resource = $matches[1]; $filters[] = new LineFilter($matches[2]); } diff --git a/src/Behat/Gherkin/Loader/ArrayLoader.php b/src/Behat/Gherkin/Loader/ArrayLoader.php index 5ab06778..ab77cdd8 100644 --- a/src/Behat/Gherkin/Loader/ArrayLoader.php +++ b/src/Behat/Gherkin/Loader/ArrayLoader.php @@ -43,7 +43,7 @@ public function supports($resource) * * @param mixed $resource Resource to load * - * @return FeatureNode[] + * @return list */ public function load($resource) { @@ -195,7 +195,7 @@ protected function loadOutlineHash(array $hash, $line = 0) /** * Loads steps from provided hash. * - * @return StepNode[] + * @return list */ private function loadStepsHash(array $hash) { diff --git a/src/Behat/Gherkin/Loader/CucumberNDJsonAstLoader.php b/src/Behat/Gherkin/Loader/CucumberNDJsonAstLoader.php index 79ac5307..fe0e189d 100644 --- a/src/Behat/Gherkin/Loader/CucumberNDJsonAstLoader.php +++ b/src/Behat/Gherkin/Loader/CucumberNDJsonAstLoader.php @@ -65,18 +65,18 @@ private static function getFeature(array $json, $filePath) } /** - * @return string[] + * @return list */ private static function getTags(array $json) { return array_map( - static function (array $tag) { return preg_replace('/^@/', '', $tag['name']); }, - $json['tags'] ?? [] + static fn (array $tag) => preg_replace('/^@/', '', $tag['name']), + array_values($json['tags'] ?? []) ); } /** - * @return ScenarioInterface[] + * @return list */ private static function getScenarios(array $json) { @@ -92,15 +92,15 @@ static function ($child) { $child['scenario']['keyword'], $child['scenario']['location']['line'] ); - } else { - return new ScenarioNode( - $child['scenario']['name'], - self::getTags($child['scenario']), - self::getSteps($child['scenario']['steps'] ?? []), - $child['scenario']['keyword'], - $child['scenario']['location']['line'] - ); } + + return new ScenarioNode( + $child['scenario']['name'], + self::getTags($child['scenario']), + self::getSteps($child['scenario']['steps'] ?? []), + $child['scenario']['keyword'], + $child['scenario']['location']['line'] + ); }, array_filter( $json['children'] ?? [], @@ -112,75 +112,56 @@ static function ($child) { ); } - /** - * @return BackgroundNode|null - */ - private static function getBackground(array $json) + private static function getBackground(array $json): ?BackgroundNode { $backgrounds = array_values( array_map( - static function ($child) { - return new BackgroundNode( - $child['background']['name'], - self::getSteps($child['background']['steps'] ?? []), - $child['background']['keyword'], - $child['background']['location']['line'] - ); - }, + static fn ($child) => new BackgroundNode( + $child['background']['name'], + self::getSteps($child['background']['steps'] ?? []), + $child['background']['keyword'], + $child['background']['location']['line'] + ), array_filter( $json['children'] ?? [], - static function ($child) { - return isset($child['background']); - } + static fn ($child) => isset($child['background']), ) ) ); - return count($backgrounds) == 1 ? $backgrounds[0] : null; + return count($backgrounds) === 1 ? $backgrounds[0] : null; } /** - * @return StepNode[] + * @return list */ - private static function getSteps(array $json) + private static function getSteps(array $items): array { return array_map( - static function (array $json) { - return new StepNode( - trim($json['keyword']), - $json['text'], - [], - $json['location']['line'], - trim($json['keyword']) - ); - }, - $json + static fn (array $item) => new StepNode( + trim($item['keyword']), + $item['text'], + [], + $item['location']['line'], + trim($item['keyword']) + ), + array_values($items) ); } /** - * @return ExampleTableNode[] + * @return list */ - private static function getTables(array $json) + private static function getTables(array $items): array { return array_map( static function ($tableJson) { $table = []; - $table[$tableJson['tableHeader']['location']['line']] = array_map( - static function ($cell) { - return $cell['value']; - }, - $tableJson['tableHeader']['cells'] - ); + $table[$tableJson['tableHeader']['location']['line']] = array_column($tableJson['tableHeader']['cells'], 'value'); foreach ($tableJson['tableBody'] as $bodyRow) { - $table[$bodyRow['location']['line']] = array_map( - static function ($cell) { - return $cell['value']; - }, - $bodyRow['cells'] - ); + $table[$bodyRow['location']['line']] = array_column($bodyRow['cells'], 'value'); } return new ExampleTableNode( @@ -189,7 +170,7 @@ static function ($cell) { self::getTags($tableJson) ); }, - $json + array_values($items) ); } } diff --git a/src/Behat/Gherkin/Loader/DirectoryLoader.php b/src/Behat/Gherkin/Loader/DirectoryLoader.php index 6080a5df..93f1e60e 100644 --- a/src/Behat/Gherkin/Loader/DirectoryLoader.php +++ b/src/Behat/Gherkin/Loader/DirectoryLoader.php @@ -37,32 +37,32 @@ public function __construct(Gherkin $gherkin) /** * Checks if current loader supports provided resource. * - * @param mixed $path Resource to load + * @param mixed $resource Resource to load * * @return bool */ - public function supports($path) + public function supports($resource) { - return is_string($path) - && is_dir($this->findAbsolutePath($path)); + return is_string($resource) + && is_dir($this->findAbsolutePath($resource)); } /** * Loads features from provided resource. * - * @param string $path Resource to load + * @param string $resource Resource to load * - * @return FeatureNode[] + * @return list */ - public function load($path) + public function load($resource) { - $path = $this->findAbsolutePath($path); + $path = $this->findAbsolutePath($resource); $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS) ); - $paths = array_map('strval', iterator_to_array($iterator)); - uasort($paths, 'strnatcasecmp'); + $paths = array_map(strval(...), iterator_to_array($iterator)); + uasort($paths, strnatcasecmp(...)); $features = []; @@ -71,7 +71,7 @@ public function load($path) $loader = $this->gherkin->resolveLoader($path); if ($loader !== null) { - $features = array_merge($features, $loader->load($path)); + array_push($features, ...$loader->load($path)); } } diff --git a/src/Behat/Gherkin/Loader/GherkinFileLoader.php b/src/Behat/Gherkin/Loader/GherkinFileLoader.php index 6f158822..11e0870b 100644 --- a/src/Behat/Gherkin/Loader/GherkinFileLoader.php +++ b/src/Behat/Gherkin/Loader/GherkinFileLoader.php @@ -49,27 +49,27 @@ public function setCache(CacheInterface $cache) /** * Checks if current loader supports provided resource. * - * @param mixed $path Resource to load + * @param mixed $resource Resource to load * * @return bool */ - public function supports($path) + public function supports($resource) { - return is_string($path) - && is_file($absolute = $this->findAbsolutePath($path)) - && pathinfo($absolute, PATHINFO_EXTENSION) === 'feature'; + return is_string($resource) + && is_file($absolute = $this->findAbsolutePath($resource)) + && pathinfo($absolute, PATHINFO_EXTENSION) === 'feature'; } /** * Loads features from provided resource. * - * @param string $path Resource to load + * @param string $resource Resource to load * - * @return FeatureNode[] + * @return list */ - public function load($path) + public function load($resource) { - $path = $this->findAbsolutePath($path); + $path = $this->findAbsolutePath($resource); if ($this->cache) { if ($this->cache->isFresh($path, filemtime($path))) { @@ -94,8 +94,7 @@ public function load($path) protected function parseFeature($path) { $content = file_get_contents($path); - $feature = $this->parser->parse($content, $path); - return $feature; + return $this->parser->parse($content, $path); } } diff --git a/src/Behat/Gherkin/Loader/LoaderInterface.php b/src/Behat/Gherkin/Loader/LoaderInterface.php index 298dc5dd..eae74a50 100644 --- a/src/Behat/Gherkin/Loader/LoaderInterface.php +++ b/src/Behat/Gherkin/Loader/LoaderInterface.php @@ -33,7 +33,7 @@ public function supports($resource); * * @param mixed $resource Resource to load * - * @return FeatureNode[] + * @return list */ public function load($resource); } diff --git a/src/Behat/Gherkin/Loader/YamlFileLoader.php b/src/Behat/Gherkin/Loader/YamlFileLoader.php index ee392647..5dd4d42c 100644 --- a/src/Behat/Gherkin/Loader/YamlFileLoader.php +++ b/src/Behat/Gherkin/Loader/YamlFileLoader.php @@ -30,33 +30,33 @@ public function __construct() /** * Checks if current loader supports provided resource. * - * @param mixed $path Resource to load + * @param mixed $resource Resource to load * * @return bool */ - public function supports($path) + public function supports($resource) { - return is_string($path) - && is_file($absolute = $this->findAbsolutePath($path)) + return is_string($resource) + && is_file($absolute = $this->findAbsolutePath($resource)) && pathinfo($absolute, PATHINFO_EXTENSION) === 'yml'; } /** * Loads features from provided resource. * - * @param string $path Resource to load + * @param string $resource Resource to load * - * @return FeatureNode[] + * @return list */ - public function load($path) + public function load($resource) { - $path = $this->findAbsolutePath($path); + $path = $this->findAbsolutePath($resource); $hash = Yaml::parse(file_get_contents($path)); $features = $this->loader->load($hash); - return array_map(function (FeatureNode $feature) use ($path) { - return new FeatureNode( + return array_map( + static fn (FeatureNode $feature) => new FeatureNode( $feature->getTitle(), $feature->getDescription(), $feature->getTags(), @@ -66,7 +66,8 @@ public function load($path) $feature->getLanguage(), $path, $feature->getLine() - ); - }, $features); + ), + $features + ); } } diff --git a/src/Behat/Gherkin/Node/BackgroundNode.php b/src/Behat/Gherkin/Node/BackgroundNode.php index 6e02e51d..dcd46fc9 100644 --- a/src/Behat/Gherkin/Node/BackgroundNode.php +++ b/src/Behat/Gherkin/Node/BackgroundNode.php @@ -22,7 +22,7 @@ class BackgroundNode implements ScenarioLikeInterface */ private $title; /** - * @var StepNode[] + * @var list */ private $steps = []; /** @@ -38,14 +38,14 @@ class BackgroundNode implements ScenarioLikeInterface * Initializes background. * * @param string|null $title - * @param StepNode[] $steps + * @param array $steps * @param string $keyword * @param int $line */ public function __construct($title, array $steps, $keyword, $line) { $this->title = $title; - $this->steps = $steps; + $this->steps = array_values($steps); $this->keyword = $keyword; $this->line = $line; } @@ -83,7 +83,7 @@ public function hasSteps() /** * Returns background steps. * - * @return StepNode[] + * @return list */ public function getSteps() { diff --git a/src/Behat/Gherkin/Node/ExampleNode.php b/src/Behat/Gherkin/Node/ExampleNode.php index f11af793..ad8798e3 100644 --- a/src/Behat/Gherkin/Node/ExampleNode.php +++ b/src/Behat/Gherkin/Node/ExampleNode.php @@ -22,15 +22,15 @@ class ExampleNode implements ScenarioInterface, NamedScenarioInterface */ private $text; /** - * @var string[] + * @var list */ private $tags; /** - * @var StepNode[] + * @var list */ private $outlineSteps; /** - * @var string[] + * @var array */ private $tokens; /** @@ -38,7 +38,7 @@ class ExampleNode implements ScenarioInterface, NamedScenarioInterface */ private $line; /** - * @var StepNode[]|null + * @var list|null */ private $steps; /** @@ -54,9 +54,9 @@ class ExampleNode implements ScenarioInterface, NamedScenarioInterface * Initializes outline. * * @param string $text The entire row as a string, e.g. "| 1 | 2 | 3 |" - * @param string[] $tags - * @param StepNode[] $outlineSteps - * @param string[] $tokens + * @param array $tags + * @param array $outlineSteps + * @param array $tokens * @param int $line line number within the feature file * @param string|null $outlineTitle original title of the scenario outline * @param int|null $index the 1-based index of the row/example within the scenario outline @@ -64,8 +64,8 @@ class ExampleNode implements ScenarioInterface, NamedScenarioInterface public function __construct($text, array $tags, $outlineSteps, array $tokens, $line, $outlineTitle = null, $index = null) { $this->text = $text; - $this->tags = $tags; - $this->outlineSteps = $outlineSteps; + $this->tags = array_values($tags); + $this->outlineSteps = array_values($outlineSteps); $this->tokens = $tokens; $this->line = $line; $this->outlineTitle = $outlineTitle; @@ -130,7 +130,7 @@ public function hasTags() /** * Returns outline tags (including inherited from feature). * - * @return string[] + * @return list */ public function getTags() { @@ -150,7 +150,7 @@ public function hasSteps() /** * Returns outline steps. * - * @return StepNode[] + * @return list */ public function getSteps() { @@ -160,7 +160,7 @@ public function getSteps() /** * Returns example tokens. * - * @return string[] + * @return list */ public function getTokens() { @@ -207,7 +207,7 @@ public function getExampleText(): string /** * Creates steps for this example from abstract outline steps. * - * @return StepNode[] + * @return list */ protected function createExampleSteps() { @@ -228,9 +228,9 @@ protected function createExampleSteps() /** * Replaces tokens in arguments with row values. * - * @param ArgumentInterface[] $arguments + * @param array $arguments * - * @return ArgumentInterface[] + * @return array */ protected function replaceArgumentsTokens(array $arguments) { diff --git a/src/Behat/Gherkin/Node/ExampleTableNode.php b/src/Behat/Gherkin/Node/ExampleTableNode.php index 9b3dff4a..fe2ee52f 100644 --- a/src/Behat/Gherkin/Node/ExampleTableNode.php +++ b/src/Behat/Gherkin/Node/ExampleTableNode.php @@ -18,7 +18,7 @@ class ExampleTableNode extends TableNode { /** - * @var string[] + * @var list */ private $tags; @@ -32,7 +32,7 @@ class ExampleTableNode extends TableNode * * @param array $table Table in form of [$rowLineNumber => [$val1, $val2, $val3]] * @param string $keyword - * @param string[] $tags + * @param list $tags */ public function __construct(array $table, $keyword, array $tags = []) { @@ -55,7 +55,7 @@ public function getNodeType() /** * Returns attached tags. * - * @return string[] + * @return list */ public function getTags() { diff --git a/src/Behat/Gherkin/Node/FeatureNode.php b/src/Behat/Gherkin/Node/FeatureNode.php index 1faeb82b..44089f28 100644 --- a/src/Behat/Gherkin/Node/FeatureNode.php +++ b/src/Behat/Gherkin/Node/FeatureNode.php @@ -30,7 +30,7 @@ class FeatureNode implements KeywordNodeInterface, TaggedNodeInterface */ private $description; /** - * @var string[] + * @var list */ private $tags = []; /** @@ -38,7 +38,7 @@ class FeatureNode implements KeywordNodeInterface, TaggedNodeInterface */ private $background; /** - * @var ScenarioInterface[] + * @var list */ private $scenarios = []; /** @@ -63,8 +63,8 @@ class FeatureNode implements KeywordNodeInterface, TaggedNodeInterface * * @param string|null $title * @param string|null $description - * @param string[] $tags - * @param ScenarioInterface[] $scenarios + * @param list $tags + * @param list $scenarios * @param string $keyword * @param string $language * @param string|null $file the absolute path to the feature file @@ -87,9 +87,9 @@ public function __construct( } $this->title = $title; $this->description = $description; - $this->tags = $tags; + $this->tags = array_values($tags); $this->background = $background; - $this->scenarios = $scenarios; + $this->scenarios = array_values($scenarios); $this->keyword = $keyword; $this->language = $language; $this->file = $file; @@ -161,7 +161,7 @@ public function hasTags() /** * Returns feature tags. * - * @return string[] + * @return list */ public function getTags() { @@ -201,7 +201,7 @@ public function hasScenarios() /** * Returns feature scenarios. * - * @return ScenarioInterface[] + * @return list */ public function getScenarios() { diff --git a/src/Behat/Gherkin/Node/OutlineNode.php b/src/Behat/Gherkin/Node/OutlineNode.php index fe7572b9..8c26d7ce 100644 --- a/src/Behat/Gherkin/Node/OutlineNode.php +++ b/src/Behat/Gherkin/Node/OutlineNode.php @@ -22,15 +22,15 @@ class OutlineNode implements ScenarioInterface */ private $title; /** - * @var string[] + * @var list */ private $tags; /** - * @var StepNode[] + * @var list */ private $steps; /** - * @var ExampleTableNode|ExampleTableNode[] + * @var ExampleTableNode|list */ private $tables; /** @@ -42,7 +42,7 @@ class OutlineNode implements ScenarioInterface */ private $line; /** - * @var ExampleNode[]|null + * @var list|null */ private $examples; @@ -50,9 +50,9 @@ class OutlineNode implements ScenarioInterface * Initializes outline. * * @param string|null $title - * @param string[] $tags - * @param StepNode[] $steps - * @param ExampleTableNode|ExampleTableNode[] $tables + * @param list $tags + * @param list $steps + * @param ExampleTableNode|list $tables * @param string $keyword * @param int $line */ @@ -65,14 +65,14 @@ public function __construct( $line, ) { $this->title = $title; - $this->tags = $tags; - $this->steps = $steps; + $this->tags = array_values($tags); + $this->steps = array_values($steps); $this->keyword = $keyword; $this->line = $line; if (!is_array($tables)) { $this->tables = [$tables]; } else { - $this->tables = $tables; + $this->tables = array_values($tables); } } @@ -121,7 +121,7 @@ public function hasTags() /** * Returns outline tags (including inherited from feature). * - * @return string[] + * @return list */ public function getTags() { @@ -141,7 +141,7 @@ public function hasSteps() /** * Returns outline steps. * - * @return StepNode[] + * @return list */ public function getSteps() { @@ -187,7 +187,7 @@ public function getExampleTable() /** * Returns list of examples for the outline. * - * @return ExampleNode[] + * @return list */ public function getExamples() { @@ -197,7 +197,7 @@ public function getExamples() /** * Returns examples tables array for the outline. * - * @return ExampleTableNode[] + * @return list */ public function getExampleTables() { @@ -227,7 +227,7 @@ public function getLine() /** * Creates examples for this outline using examples table. * - * @return ExampleNode[] + * @return list */ protected function createExamples() { diff --git a/src/Behat/Gherkin/Node/ScenarioNode.php b/src/Behat/Gherkin/Node/ScenarioNode.php index 503413c6..0a67cb71 100644 --- a/src/Behat/Gherkin/Node/ScenarioNode.php +++ b/src/Behat/Gherkin/Node/ScenarioNode.php @@ -26,7 +26,7 @@ class ScenarioNode implements ScenarioInterface, NamedScenarioInterface */ private $tags = []; /** - * @var StepNode[] + * @var list */ private $steps = []; /** @@ -42,15 +42,15 @@ class ScenarioNode implements ScenarioInterface, NamedScenarioInterface * Initializes scenario. * * @param string|null $title - * @param StepNode[] $steps + * @param list $steps * @param string $keyword * @param int $line */ public function __construct($title, array $tags, array $steps, $keyword, $line) { $this->title = $title; - $this->tags = $tags; - $this->steps = $steps; + $this->tags = array_values($tags); + $this->steps = array_values($steps); $this->keyword = $keyword; $this->line = $line; } @@ -128,7 +128,7 @@ public function hasSteps() /** * Returns scenario steps. * - * @return StepNode[] + * @return list */ public function getSteps() { diff --git a/src/Behat/Gherkin/Node/StepContainerInterface.php b/src/Behat/Gherkin/Node/StepContainerInterface.php index 02d604eb..33e40367 100644 --- a/src/Behat/Gherkin/Node/StepContainerInterface.php +++ b/src/Behat/Gherkin/Node/StepContainerInterface.php @@ -27,7 +27,7 @@ public function hasSteps(); /** * Returns container steps. * - * @return StepNode[] + * @return list */ public function getSteps(); } diff --git a/src/Behat/Gherkin/Node/StepNode.php b/src/Behat/Gherkin/Node/StepNode.php index 038d1ffe..441eaa79 100644 --- a/src/Behat/Gherkin/Node/StepNode.php +++ b/src/Behat/Gherkin/Node/StepNode.php @@ -32,7 +32,7 @@ class StepNode implements NodeInterface */ private $text; /** - * @var ArgumentInterface[] + * @var list */ private $arguments = []; /** @@ -45,7 +45,7 @@ class StepNode implements NodeInterface * * @param string $keyword * @param string $text - * @param ArgumentInterface[] $arguments + * @param list $arguments * @param int $line * @param string $keywordType */ @@ -132,7 +132,7 @@ public function hasArguments() /** * Returns step arguments. * - * @return ArgumentInterface[] + * @return list */ public function getArguments() { diff --git a/src/Behat/Gherkin/Node/TaggedNodeInterface.php b/src/Behat/Gherkin/Node/TaggedNodeInterface.php index c313aadb..717af1c6 100644 --- a/src/Behat/Gherkin/Node/TaggedNodeInterface.php +++ b/src/Behat/Gherkin/Node/TaggedNodeInterface.php @@ -36,7 +36,7 @@ public function hasTags(); /** * Returns node tags (including inherited from feature). * - * @return string[] + * @return list */ public function getTags(); } diff --git a/src/Behat/Gherkin/Parser.php b/src/Behat/Gherkin/Parser.php index 490ec624..e951c7f8 100644 --- a/src/Behat/Gherkin/Parser.php +++ b/src/Behat/Gherkin/Parser.php @@ -636,7 +636,7 @@ protected function popTags() /** * Checks the tags fit the required format. * - * @param string[] $tags + * @param array $tags */ protected function guardTags(array $tags) { @@ -703,7 +703,7 @@ protected function parseLanguage() /** * Parses the rows of a table. * - * @return string[][] + * @return array> */ private function parseTableRows() { @@ -725,7 +725,7 @@ private function parseTableRows() /** * Changes step node type for types But, And to type of previous step if it exists else sets to Given. * - * @param StepNode[] $steps + * @param list $steps * * @return StepNode */ diff --git a/tests/Behat/Gherkin/Loader/ArrayLoaderTest.php b/tests/Behat/Gherkin/Loader/ArrayLoaderTest.php index afc9335a..229d2172 100644 --- a/tests/Behat/Gherkin/Loader/ArrayLoaderTest.php +++ b/tests/Behat/Gherkin/Loader/ArrayLoaderTest.php @@ -11,7 +11,6 @@ namespace Tests\Behat\Gherkin\Loader; use Behat\Gherkin\Loader\ArrayLoader; -use Behat\Gherkin\Node\OutlineNode; use PHPUnit\Framework\TestCase; class ArrayLoaderTest extends TestCase @@ -184,7 +183,6 @@ public function testOutlineExamples() $this->assertCount(1, $features); - /** @var OutlineNode[] $scenarios */ $scenarios = $features[0]->getScenarios(); $scenario = $scenarios[0];