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
85
85
}
86
86
87
87
88
+ public function getParameter (string $ name ): Parameter
89
+ {
90
+ return $ this ->parameters [$ name ] ?? throw new Nette \InvalidArgumentException ("Parameter ' $ name' not found. " );
91
+ }
92
+
93
+
88
94
/**
89
95
* @param string $name without $
90
96
*/
@@ -109,6 +115,12 @@ public function removeParameter(string $name): static
109
115
}
110
116
111
117
118
+ public function hasParameter (string $ name ): bool
119
+ {
120
+ return isset ($ this ->parameters [$ name ]);
121
+ }
122
+
123
+
112
124
public function setVariadic (bool $ state = true ): static
113
125
{
114
126
$ this ->variadic = $ state ;
Original file line number Diff line number Diff line change @@ -124,8 +124,11 @@ Assert::false($m->isPublic());
124
124
$ method = $ class ->addMethod ('show ' )
125
125
->setAbstract ();
126
126
127
- $ method ->addParameter ('foo ' );
127
+ $ p = $ method ->addParameter ('foo ' );
128
+ Assert::true ($ method ->hasParameter ('foo ' ));
129
+ Assert::same ($ p , $ method ->getParameter ('foo ' ));
128
130
$ method ->removeParameter ('foo ' );
131
+ Assert::false ($ method ->hasParameter ('foo ' ));
129
132
130
133
$ method ->addParameter ('item ' );
131
134
You can’t perform that action at this time.
0 commit comments