9
9
use InvalidArgumentException ;
10
10
use LogicException ;
11
11
12
+ /**
13
+ * @template TResolver of \Closure(string, \Closure, string): \Illuminate\Database\Schema\Blueprint
14
+ */
12
15
class Builder
13
16
{
14
17
use Macroable;
@@ -30,9 +33,9 @@ class Builder
30
33
/**
31
34
* The Blueprint resolver callback.
32
35
*
33
- * @var \Closure
36
+ * @var TResolver|null
34
37
*/
35
- protected $ resolver ;
38
+ protected static $ resolver = null ;
36
39
37
40
/**
38
41
* The default string length for migrations.
@@ -629,8 +632,8 @@ protected function createBlueprint($table, ?Closure $callback = null)
629
632
{
630
633
$ connection = $ this ->connection ;
631
634
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 );
634
637
}
635
638
636
639
return Container::getInstance ()->make (Blueprint::class, compact ('connection ' , 'table ' , 'callback ' ));
@@ -698,11 +701,11 @@ public function getConnection()
698
701
/**
699
702
* Set the Schema Blueprint resolver callback.
700
703
*
701
- * @param \Closure $resolver
704
+ * @param TResolver|null $resolver
702
705
* @return void
703
706
*/
704
- public function blueprintResolver (Closure $ resolver )
707
+ public function blueprintResolver (? Closure $ resolver )
705
708
{
706
- $ this -> resolver = $ resolver ;
709
+ static :: $ resolver = $ resolver ;
707
710
}
708
711
}
0 commit comments