Skip to content

Commit bc3b9cf

Browse files
committed
added FunctionLike::removeParameter()
1 parent ce787c0 commit bc3b9cf

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/PhpGenerator/Traits/FunctionLike.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ public function addParameter(string $name, $defaultValue = null): Parameter
107107
}
108108

109109

110+
/**
111+
* @param string $name without $
112+
* @return static
113+
*/
114+
public function removeParameter(string $name): self
115+
{
116+
unset($this->parameters[$name]);
117+
return $this;
118+
}
119+
120+
110121
/**
111122
* @return static
112123
*/

tests/PhpGenerator/ClassType.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ Assert::same('protected', $m->getVisibility());
9393
$method = $class->addMethod('show')
9494
->setAbstract(true);
9595

96+
$method->addParameter('foo');
97+
$method->removeParameter('foo');
98+
9699
$method->addParameter('item');
97100

98101
$method->addParameter('res', null)

0 commit comments

Comments
 (0)