Skip to content

Commit da84c4f

Browse files
authored
Multiple PHP class per file not allowed
Since `AnnotationFileLoader` from `Routing` component parses and loads only one class per file while ignoring others class if declared in the same file, it is good to let know people about this behaviour to not be surprised.
1 parent 6488694 commit da84c4f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

routing.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ following configuration file:
4646
This configuration tells Symfony to look for routes defined as annotations in
4747
any PHP class stored in the ``src/Controller/`` directory.
4848

49+
.. caution::
50+
51+
If you define multiple PHP class per file, only the first declared class can be loaded, try to define one PHP class per file instead, visit `PSR-4 <https://www.php-fig.org/psr/psr-4/>`_ for more details.
52+
4953
Suppose you want to define a route for the ``/blog`` URL in your application. To
5054
do so, create a :doc:`controller class </controller>` like the following::
5155

0 commit comments

Comments
 (0)