mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
parent
7673eda07e
commit
330cdbe615
9054 changed files with 480487 additions and 41800 deletions
52
vendor/symfony/event-dispatcher/GenericEvent.php
vendored
52
vendor/symfony/event-dispatcher/GenericEvent.php
vendored
|
@ -29,12 +29,12 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
protected $arguments;
|
||||
|
||||
/**
|
||||
* Encapsulate an event with $subject and $args.
|
||||
* Encapsulate an event with $subject and $arguments.
|
||||
*
|
||||
* @param mixed $subject The subject of the event, usually an object or a callable
|
||||
* @param array $arguments Arguments to store in the event
|
||||
*/
|
||||
public function __construct($subject = null, array $arguments = [])
|
||||
public function __construct(mixed $subject = null, array $arguments = [])
|
||||
{
|
||||
$this->subject = $subject;
|
||||
$this->arguments = $arguments;
|
||||
|
@ -42,10 +42,8 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
|
||||
/**
|
||||
* Getter for subject property.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSubject()
|
||||
public function getSubject(): mixed
|
||||
{
|
||||
return $this->subject;
|
||||
}
|
||||
|
@ -53,11 +51,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
/**
|
||||
* Get argument by key.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException if key is not found
|
||||
*/
|
||||
public function getArgument(string $key)
|
||||
public function getArgument(string $key): mixed
|
||||
{
|
||||
if ($this->hasArgument($key)) {
|
||||
return $this->arguments[$key];
|
||||
|
@ -69,11 +65,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
/**
|
||||
* Add argument to event.
|
||||
*
|
||||
* @param mixed $value Value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setArgument(string $key, $value)
|
||||
public function setArgument(string $key, mixed $value): static
|
||||
{
|
||||
$this->arguments[$key] = $value;
|
||||
|
||||
|
@ -82,10 +76,8 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
|
||||
/**
|
||||
* Getter for all arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getArguments()
|
||||
public function getArguments(): array
|
||||
{
|
||||
return $this->arguments;
|
||||
}
|
||||
|
@ -95,7 +87,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setArguments(array $args = [])
|
||||
public function setArguments(array $args = []): static
|
||||
{
|
||||
$this->arguments = $args;
|
||||
|
||||
|
@ -104,10 +96,8 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
|
||||
/**
|
||||
* Has argument.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasArgument(string $key)
|
||||
public function hasArgument(string $key): bool
|
||||
{
|
||||
return \array_key_exists($key, $this->arguments);
|
||||
}
|
||||
|
@ -117,12 +107,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
*
|
||||
* @param string $key Array key
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException if key does not exist in $this->args
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($key)
|
||||
public function offsetGet(mixed $key): mixed
|
||||
{
|
||||
return $this->getArgument($key);
|
||||
}
|
||||
|
@ -130,13 +117,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
/**
|
||||
* ArrayAccess for argument setter.
|
||||
*
|
||||
* @param string $key Array key to set
|
||||
* @param mixed $value Value
|
||||
*
|
||||
* @return void
|
||||
* @param string $key Array key to set
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($key, $value)
|
||||
public function offsetSet(mixed $key, mixed $value): void
|
||||
{
|
||||
$this->setArgument($key, $value);
|
||||
}
|
||||
|
@ -145,11 +128,8 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
* ArrayAccess for unset argument.
|
||||
*
|
||||
* @param string $key Array key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($key)
|
||||
public function offsetUnset(mixed $key): void
|
||||
{
|
||||
if ($this->hasArgument($key)) {
|
||||
unset($this->arguments[$key]);
|
||||
|
@ -160,11 +140,8 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
* ArrayAccess has argument.
|
||||
*
|
||||
* @param string $key Array key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($key)
|
||||
public function offsetExists(mixed $key): bool
|
||||
{
|
||||
return $this->hasArgument($key);
|
||||
}
|
||||
|
@ -174,8 +151,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|||
*
|
||||
* @return \ArrayIterator<string, mixed>
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
public function getIterator(): \ArrayIterator
|
||||
{
|
||||
return new \ArrayIterator($this->arguments);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue