Skip to content

Commit 728f47d

Browse files
authored
Merge pull request #28 from rdohms/patch-1
Run CS on PR
2 parents 8e3673a + 64b43f9 commit 728f47d

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

.github/workflows/check-cs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches:
66
- master
7+
pull_request:
8+
branches:
9+
- "*"
710

811
jobs:
912
fix-style:

src/ArrayAccessible.php

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,69 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
declare(strict_types=1);
23

34
namespace DMS\PHPUnitExtensions\ArraySubset;
45

56
use ArrayAccess;
67
use ArrayIterator;
78
use IteratorAggregate;
9+
use Traversable;
10+
use function array_key_exists;
811

912
class ArrayAccessible implements ArrayAccess, IteratorAggregate
1013
{
14+
/**
15+
* @var mixed[]
16+
*/
1117
private $array;
1218

19+
/**
20+
* @param mixed[] $array
21+
*/
1322
public function __construct(array $array = [])
1423
{
1524
$this->array = $array;
1625
}
1726

18-
public function offsetExists($offset)
27+
/**
28+
* @param mixed $offset
29+
*/
30+
public function offsetExists($offset): bool
1931
{
20-
return \array_key_exists($offset, $this->array);
32+
return array_key_exists($offset, $this->array);
2133
}
2234

35+
/**
36+
* @param mixed $offset
37+
*
38+
* @return mixed
39+
*/
2340
public function offsetGet($offset)
2441
{
2542
return $this->array[$offset];
2643
}
2744

45+
/**
46+
* @param mixed $offset
47+
* @param mixed $value
48+
*/
2849
public function offsetSet($offset, $value): void
2950
{
30-
if (null === $offset) {
51+
if ($offset === null) {
3152
$this->array[] = $value;
3253
} else {
3354
$this->array[$offset] = $value;
3455
}
3556
}
3657

58+
/**
59+
* @param mixed $offset
60+
*/
3761
public function offsetUnset($offset): void
3862
{
3963
unset($this->array[$offset]);
4064
}
4165

42-
public function getIterator()
66+
public function getIterator(): Traversable
4367
{
4468
return new ArrayIterator($this->array);
4569
}

tests/Unit/Constraint/ArraySubsetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
namespace DMS\PHPUnitExtensions\ArraySubset\Tests\Unit\Constraint;
55

6-
use DMS\PHPUnitExtensions\ArraySubset\ArrayAccessible;
76
use ArrayObject;
87
use Countable;
8+
use DMS\PHPUnitExtensions\ArraySubset\ArrayAccessible;
99
use DMS\PHPUnitExtensions\ArraySubset\Constraint\ArraySubset;
1010
use PHPUnit\Framework\ExpectationFailedException;
1111
use PHPUnit\Framework\SelfDescribing;

0 commit comments

Comments
 (0)