mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 11:50:51 +00:00
[Core] Remove is_string() check on glob loop data (#2267)
* [Core] Remove is_string() check on glob loop data * clean up * clean up * clean up
This commit is contained in:
parent
60708d4501
commit
97a33aa694
|
@ -64,16 +64,8 @@ final class FilesystemTweaker
|
|||
*/
|
||||
private function findDirectoriesInGlob(string $directory): array
|
||||
{
|
||||
$foundDirectories = [];
|
||||
|
||||
foreach ((array) glob($directory, GLOB_ONLYDIR) as $foundDirectory) {
|
||||
if (! is_string($foundDirectory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$foundDirectories[] = $foundDirectory;
|
||||
}
|
||||
|
||||
/** @var string[] $foundDirectories */
|
||||
$foundDirectories = (array) glob($directory, GLOB_ONLYDIR);
|
||||
return $foundDirectories;
|
||||
}
|
||||
|
||||
|
@ -82,20 +74,9 @@ final class FilesystemTweaker
|
|||
*/
|
||||
private function foundInGlob(string $path): array
|
||||
{
|
||||
$foundPaths = [];
|
||||
/** @var string[] $paths */
|
||||
$paths = (array) glob($path);
|
||||
|
||||
foreach ((array) glob($path) as $foundPath) {
|
||||
if (! is_string($foundPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! file_exists($foundPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$foundPaths[] = $foundPath;
|
||||
}
|
||||
|
||||
return $foundPaths;
|
||||
return array_filter($paths, fn (string $path): bool => file_exists($path));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user