File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 44
55namespace Rector \Behastan \Analyzer ;
66
7+ use Behat \Gherkin \Node \FeatureNode ;
78use Entropy \Attributes \RelatedTest ;
89use Rector \Behastan \Gherkin \GherkinParser ;
910use Rector \Behastan \Tests \Analyzer \DuplicatedScenarioNamesAnalyzer \DuplicatedScenarioTitlesAnalyzerTest ;
@@ -28,6 +29,11 @@ public function analyze(array $featureFiles): array
2829 foreach ($ featureFiles as $ featureFile ) {
2930 $ featureGherkin = $ this ->gherkinParser ->parseFile ($ featureFile ->getRealPath ());
3031
32+ // @todo test and improve here
33+ if (! $ featureGherkin instanceof FeatureNode) {
34+ continue ;
35+ }
36+
3137 foreach ($ featureGherkin ->getScenarios () as $ scenario ) {
3238 $ scenarioNamesToFiles [$ scenario ->getTitle ()][] = $ featureFile ->getRealPath ();
3339 }
Original file line number Diff line number Diff line change @@ -35,13 +35,10 @@ public function __construct()
3535 $ this ->parser = new Parser (new Lexer ($ arrayKeywords ));
3636 }
3737
38- public function parseFile (string $ filePath ): FeatureNode
38+ public function parseFile (string $ filePath ): ? FeatureNode
3939 {
4040 $ fileContents = FileSystem::read ($ filePath );
4141
42- $ featureNode = $ this ->parser ->parse ($ fileContents );
43- Assert::isInstanceOf ($ featureNode , FeatureNode::class);
44-
45- return $ featureNode ;
42+ return $ this ->parser ->parse ($ fileContents );
4643 }
4744}
You can’t perform that action at this time.
0 commit comments