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

api-platform / core / 14954769666

11 May 2025 10:14AM UTC coverage: 0.0% (-8.5%) from 8.457%
14954769666

Pull #7135

github

web-flow
Merge bf21e0bc7 into 4dd0cdfc4
Pull Request #7135: fix(symfony,laravel): InvalidUriVariableException status code (e400)

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

11040 existing lines in 370 files now uncovered.

0 of 48303 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/src/Metadata/Property/Factory/PropertyInfoPropertyMetadataFactory.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Metadata\Property\Factory;
15

16
use ApiPlatform\Metadata\ApiProperty;
17
use ApiPlatform\Metadata\Exception\PropertyNotFoundException;
18
use Doctrine\Common\Collections\ArrayCollection;
19
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
20
use Symfony\Component\PropertyInfo\Type;
21

22
/**
23
 * PropertyInfo metadata loader decorator.
24
 *
25
 * @author Kévin Dunglas <dunglas@gmail.com>
26
 */
27
final class PropertyInfoPropertyMetadataFactory implements PropertyMetadataFactoryInterface
28
{
29
    public function __construct(private readonly PropertyInfoExtractorInterface $propertyInfo, private readonly ?PropertyMetadataFactoryInterface $decorated = null)
30
    {
UNCOV
31
    }
×
32

33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function create(string $resourceClass, string $property, array $options = []): ApiProperty
37
    {
UNCOV
38
        if (null === $this->decorated) {
×
39
            $propertyMetadata = new ApiProperty();
×
40
        } else {
41
            try {
UNCOV
42
                $propertyMetadata = $this->decorated->create($resourceClass, $property, $options);
×
UNCOV
43
            } catch (PropertyNotFoundException) {
×
UNCOV
44
                $propertyMetadata = new ApiProperty();
×
45
            }
46
        }
47

UNCOV
48
        if (!$propertyMetadata->getBuiltinTypes()) {
×
UNCOV
49
            $types = $this->propertyInfo->getTypes($resourceClass, $property, $options) ?? [];
×
50

UNCOV
51
            foreach ($types as $i => $type) {
×
52
                // Temp fix for https://github.com/symfony/symfony/pull/52699
UNCOV
53
                if (ArrayCollection::class === $type->getClassName()) {
×
UNCOV
54
                    $types[$i] = new Type($type->getBuiltinType(), $type->isNullable(), $type->getClassName(), true, $type->getCollectionKeyTypes(), $type->getCollectionValueTypes());
×
55
                }
56
            }
57

UNCOV
58
            $propertyMetadata = $propertyMetadata->withBuiltinTypes($types);
×
59
        }
60

UNCOV
61
        if (null === $propertyMetadata->getDescription() && null !== $description = $this->propertyInfo->getShortDescription($resourceClass, $property, $options)) {
×
UNCOV
62
            $propertyMetadata = $propertyMetadata->withDescription($description);
×
63
        }
64

UNCOV
65
        if (null === $propertyMetadata->isReadable() && null !== $readable = $this->propertyInfo->isReadable($resourceClass, $property, $options)) {
×
UNCOV
66
            $propertyMetadata = $propertyMetadata->withReadable($readable);
×
67
        }
68

UNCOV
69
        if (null === $propertyMetadata->isWritable() && null !== $writable = $this->propertyInfo->isWritable($resourceClass, $property, $options)) {
×
UNCOV
70
            $propertyMetadata = $propertyMetadata->withWritable($writable);
×
71
        }
72

73
        /* @phpstan-ignore-next-line */
UNCOV
74
        if (null === $propertyMetadata->isInitializable() && null !== $initializable = $this->propertyInfo->isInitializable($resourceClass, $property, $options)) {
×
UNCOV
75
            $propertyMetadata = $propertyMetadata->withInitializable($initializable);
×
76
        }
77

UNCOV
78
        return $propertyMetadata;
×
79
    }
80
}
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