Innmind /
Immutable
| 1 | <?php |
||
| 2 | declare(strict_types = 1); |
||
| 3 | |||
| 4 | namespace Properties\Innmind\Immutable\Monoid; |
||
| 5 | |||
| 6 | use Innmind\BlackBox\{ |
||
| 7 | Set, |
||
| 8 | Property, |
||
| 9 | }; |
||
| 10 | use PHPUnit\Framework\Assert; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @template T |
||
| 14 | */ |
||
| 15 | final class Associativity implements Property |
||
| 16 | { |
||
| 17 | /** @var T */ |
||
|
0 ignored issues
–
show
|
|||
| 18 | private mixed $a; |
||
| 19 | /** @var T */ |
||
| 20 | private mixed $b; |
||
| 21 | /** @var T */ |
||
| 22 | private mixed $c; |
||
| 23 | /** @var callable(T, T): bool */ |
||
| 24 | private $equals; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param T $a |
||
| 28 | * @param T $b |
||
| 29 | * @param T $c |
||
| 30 | * @param callable(T, T): bool $equals |
||
| 31 | */ |
||
| 32 | public function __construct(mixed $a, mixed $b, mixed $c, callable $equals) |
||
| 33 | { |
||
| 34 | $this->a = $a; |
||
| 35 | $this->b = $b; |
||
| 36 | $this->c = $c; |
||
| 37 | $this->equals = $equals; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @template A |
||
| 42 | * |
||
| 43 | * @param Set<A> $values |
||
| 44 | * @param callable(A, A): bool $equals |
||
| 45 | * |
||
| 46 | * @return Set<self<A>> |
||
| 47 | */ |
||
| 48 | public static function any(Set $values, callable $equals): Set |
||
| 49 | { |
||
| 50 | return Set\Composite::immutable( |
||
| 51 | static fn($a, $b, $c) => new self($a, $b, $c, $equals), |
||
| 52 | $values, |
||
| 53 | $values, |
||
| 54 | $values, |
||
| 55 | ); |
||
| 56 | } |
||
| 57 | |||
| 58 | public function name(): string |
||
| 59 | { |
||
| 60 | return 'Identity value has no effect on the combined value'; |
||
| 61 | } |
||
| 62 | |||
| 63 | public function applicableTo(object $monoid): bool |
||
| 64 | { |
||
| 65 | return true; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function ensureHeldBy(object $monoid): object |
||
| 69 | { |
||
| 70 | Assert::assertTrue(($this->equals)( |
||
| 71 | $monoid->combine($this->a, $monoid->combine($this->b, $this->c)), |
||
| 72 | $monoid->combine($monoid->combine($this->a, $this->b), $this->c), |
||
| 73 | )); |
||
| 74 | |||
| 75 | return $monoid; |
||
| 76 | } |
||
| 77 | } |
||
| 78 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths