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
4242 }
4343
4444
45+ public function getConstant (string $ name ): Constant
46+ {
47+ return $ this ->consts [$ name ] ?? throw new Nette \InvalidArgumentException ("Constant ' $ name' not found. " );
48+ }
49+
50+
4551 public function addConstant (string $ name , mixed $ value ): Constant
4652 {
4753 if (isset ($ this ->consts [$ name ])) {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ Assert::true($class->isAbstract());
4848Assert::same ('ParentClass ' , $ class ->getExtends ());
4949Assert::same (['ObjectTrait ' => $ trait1 , 'AnotherTrait ' => $ trait2 ], $ class ->getTraits ());
5050Assert::count (2 , $ class ->getConstants ());
51- Assert::type (Nette \PhpGenerator \Constant::class, $ class ->getConstants ()[ 'ROLE ' ] );
51+ Assert::type (Nette \PhpGenerator \Constant::class, $ class ->getConstant ( 'ROLE ' ) );
5252
5353$ class ->addConstant ('FORCE_ARRAY ' , new Literal ('Nette\Utils\Json::FORCE_ARRAY ' ))
5454 ->setVisibility ('private ' )
You can’t perform that action at this time.
0 commit comments