File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ public function getParameters(): array
8585 }
8686
8787
88+ public function getParameter (string $ name ): Parameter
89+ {
90+ return $ this ->parameters [$ name ] ?? throw new Nette \InvalidArgumentException ("Parameter ' $ name' not found. " );
91+ }
92+
93+
8894 /**
8995 * @param string $name without $
9096 */
@@ -109,6 +115,12 @@ public function removeParameter(string $name): static
109115 }
110116
111117
118+ public function hasParameter (string $ name ): bool
119+ {
120+ return isset ($ this ->parameters [$ name ]);
121+ }
122+
123+
112124 public function setVariadic (bool $ state = true ): static
113125 {
114126 $ this ->variadic = $ state ;
Original file line number Diff line number Diff line change @@ -124,8 +124,11 @@ Assert::false($m->isPublic());
124124$ method = $ class ->addMethod ('show ' )
125125 ->setAbstract ();
126126
127- $ method ->addParameter ('foo ' );
127+ $ p = $ method ->addParameter ('foo ' );
128+ Assert::true ($ method ->hasParameter ('foo ' ));
129+ Assert::same ($ p , $ method ->getParameter ('foo ' ));
128130$ method ->removeParameter ('foo ' );
131+ Assert::false ($ method ->hasParameter ('foo ' ));
129132
130133$ method ->addParameter ('item ' );
131134
You can’t perform that action at this time.
0 commit comments