@@ -105,35 +105,35 @@ final class ApiProperty
105
105
private $ extraProperties ;
106
106
107
107
/**
108
- * @param string $description
109
- * @param bool $readable
110
- * @param bool $writable
111
- * @param bool $readableLink
112
- * @param bool $writableLink
113
- * @param bool $required
114
- * @param bool $identifier
115
- * @param string|int|float|bool|array $default
116
- * @param string|int|float|bool|array|null $example
117
- * @param string $deprecationReason
118
- * @param bool $fetchable
119
- * @param bool $fetchEager
120
- * @param array $jsonldContext
121
- * @param array $openapiContext
122
- * @param bool $push
123
- * @param string $security
124
- * @param string $securityPostDenormalize
108
+ * @param string $description
109
+ * @param bool $readable
110
+ * @param bool $writable
111
+ * @param bool $readableLink
112
+ * @param bool $writableLink
113
+ * @param bool $required
114
+ * @param bool $identifier
115
+ * @param string|int|float|bool|array $default
116
+ * @param string|int|float|bool|array $example
117
+ * @param string $deprecationReason
118
+ * @param bool $fetchable
119
+ * @param bool $fetchEager
120
+ * @param array $jsonldContext
121
+ * @param array $openapiContext
122
+ * @param bool $push
123
+ * @param string $security
124
+ * @param string $securityPostDenormalize
125
125
*/
126
126
public function __construct (
127
- $ description = null ,
127
+ ? string $ description = null ,
128
128
?bool $ readable = null ,
129
129
?bool $ writable = null ,
130
130
?bool $ readableLink = null ,
131
131
?bool $ writableLink = null ,
132
132
?bool $ required = null ,
133
133
?bool $ identifier = null ,
134
134
135
- $ default = null ,
136
- $ example = null ,
135
+ $ default = null ,
136
+ $ example = null ,
137
137
138
138
?string $ deprecationReason = null ,
139
139
?bool $ fetchable = null ,
@@ -469,7 +469,9 @@ public function withExtraProperties(array $extraProperties = []): self
469
469
return $ self ;
470
470
}
471
471
472
- /** TODO: backward compatibility layer with previous PropertyMetadata to be removed in 3.0 */
472
+ /**
473
+ * @deprecated since 2.7, to be removed in 3.0
474
+ */
473
475
public function withSubresource (SubresourceMetadata $ subresourceMetadata ): self
474
476
{
475
477
trigger_deprecation ('api-platform/core ' , '2.7 ' , 'Declaring a subresource on a property is deprecated, use alternate URLs instead. ' );
@@ -479,13 +481,18 @@ public function withSubresource(SubresourceMetadata $subresourceMetadata): self
479
481
return $ self ;
480
482
}
481
483
484
+ /**
485
+ * @deprecated since 2.7, to be removed in 3.0
486
+ */
482
487
public function getSubresource (): ?SubresourceMetadata
483
488
{
484
489
return $ this ->extraProperties ['subresource ' ] ?? null ;
485
490
}
486
491
487
492
/**
488
493
* Represents whether the property has a subresource.
494
+ *
495
+ * @deprecated since 2.7, to be removed in 3.0
489
496
*/
490
497
public function hasSubresource (): bool
491
498
{
@@ -533,6 +540,8 @@ public function withChildInherited(string $childInherited): self
533
540
534
541
/**
535
542
* Gets IRI of this property.
543
+ *
544
+ * @deprecated since 2.7, to be removed in 3.0, use getTypes instead
536
545
*/
537
546
public function getIri (): ?string
538
547
{
@@ -541,6 +550,8 @@ public function getIri(): ?string
541
550
542
551
/**
543
552
* Returns a new instance with the given IRI.
553
+ *
554
+ * @deprecated since 2.7, to be removed in 3.0, use withTypes instead
544
555
*/
545
556
public function withIri (string $ iri = null ): self
546
557
{
@@ -555,6 +566,8 @@ public function withIri(string $iri = null): self
555
566
/**
556
567
* Gets an attribute.
557
568
*
569
+ * @deprecated since 2.7, to be removed in 3.0, use getExtraProperties instead
570
+ *
558
571
* @param mixed|null $defaultValue
559
572
*/
560
573
public function getAttribute (string $ key , $ defaultValue = null )
@@ -576,6 +589,8 @@ public function getAttribute(string $key, $defaultValue = null)
576
589
577
590
/**
578
591
* Gets attributes.
592
+ *
593
+ * @deprecated since 2.7, to be removed in 3.0, renamed as getExtraProperties
579
594
*/
580
595
public function getAttributes (): ?array
581
596
{
@@ -584,9 +599,13 @@ public function getAttributes(): ?array
584
599
585
600
/**
586
601
* Returns a new instance with the given attribute.
602
+ *
603
+ * @deprecated since 2.7, to be removed in 3.0, renamed as withExtraProperties
587
604
*/
588
605
public function withAttributes (array $ attributes ): self
589
606
{
607
+ trigger_deprecation ('api-platform/core ' , '2.7 ' , sprintf ('"%s::%s" is deprecated since 2.7 and will be removed in 3.0. ' , __CLASS__ , __METHOD__ ));
608
+
590
609
$ metadata = clone $ this ;
591
610
592
611
return $ this ->withDeprecatedAttributes ($ metadata , $ attributes );
0 commit comments