Check explicitly for `false` before raising an unknown error
This commit is contained in:
parent
4b2784f85e
commit
13569a34b7
|
@ -126,10 +126,14 @@ class DbMigration
|
|||
{
|
||||
if (! $this->query) {
|
||||
$statements = @file_get_contents($this->getScriptPath());
|
||||
if (! $statements) {
|
||||
if ($statements === false) {
|
||||
throw new RuntimeException(sprintf('Cannot load upgrade script %s', $this->getScriptPath()));
|
||||
}
|
||||
|
||||
if (empty($statements)) {
|
||||
throw new RuntimeException('Nothing to migrate');
|
||||
}
|
||||
|
||||
if (preg_match('/\s*delimiter\s*(\S+)\s*$/im', $statements, $matches)) {
|
||||
/** @var string $statements */
|
||||
$statements = preg_replace('/\s*delimiter\s*(\S+)\s*$/im', '', $statements);
|
||||
|
@ -140,10 +144,6 @@ class DbMigration
|
|||
$this->query = $statements;
|
||||
}
|
||||
|
||||
if (empty($this->query)) {
|
||||
throw new RuntimeException('Nothing to migrate');
|
||||
}
|
||||
|
||||
$conn->exec($this->query);
|
||||
|
||||
return $this;
|
||||
|
|
Loading…
Reference in New Issue