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

wol-soft / php-json-schema-model-generator / 19935187412

04 Dec 2025 03:55PM UTC coverage: 98.636% (-0.03%) from 98.665%
19935187412

push

github

wol-soft
fix recursion error #96

1 of 1 new or added line in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

3398 of 3445 relevant lines covered (98.64%)

566.51 hits per line

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

91.67
/src/PropertyProcessor/Decorator/TypeHint/ArrayTypeHintDecorator.php
1
<?php
2

3
declare(strict_types = 1);
4

5
namespace PHPModelGenerator\PropertyProcessor\Decorator\TypeHint;
6

7
use PHPModelGenerator\Model\Property\PropertyInterface;
8

9
/**
10
 * Class ArrayTypeHintDecorator
11
 *
12
 * @package PHPModelGenerator\PropertyProcessor\Decorator\Property
13
 */
14
class ArrayTypeHintDecorator implements TypeHintDecoratorInterface
15
{
16
    private int $recursiveArrayCheck = 0;
17

18
    public function __construct(protected PropertyInterface $nestedProperty) {}
19

20
    /**
21
     * @inheritdoc
22
     */
23
    public function decorate(string $input, bool $outputType = false): string
413✔
24
    {
25
        // TODO: provide better type hints. Currently provides e.g. "string|array[]" instead of "string|string[]" for a recursive string array
26
        if (++$this->recursiveArrayCheck > 1) {
413✔
UNCOV
27
            return $this->nestedProperty->getTypeHint($outputType, [self::class]);
×
28
        }
29

30
        $result = implode(
413✔
31
            '|',
413✔
32
            array_map(
413✔
33
                static fn(string $typeHint): string => "{$typeHint}[]",
413✔
34
                explode('|', $this->nestedProperty->getTypeHint($outputType)),
413✔
35
            )
413✔
36
        );
413✔
37

38
        $this->recursiveArrayCheck--;
413✔
39

40
        return $result;
413✔
41
    }
42
}
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

© 2025 Coveralls, Inc