Conversation
| <?php declare(strict_types = 1); | ||
| namespace TheSeer\Tokenizer; | ||
|
|
||
| class TokenCollection implements \ArrayAccess, \Iterator, \Countable { |
There was a problem hiding this comment.
this is a BC break, so might only be accetable with a new major version
|
I see the performance increase, but I feel pains with that change ;) I'm not happy with having to have had to implement the Iterator myself but I hate (with a passion! ;-) ) the loss of type information when using Is there a work around for that? |
|
Side nodes: Your |
sure, I have added necessary static analysis type annotations |
fixed, thanks. |
|
if you are fine with it, it would be great we could merge #24 before this one here (as we will get conflicts and this one here will be easier to resolve) |
|
I not yet verified whether this changes break PHPUnit usescases. I think we should add a compatibility check with PHPUnit versions in CI |
Thanks! It still feels wrong to have a generic return type that basically has zero information on what is the But I guess with the annotation it is good enough to be considered a pragmatic solution. |
|
I'm pondering about the change in the If we'd keep the What do you think? |
We could actually also just use |
|
I'll merge this with my suggested change. |
|
There are quite some side effects that I'm cleaning up now:
|
|
Also all my Tokenizer tests fail as I used a serialized collection to ensure it's not broken. |
|
Done. |
|
Thanks for cleaning it up. Why did CI not fail on said tests? |
|
https://github.com/theseer/tokenizer/actions/runs/19149696040/job/54736453289 The tests fail - but github doesn't notice that as a problem. Interesting. |
processing phpunit code coverage data ...
before this PR:
after this PR:
idea is to use a php-src builtin ArrayIterator instead of implementing the Iterator interface manually, for which the engine needs to constantly switch between calling native php-src code and userland functions
before this PR: