Code Duplication    Length = 8-8 lines in 4 locations

src/Behat/Gherkin/Parser.php 4 locations

@@ 268-275 (lines=8) @@
265
                ));
266
            }
267
268
            if (!$node instanceof ScenarioNode) {
269
                throw new ParserException(sprintf(
270
                    'Expected Scenario, Outline or Background, but got %s on line: %d%s',
271
                    $node->getNodeType(),
272
                    $node->getLine(),
273
                    $this->file ? ' in file: ' . $this->file : ''
274
                ));
275
            }
276
        }
277
278
        return new FeatureNode(
@@ 343-350 (lines=8) @@
340
                ));
341
            }
342
343
            if (!$node instanceof StepNode) {
344
                throw new ParserException(sprintf(
345
                    'Expected Step, but got %s on line: %d%s',
346
                    $node->getNodeType(),
347
                    $node->getLine(),
348
                    $this->file ? ' in file: ' . $this->file : ''
349
                ));
350
            }
351
        }
352
353
        return new BackgroundNode(rtrim($title) ?: null, $steps, $keyword, $line);
@@ 400-407 (lines=8) @@
397
                ));
398
            }
399
400
            if (!$node instanceof StepNode) {
401
                throw new ParserException(sprintf(
402
                    'Expected Step, but got %s on line: %d%s',
403
                    $node->getNodeType(),
404
                    $node->getLine(),
405
                    $this->file ? ' in file: ' . $this->file : ''
406
                ));
407
            }
408
        }
409
410
        return new ScenarioNode(rtrim($title) ?: null, $tags, $steps, $keyword, $line);
@@ 463-470 (lines=8) @@
460
                ));
461
            }
462
463
            if (!$node instanceof StepNode) {
464
                throw new ParserException(sprintf(
465
                    'Expected Step or Examples table, but got %s on line: %d%s',
466
                    $node->getNodeType(),
467
                    $node->getLine(),
468
                    $this->file ? ' in file: ' . $this->file : ''
469
                ));
470
            }
471
        }
472
473
        if (null === $examples) {