Skip to content

Commit

Permalink
Apply Doctrine Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
rdohms committed May 18, 2024
1 parent f7c6b90 commit ad73bf4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 34 deletions.
20 changes: 5 additions & 15 deletions src/ArrayAccessible.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@

class ArrayAccessible implements ArrayAccess, IteratorAggregate
{
/**
* @var mixed[]
*/
/** @var mixed[] */
private $array;

/**
* @param mixed[] $array
*/
/** @param mixed[] $array */
public function __construct(array $array = [])
{
$this->array = $array;
}

/**
* @param mixed $offset
*/
/** @param mixed $offset */
public function offsetExists($offset): bool
{
return array_key_exists($offset, $this->array);
Expand Down Expand Up @@ -59,17 +53,13 @@ public function offsetSet($offset, $value): void
}
}

/**
* @param mixed $offset
*/
/** @param mixed $offset */
public function offsetUnset($offset): void
{
unset($this->array[$offset]);
}

/**
* @return mixed[]
*/
/** @return mixed[] */
public function getIterator(): Traversable
{
return new ArrayIterator($this->array);
Expand Down
14 changes: 4 additions & 10 deletions src/Constraint/ArraySubset.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@
*/
final class ArraySubset extends Constraint
{
/**
* @var iterable|mixed[]
*/
/** @var iterable|mixed[] */
private $subset;

/**
* @var bool
*/
/** @var bool */
private $strict;

/**
* @param mixed[] $subset
*/
/** @param mixed[] $subset */
public function __construct(iterable $subset, bool $strict = false)
{
$this->strict = $strict;
Expand All @@ -63,7 +57,7 @@ public function __construct(iterable $subset, bool $strict = false)
* @throws ExpectationFailedException
* @throws InvalidArgumentException|Exception
*/
public function evaluate($other, string $description = '', bool $returnResult = false): ?bool
public function evaluate($other, string $description = '', bool $returnResult = false): bool|null
{
//type cast $other & $this->subset as an array to allow
//support in standard array functions.
Expand Down
4 changes: 1 addition & 3 deletions tests/Unit/AssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
use function class_exists;
use function method_exists;

/**
* @requires PHPUnit >= 8
*/
/** @requires PHPUnit >= 8 */
final class AssertTest extends TestCase
{
public function testAssertArraySubsetPassesStrictConfig(): void
Expand Down
8 changes: 2 additions & 6 deletions tests/Unit/Constraint/ArraySubsetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@

use function sprintf;

/**
* @requires PHPUnit >= 8
*/
/** @requires PHPUnit >= 8 */
final class ArraySubsetTest extends TestCase
{
/**
* @return mixed[]
*/
/** @return mixed[] */
public static function evaluateDataProvider(): array
{
return [
Expand Down

0 comments on commit ad73bf4

Please sign in to comment.