src/Behat/Gherkin/Parser.php
private function normalizeStepNodeKeywordType(StepNode $node, array $steps = array())
    {
        if (in_array($node->getKeywordType(), array('And', 'But'))) {
            if (($prev = end($steps))) {
                $keywordType = $prev->getKeywordType();
            } else {
                $keywordType = 'Given';
            }

            $node = new StepNode(
                $node->getKeyword(),
                $node->getText(),
                $node->getArguments(),
                $node->getLine(),
                $keywordType
            );
        }
        return $node;
    }
private function normalizeStepNodeKeywordType(StepNode $node, array $steps = array())
    {
        if (in_array($node->getKeywordType(), array('And', 'But'))) {
            if (($prev = end($steps))) {
                $keywordType = $prev->getKeywordType();
            } else {
                $keywordType = 'Given';
            }

            $node = new StepNode(
                $node->getKeyword(),
                $node->getText(),
                $node->getArguments(),
                $node->getLine(),
                $keywordType
            );
        }
        return $node;
    }
private function normalizeStepNodeKeywordType ( StepNode $ node , array $ steps = array ( ) ) { if ( in_array ( $ node -> getKeywordType ( ) , array ( 'And' , 'But' ) ) ) { if ( ( $ prev = end ( $ steps ) ) ) { $ keywordType = $ prev -> getKeywordType ( ) ; } else { $ keywordType = 'Given' ; } $ node = new StepNode ( $ node -> getKeyword ( ) , $ node -> getText ( ) , $ node -> getArguments ( ) , $ node -> getLine ( ) , $ keywordType ) ; } return $ node ; }
Changes step node type for types But, And to type of previous step if it exists else sets to Given

@param StepNode   $node
@param StepNode[] $steps
@return StepNode
Changes step node type for types But And to type of previous step if it exists else sets to Given