Skip to content

[PhpUnitBridge] Fix ignoreFile comments #45921

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 1 commit into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private function __construct(array $thresholds = [], $regex = '', $verboseOutput
});
try {
foreach (file($ignoreFile) as $line => $pattern) {
if ('#' !== trim($line)[0] ?? '#') {
if ('#' !== (trim($pattern)[0] ?? '#')) {
preg_match($pattern, '');
$this->ignoreDeprecationPatterns[] = $pattern;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Test DeprecationErrorHandler with an ignoreFile
<?php
$filename = tempnam(sys_get_temp_dir(), 'sf-');
$ignorePatterns = [
'# A comment line and, below, an empty comment line and an empty line that should be interpreted as a comment.',
'#',
'',
'/^ignored .* deprecation/',
];
file_put_contents($filename, implode("\n", $ignorePatterns));
Expand Down