Skip to content

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 5, 2025
1 parent 059750e commit 6819299
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/FileSystem/FilesFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,13 @@ public function findInDirectoriesAndFiles(
// fallback append `.php` to be used for both $filteredFilePaths and $filteredFilePathsInDirectories
$hasOnlySuffix = $onlySuffix !== null && $onlySuffix !== '';

if ($hasOnlySuffix) {
if (! str_ends_with($onlySuffix, '.php')) {
$onlySuffix .= '.php';
}
if ($hasOnlySuffix && ! str_ends_with($onlySuffix, '.php')) {
$onlySuffix .= '.php';
}

// filter files by specific suffix
if ($hasOnlySuffix) {
$fileWithSuffixFilter = static function (string $filePath) use ($onlySuffix): bool {
return str_ends_with($filePath, $onlySuffix);
};
$fileWithSuffixFilter = (static fn(string $filePath): bool => str_ends_with($filePath, $onlySuffix));
} elseif ($suffixes !== []) {
$fileWithSuffixFilter = static function (string $filePath) use ($suffixes): bool {
$filePathExtension = pathinfo($filePath, PATHINFO_EXTENSION);
Expand Down

0 comments on commit 6819299

Please sign in to comment.