File tree Expand file tree Collapse file tree 6 files changed +0
-74
lines changed Expand file tree Collapse file tree 6 files changed +0
-74
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,6 @@ abstract class AbstractAsset
38
38
{
39
39
protected string $ _name = '' ;
40
40
41
- /**
42
- * Indicates whether the object name has been initialized.
43
- */
44
- protected bool $ isNameInitialized = false ;
45
-
46
41
/**
47
42
* Namespace of the asset. If none isset the default namespace is assumed.
48
43
*/
@@ -67,8 +62,6 @@ public function __construct(string $name)
67
62
68
63
$ this ->setName ($ parsedName );
69
64
70
- $ this ->isNameInitialized = true ;
71
-
72
65
if ($ parsedName === null ) {
73
66
return ;
74
67
}
Original file line number Diff line number Diff line change 5
5
namespace Doctrine \DBAL \Schema ;
6
6
7
7
use Doctrine \DBAL \Schema \Exception \InvalidName ;
8
- use Doctrine \DBAL \Schema \Exception \NameIsNotInitialized ;
9
8
10
9
/**
11
10
* An abstract {@see NamedObject}.
@@ -19,9 +18,6 @@ abstract class AbstractNamedObject extends AbstractAsset implements NamedObject
19
18
/**
20
19
* The name of the database object.
21
20
*
22
- * Until the validity of the name is enforced, this property isn't guaranteed to be always initialized. The property
23
- * can be accessed only if {@see $isNameInitialized} is set to true.
24
- *
25
21
* @var N
26
22
*/
27
23
protected Name $ name ;
@@ -35,15 +31,9 @@ public function __construct(string $name)
35
31
* Returns the object name.
36
32
*
37
33
* @return N
38
- *
39
- * @throws NameIsNotInitialized
40
34
*/
41
35
public function getObjectName (): Name
42
36
{
43
- if (! $ this ->isNameInitialized ) {
44
- throw NameIsNotInitialized::new ();
45
- }
46
-
47
37
return $ this ->name ;
48
38
}
49
39
Original file line number Diff line number Diff line change 4
4
5
5
namespace Doctrine \DBAL \Schema ;
6
6
7
- use Doctrine \DBAL \Schema \Exception \NameIsNotInitialized ;
8
-
9
7
/**
10
8
* An abstract {@see OptionallyNamedObject}.
11
9
*
@@ -18,9 +16,6 @@ abstract class AbstractOptionallyNamedObject extends AbstractAsset implements Op
18
16
/**
19
17
* The name of the database object.
20
18
*
21
- * Until the validity of the name is enforced, this property isn't guaranteed to be always initialized. The property
22
- * can be accessed only if {@see $isNameInitialized} is set to true.
23
- *
24
19
* @var ?N
25
20
*/
26
21
protected ?Name $ name ;
@@ -32,10 +27,6 @@ public function __construct(?string $name)
32
27
33
28
public function getObjectName (): ?Name
34
29
{
35
- if (! $ this ->isNameInitialized ) {
36
- throw NameIsNotInitialized::new ();
37
- }
38
-
39
30
return $ this ->name ;
40
31
}
41
32
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 5
5
namespace Doctrine \DBAL \Tests \Schema ;
6
6
7
7
use Doctrine \DBAL \Schema \AbstractNamedObject ;
8
- use Doctrine \DBAL \Schema \AbstractOptionallyNamedObject ;
9
8
use Doctrine \DBAL \Schema \Exception \InvalidName ;
10
- use Doctrine \DBAL \Schema \Exception \NameIsNotInitialized ;
11
9
use Doctrine \DBAL \Schema \Name ;
12
10
use Doctrine \Deprecations \PHPUnit \VerifyDeprecations ;
13
11
use PHPUnit \Framework \TestCase ;
@@ -24,18 +22,4 @@ public function testEmptyName(): void
24
22
class ('' ) extends AbstractNamedObject {
25
23
};
26
24
}
27
-
28
- public function testAccessToUninitializedName (): void
29
- {
30
- $ object = new /** @extends AbstractOptionallyNamedObject<Name> */
31
- class () extends AbstractOptionallyNamedObject {
32
- /** @phpstan-ignore constructor.missingParentCall */
33
- public function __construct ()
34
- {
35
- }
36
- };
37
-
38
- $ this ->expectException (NameIsNotInitialized::class);
39
- $ object ->getObjectName ();
40
- }
41
25
}
Original file line number Diff line number Diff line change 5
5
namespace Doctrine \DBAL \Tests \Schema ;
6
6
7
7
use Doctrine \DBAL \Schema \AbstractOptionallyNamedObject ;
8
- use Doctrine \DBAL \Schema \Exception \NameIsNotInitialized ;
9
8
use Doctrine \DBAL \Schema \Name ;
10
9
use PHPUnit \Framework \Attributes \DataProvider ;
11
10
use PHPUnit \Framework \TestCase ;
@@ -28,18 +27,4 @@ public static function emptyNameProvider(): iterable
28
27
yield 'empty-string ' => ['' ];
29
28
yield 'empty-null ' => [null ];
30
29
}
31
-
32
- public function testAccessToUninitializedName (): void
33
- {
34
- $ object = new /** @extends AbstractOptionallyNamedObject<Name> */
35
- class () extends AbstractOptionallyNamedObject {
36
- /** @phpstan-ignore constructor.missingParentCall */
37
- public function __construct ()
38
- {
39
- }
40
- };
41
-
42
- $ this ->expectException (NameIsNotInitialized::class);
43
- $ object ->getObjectName ();
44
- }
45
30
}
You can’t perform that action at this time.
0 commit comments