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

api-platform / core / 13175753759

06 Feb 2025 09:30AM UTC coverage: 0.0% (-7.7%) from 7.663%
13175753759

Pull #6947

github

web-flow
Merge 432a515ad into de2d298e3
Pull Request #6947: fix(metadata): remove temporary fix for ArrayCollection

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

11655 existing lines in 385 files now uncovered.

0 of 47351 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 Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
19

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

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

UNCOV
46
        if (!$propertyMetadata->getBuiltinTypes()) {
×
NEW
47
            $propertyMetadata = $propertyMetadata->withBuiltinTypes($this->propertyInfo->getTypes($resourceClass, $property, $options) ?? []);
×
48
        }
49

UNCOV
50
        if (null === $propertyMetadata->getDescription() && null !== $description = $this->propertyInfo->getShortDescription($resourceClass, $property, $options)) {
×
UNCOV
51
            $propertyMetadata = $propertyMetadata->withDescription($description);
×
52
        }
53

UNCOV
54
        if (null === $propertyMetadata->isReadable() && null !== $readable = $this->propertyInfo->isReadable($resourceClass, $property, $options)) {
×
UNCOV
55
            $propertyMetadata = $propertyMetadata->withReadable($readable);
×
56
        }
57

UNCOV
58
        if (null === $propertyMetadata->isWritable() && null !== $writable = $this->propertyInfo->isWritable($resourceClass, $property, $options)) {
×
UNCOV
59
            $propertyMetadata = $propertyMetadata->withWritable($writable);
×
60
        }
61

62
        /* @phpstan-ignore-next-line */
UNCOV
63
        if (null === $propertyMetadata->isInitializable() && null !== $initializable = $this->propertyInfo->isInitializable($resourceClass, $property, $options)) {
×
UNCOV
64
            $propertyMetadata = $propertyMetadata->withInitializable($initializable);
×
65
        }
66

UNCOV
67
        return $propertyMetadata;
×
68
    }
69
}
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