8
8
use Doctrine \DBAL \Schema \Exception \InvalidObjectName ;
9
9
use Doctrine \DBAL \Schema \Name \Parser ;
10
10
use Doctrine \DBAL \Schema \Name \Parser \Identifier ;
11
- use Doctrine \Deprecations \Deprecation ;
12
11
13
12
use function array_map ;
13
+ use function assert ;
14
14
use function count ;
15
15
use function crc32 ;
16
16
use function dechex ;
@@ -41,56 +41,24 @@ abstract class AbstractAsset
41
41
/** @var list<Identifier> */
42
42
private array $ identifiers = [];
43
43
44
- public function __construct (? string $ name = null )
44
+ public function __construct (string $ name )
45
45
{
46
- if ($ name === null ) {
47
- Deprecation::trigger (
48
- 'doctrine/dbal ' ,
49
- 'https://github.com/doctrine/dbal/pull/6610 ' ,
50
- 'Not passing $name to %s is deprecated. ' ,
51
- __METHOD__ ,
52
- );
53
-
46
+ if ($ name === '' ) {
54
47
return ;
55
48
}
56
49
57
- $ this ->_setName ($ name );
58
- }
50
+ $ parser = new Parser ();
59
51
60
- /**
61
- * Sets the name of this asset.
62
- *
63
- * @deprecated Use the constructor instead.
64
- */
65
- protected function _setName (string $ name ): void
66
- {
67
- Deprecation::triggerIfCalledFromOutside (
68
- 'doctrine/dbal ' ,
69
- 'https://github.com/doctrine/dbal/pull/6610 ' ,
70
- '%s is deprecated. Use the constructor instead. ' ,
71
- __METHOD__ ,
72
- );
73
-
74
- if ($ name !== '' ) {
75
- $ parser = new Parser ();
76
-
77
- try {
78
- $ identifiers = $ parser ->parse ($ name );
79
- } catch (Parser \Exception $ e ) {
80
- throw InvalidObjectName::fromParserException ($ name , $ e );
81
- }
82
- } else {
83
- $ identifiers = [];
52
+ try {
53
+ $ identifiers = $ parser ->parse ($ name );
54
+ } catch (Parser \Exception $ e ) {
55
+ throw InvalidObjectName::fromParserException ($ name , $ e );
84
56
}
85
57
86
- switch (count ($ identifiers )) {
87
- case 0 :
88
- $ this ->_name = '' ;
89
- $ this ->_quoted = false ;
90
- $ this ->_namespace = null ;
91
- $ this ->identifiers = [];
58
+ $ count = count ($ identifiers );
59
+ assert ($ count > 0 );
92
60
93
- return ;
61
+ switch ( $ count ) {
94
62
case 1 :
95
63
$ namespace = null ;
96
64
$ name = $ identifiers [0 ];
@@ -102,7 +70,7 @@ protected function _setName(string $name): void
102
70
break ;
103
71
104
72
default :
105
- throw InvalidObjectName::tooManyQualifiers ($ name , count ( $ identifiers ) - 1 );
73
+ throw InvalidObjectName::tooManyQualifiers ($ name , $ count - 1 );
106
74
}
107
75
108
76
$ this ->_name = $ name ->getValue ();
0 commit comments