Skip to content

Removed unnecessary string operations #43

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jan 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private function getFiles(string $directory): \Generator
{
foreach ($this->files->getFiles($directory, '*.php') as $filename) {
$reflection = new ReflectionFile($filename);
$definition = \explode('_', \basename($filename));
$definition = \explode('_', \basename($filename, '.php'), 3);

if (\count($definition) < 3) {
throw new RepositoryException("Invalid migration filename '{$filename}'");
Expand All @@ -152,11 +152,7 @@ private function getFiles(string $directory): \Generator
'class' => $reflection->getClasses()[0],
'created' => $created,
'chunk' => $definition[1],
'name' => \str_replace(
'.php',
'',
\implode('_', \array_slice($definition, 2))
),
'name' => $definition[2],
];
}
}
Expand Down