caisse-bliss/vendor/doctrine/migrations/lib/Doctrine/Migrations/Finder/GlobFinder.php

30 lines
619 B
PHP
Raw Normal View History

2023-06-19 12:13:30 +02:00
<?php
declare(strict_types=1);
namespace Doctrine\Migrations\Finder;
use function glob;
use function rtrim;
/**
* The GlobFinder class finds migrations in a directory using the PHP glob() function.
*/
final class GlobFinder extends Finder
{
/**
* {@inheritDoc}
*/
public function findMigrations(string $directory, ?string $namespace = null): array
{
$dir = $this->getRealPath($directory);
$files = glob(rtrim($dir, '/') . '/Version*.php');
if ($files === false) {
$files = [];
}
return $this->loadMigrations($files, $namespace);
}
}