Skip to content

Commit

Permalink
ReadOnly -> ReadOnlyAnnotation
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-gui committed Dec 6, 2023
1 parent ba908d2 commit e8cba6f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions doc/reference/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ should be inlined.
objects with this annotation. Also, AccessorOrder will be using the name of the property
to determine the order.

@ReadOnly
~~~~~~~~~
@ReadOnlyAnnotation
~~~~~~~~~~~~~~~~~~~
This annotation can be defined on a property to indicate that the data of the property
is read only and cannot be set during deserialization.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @Annotation
* @Target({"CLASS","PROPERTY"})
*/
final class ReadOnly
final class ReadOnlyAnnotation
{
/**
* @var boolean
Expand Down
6 changes: 3 additions & 3 deletions src/JMS/Serializer/Metadata/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use JMS\Serializer\Annotation\PostDeserialize;
use JMS\Serializer\Annotation\PostSerialize;
use JMS\Serializer\Annotation\PreSerialize;
use JMS\Serializer\Annotation\ReadOnly;
use JMS\Serializer\Annotation\ReadOnlyAnnotation;
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Since;
use JMS\Serializer\Annotation\SkipWhenEmpty;
Expand Down Expand Up @@ -77,7 +77,7 @@ public function loadMetadataForClass(\ReflectionClass $class)
$excludeAll = true;
} elseif ($annot instanceof AccessType) {
$classAccessType = $annot->type;
} elseif ($annot instanceof ReadOnly) {
} elseif ($annot instanceof ReadOnlyAnnotation) {
$readOnlyClass = true;
} elseif ($annot instanceof AccessorOrder) {
$classMetadata->setAccessorOrder($annot->order, $annot->custom);
Expand Down Expand Up @@ -196,7 +196,7 @@ public function loadMetadataForClass(\ReflectionClass $class)
$propertyMetadata->xmlElementCData = $annot->cdata;
} elseif ($annot instanceof AccessType) {
$accessType = $annot->type;
} elseif ($annot instanceof ReadOnly) {
} elseif ($annot instanceof ReadOnlyAnnotation) {
$propertyMetadata->readOnly = $annot->readOnly;
} elseif ($annot instanceof Accessor) {
$accessor = array($annot->getter, $annot->setter);
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/AuthorReadOnly.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace JMS\Serializer\Tests\Fixtures;

use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\ReadOnly;
use JMS\Serializer\Annotation\ReadOnlyAnnotation;
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlRoot;
Expand All @@ -12,7 +12,7 @@
class AuthorReadOnly
{
/**
* @ReadOnly
* @ReadOnlyAnnotation
* @SerializedName("id")
*/
private $id;
Expand Down
8 changes: 4 additions & 4 deletions tests/Fixtures/AuthorReadOnlyPerClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
namespace JMS\Serializer\Tests\Fixtures;

use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\ReadOnly;
use JMS\Serializer\Annotation\ReadOnlyAnnotation;
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlRoot;

/**
* @XmlRoot("author")
* @ReadOnly
* @ReadOnlyAnnotation
*/
class AuthorReadOnlyPerClass
{
/**
* @ReadOnly
* @ReadOnlyAnnotation
* @SerializedName("id")
*/
private $id;
Expand All @@ -24,7 +24,7 @@ class AuthorReadOnlyPerClass
* @Type("string")
* @SerializedName("full_name")
* @Accessor("getName")
* @ReadOnly(false)
* @ReadOnlyAnnotation(false)
*/
private $name;

Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/ExcludePublicAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use JMS\Serializer\Annotation\AccessType;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\ReadOnly;
use JMS\Serializer\Annotation\ReadOnlyAnnotation;

/**
*/

/**
* @AccessType("public_method")
* @ReadOnly
* @ReadOnlyAnnotation
*/
class ExcludePublicAccessor
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/GetSetObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use JMS\Serializer\Annotation\AccessType;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\ReadOnly;
use JMS\Serializer\Annotation\ReadOnlyAnnotation;
use JMS\Serializer\Annotation\Type;

/** @AccessType("public_method") */
Expand All @@ -17,7 +17,7 @@ class GetSetObject
private $name = 'Foo';

/**
* @ReadOnly
* @ReadOnlyAnnotation
*/
private $readOnlyProperty = 42;

Expand Down

0 comments on commit e8cba6f

Please sign in to comment.