Skip to content

Commit

Permalink
Introduction to PHP Attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Jun 18, 2024
1 parent d2228b6 commit 43421e9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/en/reference/basic-mapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@ document mapping metadata:
Introduction to Attributes
--------------------------

@TODO intoduce PHP attributes
`PHP attributes <https://www.php.net/manual/en/language.attributes.overview.php>`_
are a PHP 8+ feature that provides a native way to add metadata to classes,
methods, properties, and other language constructs. They replace doctrine
annotations by offering a standardized approach to metadata, eliminating
the need for the separate parsing library required by annotations.

In this documentation we follow the `PER Coding Style <https://www.php-fig.org/per/coding-style/#12-attributes>`_
for attributes. We use named arguments for attributes as they argument names
or attribute classes constructors are covered by Doctrine Backward-Compatibility promise.

.. note::

Doctrine Annotations are deprecated. You can migrate to PHP Attributes
automatically `using Rector <https://getrector.com/blog/how-to-upgrade-annotations-to-attributes>`_.

Persistent classes
------------------
Expand Down

0 comments on commit 43421e9

Please sign in to comment.