Code Duplication    Length = 8-8 lines in 4 locations

src/Behat/Gherkin/Parser.php 4 locations

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