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

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

24 Jul 2026 02:22AM UTC coverage: 37.186% (+19.9%) from 17.248%
30094849029

push

github

wol-soft
Sync 2019-09-specific exception wording to the quoting/no-trailing-period convention

The draft-2019-09 keyword exceptions (unevaluatedItems, unevaluatedProperties,
minContains/maxContains) were added on this branch before master's wording pass
landed here via merge, so they still had unquoted property names, an unquoted
list of unevaluated property names, and a trailing period on a bulleted-list
header. Also replace InvalidUnevaluatedItemsException's hand-rolled bullet-list
joining with MessageFormatter::bulletList(), which already does the same thing,
and align RegularPropertyAsUnevaluatedPropertyException's wording (quoting,
"Could not" instead of "Couldn't") with its sibling
RegularPropertyAsAdditionalPropertyException.

0 of 13 new or added lines in 6 files covered. (0.0%)

34 existing lines in 10 files now uncovered.

370 of 995 relevant lines covered (37.19%)

1.5 hits per line

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

85.19
/src/Exception/ComposedValue/InvalidComposedValueException.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace PHPModelGenerator\Exception\ComposedValue;
6

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

11
/**
12
 * Class InvalidComposedValueException
13
 *
14
 * @package PHPModelGenerator\Exception\ComposedValue
15
 */
16
abstract class InvalidComposedValueException extends ValidationException
17
{
18
    protected const COMPOSED_ERROR_MESSAGE = '';
19
    /**
20
     * InvalidComposedValueException constructor.
21
     *
22
     * @param $providedValue
23
     * @param ValidationException[][] $compositionErrorCollection
24
     */
25
    public function __construct(
3✔
26
        $providedValue,
27
        string $propertyName,
28
        string $jsonPointer,
29
        protected int $succeededCompositionElements,
30
        protected array $compositionErrorCollection
31
    ) {
32
        // A composition branch validates the same value at the same position as the composition
33
        // itself — it consumes no path segment of its own, so branch errors only need the parent
34
        // link (not a segment replacement) to inherit wherever this composition ends up.
35
        foreach ($this->compositionErrorCollection as $branch) {
3✔
36
            foreach ($branch->getErrors() as $error) {
3✔
37
                $error->setInstancePointerParent($this);
3✔
38
            }
39
        }
40

41
        parent::__construct($this->getErrorMessage($propertyName), $propertyName, $providedValue, $jsonPointer);
3✔
42
    }
43

44
    public function getSucceededCompositionElements(): int
×
45
    {
UNCOV
46
        return $this->succeededCompositionElements;
×
47
    }
48

49
    /**
50
     * @return ValidationException[][]
51
     */
52
    public function getCompositionErrorCollection(): array
×
53
    {
54
        return $this->compositionErrorCollection;
×
55
    }
56

57
    protected function getErrorMessage(string $propertyName): string
3✔
58
    {
59
        $compositionIndex = 0;
3✔
60

61
        return "Invalid value for '$propertyName' declined by composition constraint\n  " .
3✔
62
            sprintf(
3✔
63
                static::COMPOSED_ERROR_MESSAGE,
3✔
64
                MessageFormatter::pluralize($this->succeededCompositionElements, 'element'),
3✔
65
            ) .
3✔
66
            array_reduce(
3✔
67
                $this->compositionErrorCollection,
3✔
68
                function (string $carry, ErrorRegistryExceptionInterface $exception) use (&$compositionIndex): string {
3✔
69
                    return "$carry\n  - Composition element #" . ++$compositionIndex . (
3✔
70
                        $exception->getErrors()
3✔
71
                            ? ": Failed\n    * " . MessageFormatter::bulletList($exception->getErrors())
3✔
72
                            : ': Valid'
3✔
73
                        );
3✔
74
                },
3✔
75
                ''
3✔
76
            );
3✔
77
    }
78
}
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