Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Compare versions of migrations without namespace #1421

Open
wants to merge 1 commit into
base: 3.7.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/Doctrine/Migrations/Version/AlphabeticalComparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
{
public function compare(Version $a, Version $b): int
{
return strcmp((string) $a, (string) $b);
return strcmp($this->stripNamespace($a), $this->stripNamespace($b));
}

private function stripNamespace(Version $version): string
{
$path = explode('\\', (string) $version);

Check failure on line 18 in lib/Doctrine/Migrations/Version/AlphabeticalComparator.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.3)

Function explode() should not be referenced via a fallback global name, but via a use statement.
return end($path);

Check failure on line 19 in lib/Doctrine/Migrations/Version/AlphabeticalComparator.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.3)

Expected 1 line before "return", found 0.

Check failure on line 19 in lib/Doctrine/Migrations/Version/AlphabeticalComparator.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.3)

Function end() should not be referenced via a fallback global name, but via a use statement.
}
}