Skip to content

Fix FileExcluder on windows #3450

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

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Fix FileExcluder on windows #3450

merged 2 commits into from
Sep 17, 2024

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 17, 2024

fixes 1 of the test errors. one remaining but I am not sure yet whether its a problem in the test or the impl.

underlying problem was

<?php

var_dump(fnmatch(
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\*',
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File/data/excluded-file.php',
	FNM_NOESCAPE | FNM_CASEFOLD
));

var_dump(fnmatch(
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\*',
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\data\excluded-file.php',
	FNM_NOESCAPE | FNM_CASEFOLD
));

see https://3v4l.org/WAAkK

@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 2.0.x. PHPStan 2.0 is not going to be released for months. If your code is relevant on 1.12.x and you want it to be released sooner, please rebase your pull request and change its target to 1.12.x.

underlying problem was

```
<?php

var_dump(fnmatch(
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\*',
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File/data/excluded-file.php',
	FNM_NOESCAPE | FNM_CASEFOLD
));

var_dump(fnmatch(
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\*',
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\data\excluded-file.php',
	FNM_NOESCAPE | FNM_CASEFOLD
));
```
@staabm
Copy link
Contributor Author

staabm commented Sep 17, 2024

the 1 remaing error is related to

<?php

var_dump(fnmatch(
	'tests\PHPStan\File\data\*',
	'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\data\parse-error.php',
	FNM_NOESCAPE | FNM_CASEFOLD
));

for this test-case:

[
__DIR__ . '\data\parse-error.php',
['tests/PHPStan/File/data/*'],
true,
],

@ondrejmirtes
Copy link
Member

The remaining error should be solved by changing the excluded path to *\tests\PHPStan\File\data\*. That's generally how it should be configured.

@ondrejmirtes ondrejmirtes merged commit aefc87a into phpstan:2.0.x Sep 17, 2024
191 of 216 checks passed
@ondrejmirtes
Copy link
Member

Awesome, thank you for your help!

@staabm staabm deleted the exc branch September 17, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants