99use InvalidArgumentException ;
1010use LogicException ;
1111
12+ /**
13+ * @template TResolver of \Closure(string, \Closure, string): \Illuminate\Database\Schema\Blueprint
14+ */
1215class Builder
1316{
1417 use Macroable;
@@ -30,9 +33,9 @@ class Builder
3033 /**
3134 * The Blueprint resolver callback.
3235 *
33- * @var \Closure
36+ * @var TResolver|null
3437 */
35- protected $ resolver ;
38+ protected static $ resolver = null ;
3639
3740 /**
3841 * The default string length for migrations.
@@ -629,8 +632,8 @@ protected function createBlueprint($table, ?Closure $callback = null)
629632 {
630633 $ connection = $ this ->connection ;
631634
632- if (isset ( $ this -> resolver ) ) {
633- return call_user_func ($ this -> resolver , $ connection , $ table , $ callback );
635+ if (static :: $ resolver !== null ) {
636+ return call_user_func (static :: $ resolver , $ connection , $ table , $ callback );
634637 }
635638
636639 return Container::getInstance ()->make (Blueprint::class, compact ('connection ' , 'table ' , 'callback ' ));
@@ -698,11 +701,11 @@ public function getConnection()
698701 /**
699702 * Set the Schema Blueprint resolver callback.
700703 *
701- * @param \Closure $resolver
704+ * @param TResolver|null $resolver
702705 * @return void
703706 */
704- public function blueprintResolver (Closure $ resolver )
707+ public function blueprintResolver (? Closure $ resolver )
705708 {
706- $ this -> resolver = $ resolver ;
709+ static :: $ resolver = $ resolver ;
707710 }
708711}
0 commit comments