upgraded dependencies
This commit is contained in:
38
vendor/symfony/console/Helper/HelperSet.php
vendored
38
vendor/symfony/console/Helper/HelperSet.php
vendored
@@ -18,12 +18,12 @@ use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
* HelperSet represents a set of helpers to be used with a command.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @implements \IteratorAggregate<string, Helper>
|
||||
*/
|
||||
class HelperSet implements \IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* @var Helper[]
|
||||
*/
|
||||
/** @var array<string, Helper> */
|
||||
private $helpers = [];
|
||||
private $command;
|
||||
|
||||
@@ -37,12 +37,7 @@ class HelperSet implements \IteratorAggregate
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a helper.
|
||||
*
|
||||
* @param string $alias An alias
|
||||
*/
|
||||
public function set(HelperInterface $helper, $alias = null)
|
||||
public function set(HelperInterface $helper, string $alias = null)
|
||||
{
|
||||
$this->helpers[$helper->getName()] = $helper;
|
||||
if (null !== $alias) {
|
||||
@@ -55,11 +50,9 @@ class HelperSet implements \IteratorAggregate
|
||||
/**
|
||||
* Returns true if the helper if defined.
|
||||
*
|
||||
* @param string $name The helper name
|
||||
*
|
||||
* @return bool true if the helper is defined, false otherwise
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name)
|
||||
public function has(string $name)
|
||||
{
|
||||
return isset($this->helpers[$name]);
|
||||
}
|
||||
@@ -67,13 +60,11 @@ class HelperSet implements \IteratorAggregate
|
||||
/**
|
||||
* Gets a helper value.
|
||||
*
|
||||
* @param string $name The helper name
|
||||
*
|
||||
* @return HelperInterface The helper instance
|
||||
* @return HelperInterface
|
||||
*
|
||||
* @throws InvalidArgumentException if the helper is not defined
|
||||
*/
|
||||
public function get($name)
|
||||
public function get(string $name)
|
||||
{
|
||||
if (!$this->has($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
|
||||
@@ -82,23 +73,32 @@ class HelperSet implements \IteratorAggregate
|
||||
return $this->helpers[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 5.4
|
||||
*/
|
||||
public function setCommand(Command $command = null)
|
||||
{
|
||||
trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
|
||||
|
||||
$this->command = $command;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the command associated with this helper set.
|
||||
*
|
||||
* @return Command A Command instance
|
||||
* @return Command
|
||||
*
|
||||
* @deprecated since Symfony 5.4
|
||||
*/
|
||||
public function getCommand()
|
||||
{
|
||||
trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
|
||||
|
||||
return $this->command;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Traversable<Helper>
|
||||
* @return \Traversable<string, Helper>
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
|
Reference in New Issue
Block a user