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

api-platform / core / 17723449516

15 Sep 2025 05:52AM UTC coverage: 0.0% (-22.6%) from 22.578%
17723449516

Pull #7383

github

web-flow
Merge fa5b61e35 into 949c3c975
Pull Request #7383: fix(metadata): compute isWritable during updates

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

11356 existing lines in 371 files now uncovered.

0 of 48868 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/Metadata.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;
15

16
use ApiPlatform\State\OptionsInterface;
17

18
/**
19
 * @internal
20
 */
21
abstract class Metadata
22
{
23
    protected ?Parameters $parameters = null;
24

25
    /**
26
     * @param string|null                                                                       $deprecationReason       https://api-platform.com/docs/core/deprecations/#deprecating-resource-classes-operations-and-properties
27
     * @param string|\Stringable|null                                                           $security                https://api-platform.com/docs/core/security
28
     * @param string|\Stringable|null                                                           $securityPostDenormalize https://api-platform.com/docs/core/security/#executing-access-control-rules-after-denormalization
29
     * @param mixed|null                                                                        $mercure
30
     * @param mixed|null                                                                        $messenger
31
     * @param mixed|null                                                                        $input
32
     * @param mixed|null                                                                        $output
33
     * @param mixed|null                                                                        $provider
34
     * @param mixed|null                                                                        $processor
35
     * @param Parameters|array<string, Parameter>                                               $parameters
36
     * @param callable|string|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules                   Laravel rules can be a FormRequest class, a callable or an array of rules
37
     */
38
    public function __construct(
39
        protected ?string $shortName = null,
40
        protected ?string $class = null,
41
        protected ?string $description = null,
42
        protected ?int $urlGenerationStrategy = null,
43
        protected ?string $deprecationReason = null,
44
        protected ?array $normalizationContext = null,
45
        protected ?array $denormalizationContext = null,
46
        protected ?bool $collectDenormalizationErrors = null,
47
        protected ?array $validationContext = null,
48
        protected ?array $filters = null,
49
        protected $mercure = null,
50
        protected $messenger = null,
51
        protected $input = null,
52
        protected $output = null,
53
        protected ?array $order = null,
54
        protected ?bool $fetchPartial = null,
55
        protected ?bool $forceEager = null,
56
        protected ?bool $paginationEnabled = null,
57
        protected ?string $paginationType = null,
58
        protected ?int $paginationItemsPerPage = null,
59
        protected ?int $paginationMaximumItemsPerPage = null,
60
        protected ?bool $paginationPartial = null,
61
        protected ?bool $paginationClientEnabled = null,
62
        protected ?bool $paginationClientItemsPerPage = null,
63
        protected ?bool $paginationClientPartial = null,
64
        protected ?bool $paginationFetchJoinCollection = null,
65
        protected ?bool $paginationUseOutputWalkers = null,
66
        protected string|\Stringable|null $security = null,
67
        protected ?string $securityMessage = null,
68
        protected string|\Stringable|null $securityPostDenormalize = null,
69
        protected ?string $securityPostDenormalizeMessage = null,
70
        protected string|\Stringable|null $securityPostValidation = null,
71
        protected ?string $securityPostValidationMessage = null,
72
        protected $provider = null,
73
        protected $processor = null,
74
        protected ?OptionsInterface $stateOptions = null,
75
        /*
76
         * @experimental
77
         */
78
        array|Parameters|null $parameters = null,
79
        protected mixed $rules = null,
80
        protected ?string $policy = null,
81
        protected array|string|null $middleware = null,
82
        protected ?bool $queryParameterValidationEnabled = null,
83
        protected ?bool $strictQueryParameterValidation = null,
84
        protected ?bool $hideHydraOperation = null,
85
        protected array $extraProperties = [],
86
    ) {
UNCOV
87
        if (\is_array($parameters) && $parameters) {
×
UNCOV
88
            $parameters = new Parameters($parameters);
×
89
        }
90

UNCOV
91
        $this->parameters = $parameters;
×
92
    }
93

94
    public function getShortName(): ?string
95
    {
UNCOV
96
        return $this->shortName;
×
97
    }
98

99
    public function withShortName(string $shortName): static
100
    {
UNCOV
101
        $self = clone $this;
×
UNCOV
102
        $self->shortName = $shortName;
×
103

UNCOV
104
        return $self;
×
105
    }
106

107
    public function getClass(): ?string
108
    {
UNCOV
109
        return $this->class;
×
110
    }
111

112
    public function withClass(string $class): static
113
    {
UNCOV
114
        $self = clone $this;
×
UNCOV
115
        $self->class = $class;
×
116

UNCOV
117
        return $self;
×
118
    }
119

120
    public function getDescription(): ?string
121
    {
UNCOV
122
        return $this->description;
×
123
    }
124

125
    public function withDescription(?string $description = null): static
126
    {
UNCOV
127
        $self = clone $this;
×
UNCOV
128
        $self->description = $description;
×
129

UNCOV
130
        return $self;
×
131
    }
132

133
    public function getUrlGenerationStrategy(): ?int
134
    {
UNCOV
135
        return $this->urlGenerationStrategy;
×
136
    }
137

138
    public function withUrlGenerationStrategy(int $urlGenerationStrategy): static
139
    {
140
        $self = clone $this;
×
141
        $self->urlGenerationStrategy = $urlGenerationStrategy;
×
142

143
        return $self;
×
144
    }
145

146
    public function getDeprecationReason(): ?string
147
    {
UNCOV
148
        return $this->deprecationReason;
×
149
    }
150

151
    public function withDeprecationReason($deprecationReason): static
152
    {
153
        $self = clone $this;
×
154
        $self->deprecationReason = $deprecationReason;
×
155

156
        return $self;
×
157
    }
158

159
    public function getNormalizationContext(): ?array
160
    {
UNCOV
161
        return $this->normalizationContext;
×
162
    }
163

164
    public function withNormalizationContext(array $normalizationContext): static
165
    {
UNCOV
166
        $self = clone $this;
×
UNCOV
167
        $self->normalizationContext = $normalizationContext;
×
168

UNCOV
169
        return $self;
×
170
    }
171

172
    public function getDenormalizationContext(): ?array
173
    {
UNCOV
174
        return $this->denormalizationContext;
×
175
    }
176

177
    public function withDenormalizationContext(array $denormalizationContext): static
178
    {
UNCOV
179
        $self = clone $this;
×
UNCOV
180
        $self->denormalizationContext = $denormalizationContext;
×
181

UNCOV
182
        return $self;
×
183
    }
184

185
    public function getCollectDenormalizationErrors(): ?bool
186
    {
UNCOV
187
        return $this->collectDenormalizationErrors;
×
188
    }
189

190
    public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors = null): static
191
    {
192
        $self = clone $this;
×
193
        $self->collectDenormalizationErrors = $collectDenormalizationErrors;
×
194

195
        return $self;
×
196
    }
197

198
    public function getValidationContext(): ?array
199
    {
UNCOV
200
        return $this->validationContext;
×
201
    }
202

203
    public function withValidationContext(array $validationContext): static
204
    {
205
        $self = clone $this;
×
206
        $self->validationContext = $validationContext;
×
207

208
        return $self;
×
209
    }
210

211
    /**
212
     * @return string[]|null
213
     */
214
    public function getFilters(): ?array
215
    {
UNCOV
216
        return $this->filters;
×
217
    }
218

219
    public function withFilters(array $filters): static
220
    {
UNCOV
221
        $self = clone $this;
×
UNCOV
222
        $self->filters = $filters;
×
223

UNCOV
224
        return $self;
×
225
    }
226

227
    /**
228
     * @return array|bool|mixed|null
229
     */
230
    public function getMercure()
231
    {
UNCOV
232
        return $this->mercure;
×
233
    }
234

235
    public function withMercure($mercure): static
236
    {
UNCOV
237
        $self = clone $this;
×
UNCOV
238
        $self->mercure = $mercure;
×
239

UNCOV
240
        return $self;
×
241
    }
242

243
    public function getMessenger()
244
    {
UNCOV
245
        return $this->messenger;
×
246
    }
247

248
    public function withMessenger($messenger): static
249
    {
250
        $self = clone $this;
×
251
        $self->messenger = $messenger;
×
252

253
        return $self;
×
254
    }
255

256
    public function getInput()
257
    {
UNCOV
258
        return $this->input;
×
259
    }
260

261
    public function withInput($input): static
262
    {
UNCOV
263
        $self = clone $this;
×
UNCOV
264
        $self->input = $input;
×
265

UNCOV
266
        return $self;
×
267
    }
268

269
    public function getOutput()
270
    {
UNCOV
271
        return $this->output;
×
272
    }
273

274
    public function withOutput($output): static
275
    {
UNCOV
276
        $self = clone $this;
×
UNCOV
277
        $self->output = $output;
×
278

UNCOV
279
        return $self;
×
280
    }
281

282
    public function getOrder(): ?array
283
    {
UNCOV
284
        return $this->order;
×
285
    }
286

287
    public function withOrder(array $order): static
288
    {
289
        $self = clone $this;
×
290
        $self->order = $order;
×
291

292
        return $self;
×
293
    }
294

295
    public function getFetchPartial(): ?bool
296
    {
UNCOV
297
        return $this->fetchPartial;
×
298
    }
299

300
    public function withFetchPartial(bool $fetchPartial): static
301
    {
302
        $self = clone $this;
×
303
        $self->fetchPartial = $fetchPartial;
×
304

305
        return $self;
×
306
    }
307

308
    public function getForceEager(): ?bool
309
    {
UNCOV
310
        return $this->forceEager;
×
311
    }
312

313
    public function withForceEager(bool $forceEager): static
314
    {
315
        $self = clone $this;
×
316
        $self->forceEager = $forceEager;
×
317

318
        return $self;
×
319
    }
320

321
    public function getPaginationEnabled(): ?bool
322
    {
UNCOV
323
        return $this->paginationEnabled;
×
324
    }
325

326
    public function withPaginationEnabled(bool $paginationEnabled): static
327
    {
328
        $self = clone $this;
×
329
        $self->paginationEnabled = $paginationEnabled;
×
330

331
        return $self;
×
332
    }
333

334
    public function getPaginationType(): ?string
335
    {
UNCOV
336
        return $this->paginationType;
×
337
    }
338

339
    public function withPaginationType(string $paginationType): static
340
    {
341
        $self = clone $this;
×
342
        $self->paginationType = $paginationType;
×
343

344
        return $self;
×
345
    }
346

347
    public function getPaginationItemsPerPage(): ?int
348
    {
UNCOV
349
        return $this->paginationItemsPerPage;
×
350
    }
351

352
    public function withPaginationItemsPerPage(int $paginationItemsPerPage): static
353
    {
UNCOV
354
        $self = clone $this;
×
UNCOV
355
        $self->paginationItemsPerPage = $paginationItemsPerPage;
×
356

UNCOV
357
        return $self;
×
358
    }
359

360
    public function getPaginationMaximumItemsPerPage(): ?int
361
    {
UNCOV
362
        return $this->paginationMaximumItemsPerPage;
×
363
    }
364

365
    public function withPaginationMaximumItemsPerPage(int $paginationMaximumItemsPerPage): static
366
    {
367
        $self = clone $this;
×
368
        $self->paginationMaximumItemsPerPage = $paginationMaximumItemsPerPage;
×
369

370
        return $self;
×
371
    }
372

373
    public function getPaginationPartial(): ?bool
374
    {
UNCOV
375
        return $this->paginationPartial;
×
376
    }
377

378
    public function withPaginationPartial(bool $paginationPartial): static
379
    {
380
        $self = clone $this;
×
381
        $self->paginationPartial = $paginationPartial;
×
382

383
        return $self;
×
384
    }
385

386
    public function getPaginationClientEnabled(): ?bool
387
    {
UNCOV
388
        return $this->paginationClientEnabled;
×
389
    }
390

391
    public function withPaginationClientEnabled(bool $paginationClientEnabled): static
392
    {
UNCOV
393
        $self = clone $this;
×
UNCOV
394
        $self->paginationClientEnabled = $paginationClientEnabled;
×
395

UNCOV
396
        return $self;
×
397
    }
398

399
    public function getPaginationClientItemsPerPage(): ?bool
400
    {
UNCOV
401
        return $this->paginationClientItemsPerPage;
×
402
    }
403

404
    public function withPaginationClientItemsPerPage(bool $paginationClientItemsPerPage): static
405
    {
UNCOV
406
        $self = clone $this;
×
UNCOV
407
        $self->paginationClientItemsPerPage = $paginationClientItemsPerPage;
×
408

UNCOV
409
        return $self;
×
410
    }
411

412
    public function getPaginationClientPartial(): ?bool
413
    {
UNCOV
414
        return $this->paginationClientPartial;
×
415
    }
416

417
    public function withPaginationClientPartial(bool $paginationClientPartial): static
418
    {
UNCOV
419
        $self = clone $this;
×
UNCOV
420
        $self->paginationClientPartial = $paginationClientPartial;
×
421

UNCOV
422
        return $self;
×
423
    }
424

425
    public function getPaginationFetchJoinCollection(): ?bool
426
    {
UNCOV
427
        return $this->paginationFetchJoinCollection;
×
428
    }
429

430
    public function withPaginationFetchJoinCollection(bool $paginationFetchJoinCollection): static
431
    {
432
        $self = clone $this;
×
433
        $self->paginationFetchJoinCollection = $paginationFetchJoinCollection;
×
434

435
        return $self;
×
436
    }
437

438
    public function getPaginationUseOutputWalkers(): ?bool
439
    {
UNCOV
440
        return $this->paginationUseOutputWalkers;
×
441
    }
442

443
    public function withPaginationUseOutputWalkers(bool $paginationUseOutputWalkers): static
444
    {
445
        $self = clone $this;
×
446
        $self->paginationUseOutputWalkers = $paginationUseOutputWalkers;
×
447

448
        return $self;
×
449
    }
450

451
    public function getSecurity(): ?string
452
    {
UNCOV
453
        return $this->security instanceof \Stringable ? (string) $this->security : $this->security;
×
454
    }
455

456
    public function withSecurity($security): static
457
    {
UNCOV
458
        $self = clone $this;
×
UNCOV
459
        $self->security = $security;
×
460

UNCOV
461
        return $self;
×
462
    }
463

464
    public function getSecurityMessage(): ?string
465
    {
UNCOV
466
        return $this->securityMessage;
×
467
    }
468

469
    public function withSecurityMessage(string $securityMessage): static
470
    {
471
        $self = clone $this;
×
472
        $self->securityMessage = $securityMessage;
×
473

474
        return $self;
×
475
    }
476

477
    public function getSecurityPostDenormalize(): ?string
478
    {
UNCOV
479
        return $this->securityPostDenormalize instanceof \Stringable ? (string) $this->securityPostDenormalize : $this->securityPostDenormalize;
×
480
    }
481

482
    public function withSecurityPostDenormalize($securityPostDenormalize): static
483
    {
484
        $self = clone $this;
×
485
        $self->securityPostDenormalize = $securityPostDenormalize;
×
486

487
        return $self;
×
488
    }
489

490
    public function getSecurityPostDenormalizeMessage(): ?string
491
    {
UNCOV
492
        return $this->securityPostDenormalizeMessage;
×
493
    }
494

495
    public function withSecurityPostDenormalizeMessage(string $securityPostDenormalizeMessage): static
496
    {
497
        $self = clone $this;
×
498
        $self->securityPostDenormalizeMessage = $securityPostDenormalizeMessage;
×
499

500
        return $self;
×
501
    }
502

503
    public function getSecurityPostValidation(): ?string
504
    {
UNCOV
505
        return $this->securityPostValidation instanceof \Stringable ? (string) $this->securityPostValidation : $this->securityPostValidation;
×
506
    }
507

508
    public function withSecurityPostValidation(string|\Stringable|null $securityPostValidation = null): static
509
    {
510
        $self = clone $this;
×
511
        $self->securityPostValidation = $securityPostValidation;
×
512

513
        return $self;
×
514
    }
515

516
    public function getSecurityPostValidationMessage(): ?string
517
    {
UNCOV
518
        return $this->securityPostValidationMessage;
×
519
    }
520

521
    public function withSecurityPostValidationMessage(?string $securityPostValidationMessage = null): static
522
    {
523
        $self = clone $this;
×
524
        $self->securityPostValidationMessage = $securityPostValidationMessage;
×
525

526
        return $self;
×
527
    }
528

529
    public function getProcessor(): callable|string|null
530
    {
UNCOV
531
        return $this->processor;
×
532
    }
533

534
    public function withProcessor(callable|string|null $processor): static
535
    {
UNCOV
536
        $self = clone $this;
×
UNCOV
537
        $self->processor = $processor;
×
538

UNCOV
539
        return $self;
×
540
    }
541

542
    public function getProvider(): callable|string|null
543
    {
UNCOV
544
        return $this->provider;
×
545
    }
546

547
    public function withProvider(callable|string|null $provider): static
548
    {
UNCOV
549
        $self = clone $this;
×
UNCOV
550
        $self->provider = $provider;
×
551

UNCOV
552
        return $self;
×
553
    }
554

555
    public function getStateOptions(): ?OptionsInterface
556
    {
UNCOV
557
        return $this->stateOptions;
×
558
    }
559

560
    public function withStateOptions(?OptionsInterface $stateOptions): static
561
    {
UNCOV
562
        $self = clone $this;
×
UNCOV
563
        $self->stateOptions = $stateOptions;
×
564

UNCOV
565
        return $self;
×
566
    }
567

568
    /**
569
     * @return string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string>
570
     */
571
    public function getRules(): mixed
572
    {
UNCOV
573
        return $this->rules;
×
574
    }
575

576
    /**
577
     * @param string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules
578
     */
579
    public function withRules(mixed $rules): static
580
    {
581
        $self = clone $this;
×
582
        $self->rules = $rules;
×
583

584
        return $self;
×
585
    }
586

587
    public function getParameters(): ?Parameters
588
    {
UNCOV
589
        return $this->parameters;
×
590
    }
591

592
    public function withParameters(array|Parameters $parameters): static
593
    {
UNCOV
594
        $self = clone $this;
×
UNCOV
595
        $self->parameters = \is_array($parameters) ? new Parameters($parameters) : $parameters;
×
596

UNCOV
597
        return $self;
×
598
    }
599

600
    public function getQueryParameterValidationEnabled(): ?bool
601
    {
UNCOV
602
        return $this->queryParameterValidationEnabled;
×
603
    }
604

605
    public function withQueryParameterValidationEnabled(bool $queryParameterValidationEnabled): static
606
    {
607
        $self = clone $this;
×
608
        $self->queryParameterValidationEnabled = $queryParameterValidationEnabled;
×
609

610
        return $self;
×
611
    }
612

613
    public function getPolicy(): ?string
614
    {
UNCOV
615
        return $this->policy;
×
616
    }
617

618
    public function withPolicy(string $policy): static
619
    {
620
        $self = clone $this;
×
621
        $self->policy = $policy;
×
622

623
        return $self;
×
624
    }
625

626
    public function getMiddleware(): mixed
627
    {
UNCOV
628
        return $this->middleware;
×
629
    }
630

631
    public function withMiddleware(string|array $middleware): static
632
    {
633
        $self = clone $this;
×
634
        $self->middleware = $middleware;
×
635

636
        return $self;
×
637
    }
638

639
    public function getExtraProperties(): ?array
640
    {
UNCOV
641
        return $this->extraProperties;
×
642
    }
643

644
    public function withExtraProperties(array $extraProperties = []): static
645
    {
UNCOV
646
        $self = clone $this;
×
UNCOV
647
        $self->extraProperties = $extraProperties;
×
648

UNCOV
649
        return $self;
×
650
    }
651

652
    public function getStrictQueryParameterValidation(): ?bool
653
    {
UNCOV
654
        return $this->strictQueryParameterValidation;
×
655
    }
656

657
    public function withStrictQueryParameterValidation(bool $strictQueryParameterValidation): static
658
    {
659
        $self = clone $this;
×
660
        $self->strictQueryParameterValidation = $strictQueryParameterValidation;
×
661

662
        return $self;
×
663
    }
664

665
    public function getHideHydraOperation(): ?bool
666
    {
UNCOV
667
        return $this->hideHydraOperation;
×
668
    }
669

670
    public function withHideHydraOperation(bool $hideHydraOperation): static
671
    {
UNCOV
672
        $self = clone $this;
×
UNCOV
673
        $self->hideHydraOperation = $hideHydraOperation;
×
674

UNCOV
675
        return $self;
×
676
    }
677
}
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