Closed (fixed)
Project:
Drupal core
Version:
10.0.x-dev
Component:
extension system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Oct 2022 at 16:21 UTC
Updated:
9 Nov 2022 at 07:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mondrakeComment #3
longwaveHow did this work before? Do we have no test coverage for it? Is it dead code?
Comment #4
mondrakeLet's see.
Comment #5
mondrakePer #4, it’s not dead code and we have test coverage.
We are traversing a tree here, via an iterator and a filter, and I suspect the filter is wrapping the object and magically passing over calls to its methods (note: I never used these features).
So PHPstan here is both wrong (the isDir method executes all good) and right (the method is not defined explicitly).
IMHO the readibility and understandability of code improves after this change though.
Comment #6
longwaveAha, found the clue in the PHP docs: https://www.php.net/manual/en/class.iteratoriterator.php
I guess this might be worth raising with PHPStan. But I also agree that fixing it improves readability, so reuploading #2 and marking RTBC.
Comment #8
catchAgreed with all the reasoning here - it's a slight improvement even if it's not necessary, so why not.
Committed/pushed to 10.1.x and cherry-picked to 10.0.x, thanks!