You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Database/Updater.php
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ public function setUp($file)
25
25
returnfalse;
26
26
}
27
27
28
-
$this->isValidScript($object);
28
+
$this->isValidScript($object, $file);
29
29
30
30
Eloquent::unguard();
31
31
@@ -52,7 +52,7 @@ public function packDown($file)
52
52
returnfalse;
53
53
}
54
54
55
-
$this->isValidScript($object);
55
+
$this->isValidScript($object, $file);
56
56
57
57
Eloquent::unguard();
58
58
@@ -76,8 +76,11 @@ public function resolve($file)
76
76
return;
77
77
}
78
78
79
-
require_once$file;
79
+
$instance = require_once$file;
80
80
81
+
if (is_object($instance)) {
82
+
return$instance;
83
+
}
81
84
if ($class = $this->getClassFromFile($file)) {
82
85
returnnew$class;
83
86
}
@@ -86,7 +89,7 @@ public function resolve($file)
86
89
/**
87
90
* Checks if the object is a valid update script.
88
91
*/
89
-
protectedfunctionisValidScript($object)
92
+
protectedfunctionisValidScript($object, $file)
90
93
{
91
94
if ($objectinstanceofUpdates\Migration) {
92
95
returntrue;
@@ -96,8 +99,8 @@ protected function isValidScript($object)
96
99
}
97
100
98
101
thrownewException(sprintf(
99
-
'Database script [%s] must inherit Winter\Storm\Database\Updates\Migration or Winter\Storm\Database\Updates\Seeder classes',
100
-
get_class($object)
102
+
'Database script [%s] must define a class that inherits the "Winter\Storm\Database\Updates\Migration" or "Winter\Storm\Database\Updates\Seeder" classes',
0 commit comments