-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Static Source Path Matching #6398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dantleech
wants to merge
15
commits into
sebastianbergmann:main
Choose a base branch
from
dantleech:gh-6114-source-map-no-fs-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Static Source Path Matching #6398
dantleech
wants to merge
15
commits into
sebastianbergmann:main
from
dantleech:gh-6114-source-map-no-fs-2
+154
−38
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dantleech
commented
Oct 25, 2025
dantleech
commented
Oct 25, 2025
dantleech
commented
Oct 25, 2025
dantleech
commented
Oct 25, 2025
e6c0737 to
31dd5e9
Compare
dantleech
commented
Oct 25, 2025
| ], | ||
| ), | ||
| ), | ||
| ], |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test, that passes on main, seems more like a bug, e.g. the directory path a/c/Z** wil include a/c/PrefixSuffix.php
c9cf387 to
5107851
Compare
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
type/enhancement
A new idea that should be implemented
type/performance
Issues related to resource consumption (time and memory)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a proof-of-concept for statically matching paths without traversing the filesystem during the test run. It replaces #6146 and uses the webmozarts/glob package.
Would fix #6114
The primary goal is to ensure that the source mapper needn't iterate over all included directories recursively whenever the source map is required to validate if a file belongs to the mapped files or not - for example when a deprecation is encountered PHPUnit needs to know if the deprecation was issued from source code within the project's responsiblity - i.e. source that is mapped.
We can determine if a file is within the included source by converting the glob-patterns in the
<directory>element to regexes. Currently the<directory>element in<include>and<exclude>has the attributesprefixandsuffixand we also have<file>which specifies a single file.This is more complicated than it could be:
globfunction - the implementation of which is not consistent across platforms and which has a number of rarely-used operators which while not common, would present a B/C break if they were removed.We can expect the following breaks in behavior:
globfunction and thewebmozartslibrary. Note that the behavior ofglobis also dependent onthe platform making it hard-to-impossible to lock down the behavior
completely (for reference linux man page for glob).
phpunit/php-file-iteratorwill not exactly match the results of the static matching logic.Things to consider:
phpunit/php-file-iteratorto use the same package so as to be consistent.