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

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

18 Jun 2026 09:22AM UTC coverage: 18.764% (-0.1%) from 18.913%
27749975228

push

github

wol-soft
Rename getEvaluatedProperties to _getEvaluatedProperties; fix indent

The generator emits an _getEvaluatedProperties() method on nested branch
classes so the composition cache's object slots can be queried for what the
branch evaluated. The previous getEvaluatedProperties() name could collide
with a user-declared schema property named evaluatedProperties (whose
auto-generated getter is identically named) and read as a user-facing
method. The underscore prefix sidesteps both concerns; generated code marks
the method with #[Internal] to document the role. CompositionEvaluationTrait
calls the renamed method.

InvalidComposedValueException now re-indents the embedded nested-exception
messages so their continuation lines align with the parent message's body
rather than reverting to column 2. Previously a nested
InvalidUnevaluatedPropertiesException with its own indented "- invalid
property" / "* Invalid type" lines would mix with the composition's own
top-level lines and produce a confusing flat output. The fix mirrors the
str_replace re-indent pattern already used by InvalidAdditionalPropertiesException.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

0 of 9 new or added lines in 2 files covered. (0.0%)

167 of 890 relevant lines covered (18.76%)

0.63 hits per line

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

0.0
/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\ValidationException;
9

10
/**
11
 * Class InvalidComposedValueException
12
 *
13
 * @package PHPModelGenerator\Exception\ComposedValue
14
 */
15
abstract class InvalidComposedValueException extends ValidationException
16
{
17
    protected const COMPOSED_ERROR_MESSAGE = '';
18
    /**
19
     * InvalidComposedValueException constructor.
20
     *
21
     * @param $providedValue
22
     * @param ValidationException[][] $compositionErrorCollection
23
     */
24
    public function __construct(
×
25
        $providedValue,
26
        string $propertyName,
27
        protected int $succeededCompositionElements,
28
        protected array $compositionErrorCollection
29
    ) {
30
        parent::__construct($this->getErrorMessage($propertyName), $propertyName, $providedValue);
×
31
    }
32

33
    public function getSucceededCompositionElements(): int
×
34
    {
35
        return $this->succeededCompositionElements;
×
36
    }
37

38
    /**
39
     * @return ValidationException[][]
40
     */
41
    public function getCompositionErrorCollection(): array
×
42
    {
43
        return $this->compositionErrorCollection;
×
44
    }
45

46
    protected function getErrorMessage(string $propertyName): string
×
47
    {
48
        $compositionIndex = 0;
×
49

50
        return "Invalid value for $propertyName declined by composition constraint.\n  " .
×
51
            sprintf(static::COMPOSED_ERROR_MESSAGE, $this->succeededCompositionElements) .
×
52
            array_reduce(
×
53
                $this->compositionErrorCollection,
×
54
                function (string $carry, ErrorRegistryExceptionInterface $exception) use (&$compositionIndex): string {
×
55
                    return "$carry\n  - Composition element #" . ++$compositionIndex . (
×
56
                        $exception->getErrors()
×
57
                            ? ": Failed\n    * " .
×
58
                                implode(
×
59
                                    "\n    * ",
×
NEW
60
                                    str_replace(
×
NEW
61
                                        "\n",
×
NEW
62
                                        "\n    ",
×
NEW
63
                                        array_map(
×
NEW
64
                                            fn(ValidationException $exception): string => $exception->getMessage(),
×
NEW
65
                                            $exception->getErrors(),
×
NEW
66
                                        ),
×
NEW
67
                                    ),
×
68
                                )
×
69
                            : ': Valid'
×
70
                        );
×
71
                },
×
72
                ''
×
73
            );
×
74
    }
75
}
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