Skip to content

Commit f0b0134

Browse files
committed
minor #14330 Multiple PHP class per file not allowed (ybenhssaien)
This PR was submitted for the 5.1 branch but it was merged into the 4.4 branch instead. Discussion ---------- 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. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 2fbe60d Multiple PHP class per file not allowed
2 parents 725ba41 + 2fbe60d commit f0b0134

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)