Skip to content

Commit

Permalink
chore: rename attribute namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
alekitto committed Apr 25, 2024
1 parent 3c95657 commit aaaa87d
Show file tree
Hide file tree
Showing 140 changed files with 324 additions and 322 deletions.
20 changes: 10 additions & 10 deletions docs/cookbook/exclusion_strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ object will be serialized. If you only want to expose a few of the properties,
then it is easier to change the exclusion policy, and only mark these few properties:

```php
use Kcs\Serializer\Annotation\ExclusionPolicy;
use Kcs\Serializer\Annotation\Expose;
use Kcs\Serializer\Attribute\ExclusionPolicy;
use Kcs\Serializer\Attribute\Expose;

/**
* The following annotations tells the serializer to skip all properties which
Expand All @@ -42,9 +42,9 @@ Versioning Objects
The serializer comes by default with a feature which allows you to add versioning support to your objects.

```php
use Kcs\Serializer\Annotation\SerializedName;
use Kcs\Serializer\Annotation\Since;
use Kcs\Serializer\Annotation\Until;
use Kcs\Serializer\Attribute\SerializedName;
use Kcs\Serializer\Attribute\Since;
use Kcs\Serializer\Attribute\Until;

class VersionedObject
{
Expand Down Expand Up @@ -78,7 +78,7 @@ user can request a list of items or the details of a single item.
You can achieve that by using the `Groups` attribute on your properties.

```php
use Kcs\Serializer\Annotation\Groups;
use Kcs\Serializer\Attribute\Groups;

class BlogPost
{
Expand Down Expand Up @@ -123,7 +123,7 @@ depths of the object graph.
For example if you have a User that has a manager and friends:

```php
use Kcs\Serializer\Annotation\Groups;
use Kcs\Serializer\Attribute\Groups;

class User
{
Expand Down Expand Up @@ -234,8 +234,8 @@ In some cases it is preferred to include the property but set it to `null`.
In these cases you can add the `OnExclude` attribute on the property setting the preferred exclusion behavior.

```php
use Kcs\Serializer\Annotation\Groups;
use Kcs\Serializer\Annotation\OnExclude;
use Kcs\Serializer\Attribute\Groups;
use Kcs\Serializer\Attribute\OnExclude;

class MyObject
{
Expand All @@ -257,7 +257,7 @@ affect the serialized content of others classes than the one you apply the
annotation to.

```php
use Kcs\Serializer\Annotation\MaxDepth;
use Kcs\Serializer\Attribute\MaxDepth;

class User
{
Expand Down
44 changes: 22 additions & 22 deletions docs/reference/php_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Arguments:
| setter | string | no | The setter method to use to write the property |

```php
use Kcs\Serializer\Annotation\Accessor;
use Kcs\Serializer\Attribute\Accessor;

class User
{
Expand Down Expand Up @@ -49,9 +49,9 @@ Arguments:
| custom | string[] | yes if order is custom | Property names of custom order |

```php
use Kcs\Serializer\Annotation\AccessorOrder;
use Kcs\Serializer\Annotation\SerializedName;
use Kcs\Serializer\Annotation\VirtualProperty;
use Kcs\Serializer\Attribute\AccessorOrder;
use Kcs\Serializer\Attribute\SerializedName;
use Kcs\Serializer\Attribute\VirtualProperty;
use Kcs\Serializer\Metadata\Access;

/**
Expand Down Expand Up @@ -105,7 +105,7 @@ Arguments:
| type | Kcs\Serializer\Metadata\Access\Type | yes | Could be "Property", or "PublicMethod" |

```php
use Kcs\Serializer\Annotation\AccessType;
use Kcs\Serializer\Attribute\AccessType;
use Kcs\Serializer\Metadata\Access;

#[AccessType(Access\Type::Property)]
Expand Down Expand Up @@ -146,8 +146,8 @@ and the second is the array of arguments.
This is needed as PHP attributes only accepts constant expressions, so "new" is not valid in that context.

```php
use Kcs\Serializer\Annotation\AdditionalField;
use Kcs\Serializer\Annotation\SerializedName;
use Kcs\Serializer\Attribute\AdditionalField;
use Kcs\Serializer\Attribute\SerializedName;

// ! A custom handler for User::user_links must be registered on handler registry

Expand Down Expand Up @@ -182,7 +182,7 @@ Arguments:
| outputBom | bool | no | Output UTF BOM |

```php
use Kcs\Serializer\Annotation\Csv;
use Kcs\Serializer\Attribute\Csv;

#[Csv(delimiter: ';')]
class User
Expand Down Expand Up @@ -213,7 +213,7 @@ Arguments:
| groups | string[] | no | The key separator |

```php
use Kcs\Serializer\Annotation\Discriminator;
use Kcs\Serializer\Attribute\Discriminator;

#[Discriminator(field: 'type', map: ['car' => 'Car', 'moped' => 'Moped'])]
abstract class Vehicle { }
Expand Down Expand Up @@ -350,8 +350,8 @@ Arguments:
For example, you can use:

```php
use Kcs\Serializer\Annotation\StaticField;
use Kcs\Serializer\Annotation\Type;
use Kcs\Serializer\Attribute\StaticField;
use Kcs\Serializer\Attribute\Type;

#[StaticField('additional', value: '12', attributes: [ [Type::class, ['integer']] ])]
class User
Expand Down Expand Up @@ -405,7 +405,7 @@ Examples:
```php
namespace MyNamespace;

use Kcs\Serializer\Annotation\Type;
use Kcs\Serializer\Attribute\Type;

class BlogPost
{
Expand Down Expand Up @@ -467,7 +467,7 @@ Arguments:
| namespace | string | no | The (optional) namespace URI for the attribute |

```php
use Kcs\Serializer\Annotation\Xml;
use Kcs\Serializer\Attribute\Xml;

class User
{
Expand All @@ -493,7 +493,7 @@ This is similar to the Xml\KeyValuePairs, but instead of creating child elements
No arguments.

```php
use Kcs\Serializer\Annotation\Xml;
use Kcs\Serializer\Attribute\Xml;

class Input
{
Expand Down Expand Up @@ -523,7 +523,7 @@ Arguments:
| namespace | string | no | The (optional) namespace URI for the attribute |

```php
use Kcs\Serializer\Annotation\Xml;
use Kcs\Serializer\Attribute\Xml;

#[Xml\XmlNamespace(uri: 'http://www.w3.org/2005/Atom', prefix: 'atom')]
class User
Expand Down Expand Up @@ -560,7 +560,7 @@ Arguments:
| encoding | string | no | The XML document encoding |

```php
use Kcs\Serializer\Annotation\Xml;
use Kcs\Serializer\Attribute\Xml;

#[Xml\Root("user")]
class User
Expand Down Expand Up @@ -595,7 +595,7 @@ Arguments:
| cdata | bool | no | If the element should be wrapped in CDATA tag |

```php
use Kcs\Serializer\Annotation\Xml;
use Kcs\Serializer\Attribute\Xml;

#[Xml\Root('price')]
class Price
Expand Down Expand Up @@ -629,7 +629,7 @@ Arguments:
| namespace | string | no | The (optional) namespace URI for the elements |

```php
use Kcs\Serializer\Annotation\Xml;
use Kcs\Serializer\Attribute\Xml;

#[Xml\Root('post')]
class Post
Expand Down Expand Up @@ -696,10 +696,10 @@ Arguments:
| prefix | string | no | The prefix to be applied to elements/attributes with the same namespace |

```php
use Kcs\Serializer\Annotation\Groups;
use Kcs\Serializer\Annotation\SerializedName;
use Kcs\Serializer\Annotation\Type;
use Kcs\Serializer\Annotation\Xml;
use Kcs\Serializer\Attribute\Groups;
use Kcs\Serializer\Attribute\SerializedName;
use Kcs\Serializer\Attribute\Type;
use Kcs\Serializer\Attribute\Xml;

#[Xml\XmlNamespace(uri: 'http://example.com/namespace')]
#[Xml\XmlNamespace(uri: 'http://www.w3.org/2005/Atom', prefix: 'atom')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;
use Kcs\Serializer\Metadata\Access\Type as MetadataAccessType;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Accessor.php → src/Attribute/Accessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;
use Kcs\Serializer\Metadata\Access\Order;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Csv.php → src/Attribute/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Exclude.php → src/Attribute/Exclude.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;
use Kcs\Serializer\Metadata\Exclusion;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Expose.php → src/Attribute/Expose.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Groups.php → src/Attribute/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Inline.php → src/Attribute/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/MaxDepth.php → src/Attribute/MaxDepth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;
use Kcs\Serializer\Metadata\Exclusion\Behavior;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Since.php → src/Attribute/Since.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Type.php → src/Attribute/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Until.php → src/Attribute/Until.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Version.php → src/Attribute/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

abstract class Version
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Kcs\Serializer\Annotation;
namespace Kcs\Serializer\Attribute;

use Attribute;

Expand Down

0 comments on commit aaaa87d

Please sign in to comment.