Make FileParser::parse() return directly a result instead of relying on getters and internal state#600
Conversation
…icError Replace the void return type and side-effect getters with a union return type: - ClassDescriptions: successful parse result (iterable collection) - ParsingErrors: PHP parser reported syntax errors - GenericError: unexpected exception caught during parsing Add ClassDescriptions and GenericError value types; update all callers (Runner, DebugExpression) and fix tests that relied on the parser's error-recovery traversal to tolerate invalid PHP syntax. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #600 +/- ##
============================================
+ Coverage 98.13% 98.31% +0.18%
- Complexity 666 681 +15
============================================
Files 84 86 +2
Lines 1930 1960 +30
============================================
+ Hits 1894 1927 +33
+ Misses 36 33 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @@ -4,26 +4,23 @@ | |||
|
|
|||
| namespace Arkitect\Tests\Unit\Rules; | |||
There was a problem hiding this comment.
the namespace needs to be updated
|
I like this PR, I have just a couple of doubts: |
| return new self($classDescriptions, $parsingErrors); | ||
| } | ||
|
|
||
| public static function withClassDescriptions(ClassDescriptions $classDescriptions): self |
There was a problem hiding this comment.
questa è usata solo nei test, probabilmente può saltare
I do like the idea of having collections classes instead of plain arrays, if anything, there are less comments to spread around to make static analysis tool happy
gone |
Preliminary step to make the introduction of a cache on parsing.
Replace the void return type with a ParserResult class containing: