File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ public function getConstants(): array
42
42
}
43
43
44
44
45
+ public function getConstant (string $ name ): Constant
46
+ {
47
+ return $ this ->consts [$ name ] ?? throw new Nette \InvalidArgumentException ("Constant ' $ name' not found. " );
48
+ }
49
+
50
+
45
51
public function addConstant (string $ name , mixed $ value ): Constant
46
52
{
47
53
if (isset ($ this ->consts [$ name ])) {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ Assert::true($class->isAbstract());
48
48
Assert::same ('ParentClass ' , $ class ->getExtends ());
49
49
Assert::same (['ObjectTrait ' => $ trait1 , 'AnotherTrait ' => $ trait2 ], $ class ->getTraits ());
50
50
Assert::count (2 , $ class ->getConstants ());
51
- Assert::type (Nette \PhpGenerator \Constant::class, $ class ->getConstants ()[ 'ROLE ' ] );
51
+ Assert::type (Nette \PhpGenerator \Constant::class, $ class ->getConstant ( 'ROLE ' ) );
52
52
53
53
$ class ->addConstant ('FORCE_ARRAY ' , new Literal ('Nette\Utils\Json::FORCE_ARRAY ' ))
54
54
->setVisibility ('private ' )
You can’t perform that action at this time.
0 commit comments