diff --git a/src/Behat/Gherkin/Filter/TagFilter.php b/src/Behat/Gherkin/Filter/TagFilter.php index 509ba92c..d25cd2fe 100644 --- a/src/Behat/Gherkin/Filter/TagFilter.php +++ b/src/Behat/Gherkin/Filter/TagFilter.php @@ -32,7 +32,14 @@ public function __construct($filterString) { $this->filterString = trim($filterString); } - + + /** + * Filters feature according to the filter. + * + * @param FeatureNode $feature + * + * @return FeatureNode + */ public function filterFeature(FeatureNode $feature) { $scenarios = array(); diff --git a/src/Behat/Gherkin/Parser.php b/src/Behat/Gherkin/Parser.php index cb96cd1f..c9a7dff6 100644 --- a/src/Behat/Gherkin/Parser.php +++ b/src/Behat/Gherkin/Parser.php @@ -39,7 +39,7 @@ class Parser private $tags = array(); private $languageSpecifierLine; - private $stack = array(); + private $passedNodesStack = array(); /** * Initializes parser. @@ -238,7 +238,7 @@ protected function parseFeature() $file = $this->file; $line = $token['line']; - array_push($this->stack, 'Feature'); + array_push($this->passedNodesStack, 'Feature'); // Parse description, background, scenarios & outlines while ('EOS' !== $this->predictTokenType()) { @@ -373,7 +373,7 @@ protected function parseScenario() $keyword = $token['keyword']; $line = $token['line']; - array_push($this->stack, 'Scenario'); + array_push($this->passedNodesStack, 'Scenario'); // Parse description and steps $steps = array(); @@ -413,7 +413,7 @@ protected function parseScenario() } } - array_pop($this->stack); + array_pop($this->passedNodesStack); return new ScenarioNode(rtrim($title) ?: null, $tags, $steps, $keyword, $line); } @@ -440,7 +440,7 @@ protected function parseOutline() // Parse description, steps and examples $steps = array(); - array_push($this->stack, 'Outline'); + array_push($this->passedNodesStack, 'Outline'); while (in_array($this->predictTokenType(), array('Step', 'Examples', 'Newline', 'Text', 'Comment', 'Tag'))) { $node = $this->parseExpression(); @@ -510,7 +510,7 @@ protected function parseStep() $text = trim($token['text']); $line = $token['line']; - array_push($this->stack, 'Step'); + array_push($this->passedNodesStack, 'Step'); $arguments = array(); while (in_array($predicted = $this->predictTokenType(), array('PyStringOp', 'TableRow', 'Newline', 'Comment'))) { @@ -526,7 +526,7 @@ protected function parseStep() } } - array_pop($this->stack); + array_pop($this->passedNodesStack); return new StepNode($keyword, $text, $arguments, $line, $keywordType); } @@ -599,9 +599,10 @@ protected function parseTags() $currentType = '-1'; // check if that is ok to go inside: - if (!empty($this->stack)) { - $currentType = $this->stack[count($this->stack) - 1]; + if (!empty($this->passedNodesStack)) { + $currentType = $this->passedNodesStack[count($this->passedNodesStack) - 1]; } + $nextType = $this->predictTokenType(); if (!isset($possibleTransitions[$currentType]) || in_array($nextType, $possibleTransitions[$currentType])) { return $this->parseExpression();