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

api-platform / core / 17158226138

22 Aug 2025 02:38PM UTC coverage: 22.203% (-0.006%) from 22.209%
17158226138

Pull #7303

github

web-flow
Merge d35038aad into 9e382e01b
Pull Request #7303: fix(test): replace `Collection|iterable` with `Collection` and add appropriate PHPDoc tags

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

7 existing lines in 7 files now uncovered.

11699 of 52692 relevant lines covered (22.2%)

24.2 hits per line

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

0.0
/src/Serializer/Tests/Fixtures/ApiResource/Dummy.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\Serializer\Tests\Fixtures\ApiResource;
15

16
use ApiPlatform\Metadata\ApiProperty;
17
use ApiPlatform\Metadata\ApiResource;
18
use Doctrine\Common\Collections\ArrayCollection;
19
use Doctrine\Common\Collections\Collection;
20

21
/**
22
 * Dummy.
23
 *
24
 * @author Kévin Dunglas <dunglas@gmail.com>
25
 */
26
#[ApiResource(filters: ['my_dummy.boolean', 'my_dummy.date', 'my_dummy.exists', 'my_dummy.numeric', 'my_dummy.order', 'my_dummy.range', 'my_dummy.search', 'my_dummy.property'], extraProperties: ['standard_put' => false])]
27
class Dummy
28
{
29
    /**
30
     * @var int|null The id
31
     */
32
    private $id;
33

34
    /**
35
     * @var string The dummy name
36
     */
37
    #[ApiProperty(iris: ['https://schema.org/name'])]
38
    private string $name;
39

40
    /**
41
     * @var string|null The dummy name alias
42
     */
43
    #[ApiProperty(iris: ['https://schema.org/alternateName'])]
44
    private $alias;
45

46
    /**
47
     * @var array foo
48
     */
49
    private ?array $foo = null;
50

51
    /**
52
     * @var string|null A short description of the item
53
     */
54
    #[ApiProperty(iris: ['https://schema.org/description'])]
55
    public $description;
56

57
    /**
58
     * @var string|null A dummy
59
     */
60
    public $dummy;
61

62
    /**
63
     * @var bool|null A dummy boolean
64
     */
65
    public ?bool $dummyBoolean = null;
66

67
    /**
68
     * @var \DateTime|null A dummy date
69
     */
70
    #[ApiProperty(iris: ['https://schema.org/DateTime'])]
71
    public $dummyDate;
72

73
    /**
74
     * @var float|null A dummy float
75
     */
76
    public $dummyFloat;
77

78
    /**
79
     * @var string|null A dummy price
80
     */
81
    public $dummyPrice;
82

83
    #[ApiProperty(push: true)]
84
    public ?RelatedDummy $relatedDummy = null;
85

86
    public Collection|iterable $relatedDummies;
87

88
    /**
89
     * @var Collection<int, RelatedDummy>|iterable
90
     */
91
    public Collection|iterable $relatedDummiesWithUnionTypes;
92

93
    /**
94
     * @var array|null serialize data
95
     */
96
    public $jsonData = [];
97

98
    /**
99
     * @var array|null
100
     */
101
    public $arrayData = [];
102

103
    /**
104
     * @var string|null
105
     */
106
    public $nameConverted;
107

108
    public static function staticMethod(): void
109
    {
110
    }
×
111

112
    public function __construct()
113
    {
114
        $this->relatedDummies = new ArrayCollection();
×
115
        $this->relatedDummiesWithUnionTypes = new ArrayCollection();
×
116
    }
117

118
    public function getId()
119
    {
120
        return $this->id;
×
121
    }
122

123
    public function setId($id): void
124
    {
125
        $this->id = $id;
×
126
    }
127

128
    public function setName(string $name): void
129
    {
130
        $this->name = $name;
×
131
    }
132

133
    public function getName(): string
134
    {
135
        return $this->name;
×
136
    }
137

138
    public function setAlias($alias): void
139
    {
140
        $this->alias = $alias;
×
141
    }
142

143
    public function getAlias()
144
    {
145
        return $this->alias;
×
146
    }
147

148
    public function setDescription($description): void
149
    {
150
        $this->description = $description;
×
151
    }
152

153
    public function getDescription()
154
    {
155
        return $this->description;
×
156
    }
157

158
    public function fooBar($baz): void
159
    {
160
    }
×
161

162
    public function getFoo(): ?array
163
    {
164
        return $this->foo;
×
165
    }
166

167
    public function setFoo(?array $foo = null): void
168
    {
169
        $this->foo = $foo;
×
170
    }
171

172
    public function setDummyDate(?\DateTime $dummyDate = null): void
173
    {
174
        $this->dummyDate = $dummyDate;
×
175
    }
176

177
    public function getDummyDate()
178
    {
179
        return $this->dummyDate;
×
180
    }
181

182
    public function setDummyPrice($dummyPrice)
183
    {
184
        $this->dummyPrice = $dummyPrice;
×
185

186
        return $this;
×
187
    }
188

189
    public function getDummyPrice()
190
    {
191
        return $this->dummyPrice;
×
192
    }
193

194
    public function setJsonData($jsonData): void
195
    {
196
        $this->jsonData = $jsonData;
×
197
    }
198

199
    public function getJsonData()
200
    {
201
        return $this->jsonData;
×
202
    }
203

204
    public function setArrayData($arrayData): void
205
    {
206
        $this->arrayData = $arrayData;
×
207
    }
208

209
    public function getArrayData()
210
    {
211
        return $this->arrayData;
×
212
    }
213

214
    public function getRelatedDummy(): ?RelatedDummy
215
    {
216
        return $this->relatedDummy;
×
217
    }
218

219
    public function setRelatedDummy(RelatedDummy $relatedDummy): void
220
    {
221
        $this->relatedDummy = $relatedDummy;
×
222
    }
223

224
    public function addRelatedDummy(RelatedDummy $relatedDummy): void
225
    {
NEW
226
        if (!$this->relatedDummies instanceof Collection) {
×
NEW
227
            return;
×
228
        }
229

UNCOV
230
        $this->relatedDummies->add($relatedDummy);
×
231
    }
232

233
    public function isDummyBoolean(): ?bool
234
    {
235
        return $this->dummyBoolean;
×
236
    }
237

238
    /**
239
     * @param bool $dummyBoolean
240
     */
241
    public function setDummyBoolean($dummyBoolean): void
242
    {
243
        $this->dummyBoolean = $dummyBoolean;
×
244
    }
245

246
    public function setDummy($dummy = null): void
247
    {
248
        $this->dummy = $dummy;
×
249
    }
250

251
    public function getDummy()
252
    {
253
        return $this->dummy;
×
254
    }
255

256
    public function getRelatedDummies(): Collection|iterable
257
    {
258
        return $this->relatedDummies;
×
259
    }
260
}
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