Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
AlwaysFalseSpecification
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 toSql
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 toInMemoryFilter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace Phexium\Domain\Specification;
11
12use Override;
13
14// Use case: Reject all entities or disable feature temporarily
15// $spec = new AlwaysFalseSpecification();
16final readonly class AlwaysFalseSpecification extends SpecificationAbstract implements SpecificationInterface
17{
18    #[Override]
19    public function toSql(): array
20    {
21        return [
22            'sql' => '1 = 0',
23            'params' => [],
24        ];
25    }
26
27    #[Override]
28    public function toInMemoryFilter(): callable
29    {
30        return fn (array $row): bool => false;
31    }
32}