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

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

17 Jun 2026 09:14PM UTC coverage: 18.913% (-0.7%) from 19.622%
27720209155

push

github

wol-soft
Add unevaluatedProperties accessors and per-key pattern validity

Introduce UnevaluatedPropertiesAccessor and ImmutableUnevaluatedPropertiesAccessor
plus RegularPropertyAsUnevaluatedPropertyException, modelled on the existing
additionalProperties pair. SerializableTrait gains _serializeUnevaluatedProperties
so the new _unevaluatedProperties bucket flattens back into toArray() / toJSON()
output the same way the additional and pattern buckets do.

Fix CompositionEvaluationTrait::collectUnevaluatedKeys to honour per-key
patternProperties validity (decision 0.5 from the unevaluated-properties plan).
A pattern-matched key is now credited as evaluated only when its stored value
in _patternProperties equals the current modelData value; a mismatch means the
last validation attempt failed and was rolled back by PatternProperties.phptpl,
so the key counts as unevaluated. Without this, an unevaluatedProperties:false
sibling miscredits a pattern-matched key whose value failed integer validation
and never fires for the orphan.

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

1 of 40 new or added lines in 5 files covered. (2.5%)

167 of 883 relevant lines covered (18.91%)

0.63 hits per line

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

0.0
/src/Exception/Object/RegularPropertyAsUnevaluatedPropertyException.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace PHPModelGenerator\Exception\Object;
6

7
use PHPModelGenerator\Exception\ValidationException;
8

9
/**
10
 * Thrown when a key already declared in `properties` or matched by `patternProperties` at the
11
 * same schema level is routed through the unevaluatedProperties accessor's set() method.
12
 * Such keys belong to their own (typed) named setter or to the pattern-properties accessor;
13
 * accepting them via setUnevaluatedProperty would silently bypass the appropriate validator.
14
 */
15
class RegularPropertyAsUnevaluatedPropertyException extends ValidationException
16
{
NEW
17
    public function __construct($providedValue, string $propertyName, private readonly string $class)
×
18
    {
NEW
19
        parent::__construct(
×
NEW
20
            "Couldn't add regular property $propertyName as unevaluated property to object {$this->class}",
×
NEW
21
            $propertyName,
×
NEW
22
            $providedValue
×
NEW
23
        );
×
24
    }
25

NEW
26
    public function getClass(): string
×
27
    {
NEW
28
        return $this->class;
×
29
    }
30
}
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