File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 11461146 'count ' => 1 ,
11471147 'path ' => __DIR__ . '/system/Database/Migration.php ' ,
11481148];
1149- $ ignoreErrors [] = [
1150- 'message ' => '#^Property CodeIgniter \\\\Database \\\\Migration \\: \\: \\$DBGroup \\(string \\) on left side of \\? \\? is not nullable \\.$# ' ,
1151- 'count ' => 1 ,
1152- 'path ' => __DIR__ . '/system/Database/Migration.php ' ,
1153- ];
11541149$ ignoreErrors [] = [
11551150 'message ' => '#^Construct empty \\( \\) is not allowed \\. Use more strict comparison \\.$# ' ,
11561151 'count ' => 8 ,
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ abstract class Migration
2121 /**
2222 * The name of the database group to use.
2323 *
24- * @var string
24+ * @var string|null
2525 */
2626 protected $ DBGroup ;
2727
@@ -39,12 +39,15 @@ abstract class Migration
3939 */
4040 protected $ forge ;
4141
42- /**
43- * Constructor.
44- */
4542 public function __construct (?Forge $ forge = null )
4643 {
47- $ this ->forge = $ forge ?? Database::forge ($ this ->DBGroup ?? config (Database::class)->defaultGroup );
44+ if (isset ($ this ->DBGroup )) {
45+ $ this ->forge = Database::forge ($ this ->DBGroup );
46+ } elseif ($ forge !== null ) {
47+ $ this ->forge = $ forge ;
48+ } else {
49+ $ this ->forge = Database::forge (config (Database::class)->defaultGroup );
50+ }
4851
4952 $ this ->db = $ this ->forge ->getConnection ();
5053 }
You can’t perform that action at this time.
0 commit comments