1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 09:47:29 +01:00

Use flag instead of DirectoryIterator::isDot()

This commit is contained in:
Tomasz Mlynski 2021-12-14 20:00:17 +01:00
parent 832fc35d8d
commit 2c70a1a72a
No known key found for this signature in database
GPG Key ID: 665B4A17698A1954

View File

@ -1,6 +1,7 @@
<?php <?php
namespace Psalm\Config; namespace Psalm\Config;
use FilesystemIterator;
use Psalm\Exception\ConfigException; use Psalm\Exception\ConfigException;
use RecursiveDirectoryIterator; use RecursiveDirectoryIterator;
use RecursiveIteratorIterator; use RecursiveIteratorIterator;
@ -186,11 +187,13 @@ class FileFilter
} }
/** @var RecursiveDirectoryIterator */ /** @var RecursiveDirectoryIterator */
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory_path)); $iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directory_path, FilesystemIterator::SKIP_DOTS)
);
$iterator->rewind(); $iterator->rewind();
while ($iterator->valid()) { while ($iterator->valid()) {
if (!$iterator->isDot() && $iterator->isLink()) { if ($iterator->isLink()) {
$linked_path = readlink($iterator->getPathname()); $linked_path = readlink($iterator->getPathname());
if (stripos($linked_path, $directory_path) !== 0) { if (stripos($linked_path, $directory_path) !== 0) {