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

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

16 Jul 2026 09:57PM UTC coverage: 45.911% (+24.4%) from 21.548%
29537930683

Pull #19

github

claude
Normalize exception message wording: consistent quoting, no trailing periods

Across all exception message text: quote every interpolated property name,
nested key, pattern, filter token, and type/class name so identifiers are
visually distinguishable from surrounding prose (matching the style nested
additional/pattern-property messages already used); drop every trailing
period from message headers that introduce a nested bullet list, resolving
the inconsistency between InvalidComposedValueException (had a period) and
ConditionalException (didn't).

Also fixes specific grammar issues: ContainsException's "matches contains
constraint" now quotes the constraint name; AdditionalTupleItemsException's
internal ". Expected" splice is now a single sentence with a colon;
RegularPropertyAsAdditionalPropertyException's contraction and missing
article; UnknownPatternPropertyException's plural/unquoted key.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZUchCwdY9cQFvyEXWnTZw
Pull Request #19: Fix nested composition indentation + add data-instance JSON pointer (issue #131)

89 of 127 new or added lines in 39 files covered. (70.08%)

2 existing lines in 2 files now uncovered.

393 of 856 relevant lines covered (45.91%)

1.56 hits per line

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

81.08
/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
     */
23
    public function __construct(
2✔
24
        $providedValue,
25
        string $propertyName,
26
        string $jsonPointer,
27
        private readonly ?Exception $ifException,
28
        private readonly ?Exception $thenException,
29
        private readonly ?Exception $elseException
30
    ) {
31
        // A conditional branch validates the same value at the same position as the conditional
32
        // itself — it consumes no path segment of its own, so branch errors only need the parent
33
        // link (not a segment replacement) to inherit wherever this conditional ends up.
34
        foreach ([$this->ifException, $this->thenException, $this->elseException] as $branchException) {
2✔
35
            $this->linkInstancePointerParent($branchException);
2✔
36
        }
37

38
        parent::__construct($this->getErrorMessage($propertyName), $propertyName, $providedValue, $jsonPointer);
2✔
39
    }
40

41
    private function linkInstancePointerParent(?Exception $exception): void
2✔
42
    {
43
        if ($exception instanceof ErrorRegistryExceptionInterface) {
2✔
44
            foreach ($exception->getErrors() as $error) {
1✔
45
                $error->setInstancePointerParent($this);
1✔
46
            }
47
        } elseif ($exception instanceof ValidationException) {
2✔
48
            $exception->setInstancePointerParent($this);
1✔
49
        }
50
    }
51

UNCOV
52
    public function getIfException(): ?Exception
×
53
    {
54
        return $this->ifException;
×
55
    }
56

57
    public function getThenException(): ?Exception
×
58
    {
59
        return $this->thenException;
×
60
    }
61

62
    public function getElseException(): ?Exception
×
63
    {
64
        return $this->elseException;
×
65
    }
66

67
    private function getErrorMessage(string $propertyName): string
2✔
68
    {
69
        $message = "Invalid value for '$propertyName' declined by conditional composition constraint\n";
2✔
70

71
        $message .= $this->ifException
2✔
72
            ? "  - Condition: Failed" . $this->getExceptionMessage($this->ifException)
×
73
            : '  - Condition: Valid';
2✔
74

75
        return $message . "\n  - Conditional branch failed:" .
2✔
76
            $this->getExceptionMessage($this->thenException ?: $this->elseException);
2✔
77
    }
78

79
    private function getExceptionMessage(Exception $exception): string
2✔
80
    {
81
        return $exception instanceof ErrorRegistryExceptionInterface
2✔
82
            ? implode(
1✔
83
                "\n    * ",
1✔
84
                str_replace(
1✔
85
                    "\n",
1✔
86
                    "\n    ",
1✔
87
                    array_map(
1✔
88
                        fn(ValidationException $exception): string => $exception->getMessage(),
1✔
89
                        $exception->getErrors(),
1✔
90
                    ),
1✔
91
                ),
1✔
92
            )
1✔
93
            : "\n    * " . str_replace("\n", "\n    ", $exception->getMessage());
2✔
94
    }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc