[Console] Fix type annotation on InputInterface::hasArgument()

This commit is contained in:
Nicolas Grekas 2021-07-04 11:08:18 +02:00
parent 9928be05fe
commit 6ac2776c47
2 changed files with 4 additions and 4 deletions

View File

@ -106,7 +106,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
*/ */
public function getArgument($name) public function getArgument($name)
{ {
if (!$this->definition->hasArgument($name)) { if (!$this->definition->hasArgument((string) $name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
} }
@ -118,7 +118,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
*/ */
public function setArgument($name, $value) public function setArgument($name, $value)
{ {
if (!$this->definition->hasArgument($name)) { if (!$this->definition->hasArgument((string) $name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
} }
@ -130,7 +130,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
*/ */
public function hasArgument($name) public function hasArgument($name)
{ {
return $this->definition->hasArgument($name); return $this->definition->hasArgument((string) $name);
} }
/** /**

View File

@ -104,7 +104,7 @@ interface InputInterface
/** /**
* Returns true if an InputArgument object exists by name or position. * Returns true if an InputArgument object exists by name or position.
* *
* @param string|int $name The InputArgument name or position * @param string $name The InputArgument name or position
* *
* @return bool true if the InputArgument object exists, false otherwise * @return bool true if the InputArgument object exists, false otherwise
*/ */