• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wol-soft / php-json-schema-model-generator-production / 23464402725

23 Mar 2026 11:02PM UTC coverage: 20.696% (+0.8%) from 19.859%
23464402725

Pull #13

github

Enno Woortmann
Merge remote-tracking branch 'origin/chore/phpunit-13-upgrade' into chore/phpunit-13-upgrade
Pull Request #13: Upgrade to PHP 8.4 minimum and PHPUnit 13

4 of 67 new or added lines in 35 files covered. (5.97%)

43 existing lines in 30 files now uncovered.

107 of 517 relevant lines covered (20.7%)

0.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Exception/ComposedValue/ConditionalException.php
1
<?php
2

3
declare(strict_types = 1);
4

5
namespace PHPModelGenerator\Exception\ComposedValue;
6

7
use Exception;
8
use PHPModelGenerator\Exception\ErrorRegistryExceptionInterface;
9
use PHPModelGenerator\Exception\ValidationException;
10

11
/**
12
 * Class ConditionalException
13
 *
14
 * @package PHPModelGenerator\Exception\ComposedValue
15
 */
16
class ConditionalException extends ValidationException
17
{
18
    /**
19
     * ConditionalException constructor.
20
     *
21
     * @param $providedValue
22
     */
UNCOV
23
    public function __construct(
×
24
        $providedValue,
25
        string $propertyName,
26
        private readonly ?Exception $ifException,
27
        private readonly ?Exception $thenException,
28
        private readonly ?Exception $elseException
29
    ) {
30

UNCOV
31
        parent::__construct($this->getErrorMessage($propertyName), $propertyName, $providedValue);
×
32
    }
33

UNCOV
34
    public function getIfException(): ?Exception
×
35
    {
36
        return $this->ifException;
×
37
    }
38

UNCOV
39
    public function getThenException(): ?Exception
×
40
    {
41
        return $this->thenException;
×
42
    }
43

UNCOV
44
    public function getElseException(): ?Exception
×
45
    {
46
        return $this->elseException;
×
47
    }
48

49
    private function getErrorMessage(string $propertyName): string
×
50
    {
51
        $message = "Invalid value for $propertyName declined by conditional composition constraint\n";
×
52

53
        $message .= $this->ifException
×
54
            ? "  - Condition: Failed" . $this->getExceptionMessage($this->ifException)
×
55
            :'  - Condition: Valid';
×
56

57
        return $message . "\n  - Conditional branch failed:" .
×
58
            $this->getExceptionMessage($this->thenException ?: $this->elseException);
×
59
    }
60

61
    private function getExceptionMessage(Exception $exception): string
×
62
    {
63
        return $exception instanceof ErrorRegistryExceptionInterface
×
64
            ? implode(
×
65
                    "\n    * ",
×
NEW
66
                    array_map(fn(ValidationException $exception): string => $exception->getMessage(), $exception->getErrors())
×
67
                )
×
68
            : "\n    * " . $exception->getMessage();
×
69
    }
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc