GlobFinder.php 619 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\Migrations\Finder;
  4. use function glob;
  5. use function rtrim;
  6. /**
  7. * The GlobFinder class finds migrations in a directory using the PHP glob() function.
  8. */
  9. final class GlobFinder extends Finder
  10. {
  11. /**
  12. * {@inheritDoc}
  13. */
  14. public function findMigrations(string $directory, ?string $namespace = null): array
  15. {
  16. $dir = $this->getRealPath($directory);
  17. $files = glob(rtrim($dir, '/') . '/Version*.php');
  18. if ($files === false) {
  19. $files = [];
  20. }
  21. return $this->loadMigrations($files, $namespace);
  22. }
  23. }