Files
friends-of-behat-symfony-ex…/src/Mink/MinkParameters.php
Ruud Kamphuis 237df2e912 Add return type mixed to offsetGet
Turns out that #175 was not enough to make Symfony happy:
```
Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "FriendsOfBehat\SymfonyExtension\Mink\MinkParameters" now to avoid errors or add an explicit @return annotation to suppress this message.
```
2021-12-14 17:56:03 +01:00

54 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace FriendsOfBehat\SymfonyExtension\Mink;
use ReturnTypeWillChange;
/** @final */
class MinkParameters implements \Countable, \IteratorAggregate, \ArrayAccess
{
/** @var array */
private $minkParameters;
public function __construct(array $minkParameters)
{
$this->minkParameters = $minkParameters;
}
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->minkParameters);
}
public function offsetExists($offset): bool
{
return array_key_exists($offset, $this->minkParameters);
}
/**
* @return mixed
*/
#[ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->minkParameters[$offset] ?? null;
}
public function offsetSet($offset, $value): void
{
throw new \BadMethodCallException(sprintf('"%s" is immutable.', self::class));
}
public function offsetUnset($offset): void
{
throw new \BadMethodCallException(sprintf('"%s" is immutable.', self::class));
}
public function count(): int
{
return count($this->minkParameters);
}
}