Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use PSR-4 everywhere instead of PSR-0 #11190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"egulias/email-validator": "1.1.0"
},
"autoload": {
"psr-0": { "Symfony\\": "src/" },
"psr-4": { "Symfony\\": "src/Symfony/" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the root composer.json should change to PSR-4. It is valid for the components' and bundles', because it replaces the deprecated composer's target-dir option, but on the root, as there is no such option enabled...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the disadvantage of using PSR-4? I don't thnk we are going to create PEAR-like classes in symfony, do you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, both of these standards are valid IMO (even though I also prefer the PSR-4). And your change is valid.

But here, on the root, we have a PSR-0 structure (the src is in the src directory, which have a Symfony subdir, which have a Component, Bridge and Bundlesubdirectory, ... etc), when in the bundles / components, we have a PSR-4 structure (the sources are on the same level as the composer.json).

I'm just not sure if there is a gain of performances (it depends if the psr-4 stuff is loaded before or after the psr-0 stuff)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11189 (comment)
"the PSR-4 rules are applied before the PSR-0 ones"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that the advantage only appears in dev though. In prod, you should dump an optimized autoloader with composer, which will then never reach the PSR-4 or the PSR-0 logic normally but only the classmap

"classmap": [
"src/Symfony/Component/HttpFoundation/Resources/stubs",
"src/Symfony/Component/Intl/Resources/stubs"
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bridge/Doctrine/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
"doctrine/orm": ""
},
"autoload": {
"psr-0": { "Symfony\\Bridge\\Doctrine\\": "" }
"psr-4": { "Symfony\\Bridge\\Doctrine\\": "" }
},
"target-dir": "Symfony/Bridge/Doctrine",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bridge/Monolog/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
"symfony/event-dispatcher": "Needed when using log messages in console commands"
},
"autoload": {
"psr-0": { "Symfony\\Bridge\\Monolog\\": "" }
"psr-4": { "Symfony\\Bridge\\Monolog\\": "" }
},
"target-dir": "Symfony/Bridge/Monolog",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bridge/Propel1/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
"symfony/stopwatch": "~2.2"
},
"autoload": {
"psr-0": { "Symfony\\Bridge\\Propel1\\": "" }
"psr-4": { "Symfony\\Bridge\\Propel1\\": "" }
},
"target-dir": "Symfony/Bridge/Propel1",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
5 changes: 1 addition & 4 deletions src/Symfony/Bridge/ProxyManager/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@
"ocramius/proxy-manager": ">=0.3.1,<0.6-dev"
},
"autoload": {
"psr-0": {
"Symfony\\Bridge\\ProxyManager\\": ""
}
"psr-4": { "Symfony\\Bridge\\ProxyManager\\": "" }
},
"target-dir": "Symfony/Bridge/ProxyManager",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bridge/Swiftmailer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
"symfony/http-kernel": ""
},
"autoload": {
"psr-0": { "Symfony\\Bridge\\Swiftmailer\\": "" }
"psr-4": { "Symfony\\Bridge\\Swiftmailer\\": "" }
},
"target-dir": "Symfony/Bridge/Swiftmailer",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bridge/Twig/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
"symfony/expression-language": "For using the ExpressionExtension"
},
"autoload": {
"psr-0": { "Symfony\\Bridge\\Twig\\": "" }
"psr-4": { "Symfony\\Bridge\\Twig\\": "" }
},
"target-dir": "Symfony/Bridge/Twig",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bundle/FrameworkBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
"doctrine/cache": "For using alternative cache drivers"
},
"autoload": {
"psr-0": { "Symfony\\Bundle\\FrameworkBundle\\": "" }
"psr-4": { "Symfony\\Bundle\\FrameworkBundle\\": "" }
},
"target-dir": "Symfony/Bundle/FrameworkBundle",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bundle/SecurityBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
"doctrine/doctrine-bundle": "~1.2"
},
"autoload": {
"psr-0": { "Symfony\\Bundle\\SecurityBundle\\": "" }
"psr-4": { "Symfony\\Bundle\\SecurityBundle\\": "" }
},
"target-dir": "Symfony/Bundle/SecurityBundle",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bundle/TwigBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
"symfony/framework-bundle": "~2.1"
},
"autoload": {
"psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" }
"psr-4": { "Symfony\\Bundle\\TwigBundle\\": "" }
},
"target-dir": "Symfony/Bundle/TwigBundle",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bundle/WebProfilerBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
"symfony/stopwatch": "~2.2"
},
"autoload": {
"psr-0": { "Symfony\\Bundle\\WebProfilerBundle\\": "" }
"psr-4": { "Symfony\\Bundle\\WebProfilerBundle\\": "" }
},
"target-dir": "Symfony/Bundle/WebProfilerBundle",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/BrowserKit/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
"symfony/process": ""
},
"autoload": {
"psr-0": { "Symfony\\Component\\BrowserKit\\": "" }
"psr-4": { "Symfony\\Component\\BrowserKit\\": "" }
},
"target-dir": "Symfony/Component/BrowserKit",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/ClassLoader/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
"symfony/finder": "~2.0"
},
"autoload": {
"psr-0": { "Symfony\\Component\\ClassLoader\\": "" }
"psr-4": { "Symfony\\Component\\ClassLoader\\": "" }
},
"target-dir": "Symfony/Component/ClassLoader",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Config/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
"symfony/filesystem": "~2.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Config\\": "" }
"psr-4": { "Symfony\\Component\\Config\\": "" }
},
"target-dir": "Symfony/Component/Config",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Console/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
"psr/log": "For using the console logger"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Console\\": "" }
"psr-4": { "Symfony\\Component\\Console\\": "" }
},
"target-dir": "Symfony/Component/Console",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/CssSelector/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
"php": ">=5.3.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\CssSelector\\": "" }
"psr-4": { "Symfony\\Component\\CssSelector\\": "" }
},
"target-dir": "Symfony/Component/CssSelector",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Debug/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
"symfony/http-kernel": ""
},
"autoload": {
"psr-0": { "Symfony\\Component\\Debug\\": "" }
"psr-4": { "Symfony\\Component\\Debug\\": "" }
},
"target-dir": "Symfony/Component/Debug",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/DependencyInjection/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them"
},
"autoload": {
"psr-0": { "Symfony\\Component\\DependencyInjection\\": "" }
"psr-4": { "Symfony\\Component\\DependencyInjection\\": "" }
},
"target-dir": "Symfony/Component/DependencyInjection",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/DomCrawler/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
"symfony/css-selector": ""
},
"autoload": {
"psr-0": { "Symfony\\Component\\DomCrawler\\": "" }
"psr-4": { "Symfony\\Component\\DomCrawler\\": "" }
},
"target-dir": "Symfony/Component/DomCrawler",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/EventDispatcher/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
"symfony/http-kernel": ""
},
"autoload": {
"psr-0": { "Symfony\\Component\\EventDispatcher\\": "" }
"psr-4": { "Symfony\\Component\\EventDispatcher\\": "" }
},
"target-dir": "Symfony/Component/EventDispatcher",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/ExpressionLanguage/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
"php": ">=5.3.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\ExpressionLanguage\\": "" }
"psr-4": { "Symfony\\Component\\ExpressionLanguage\\": "" }
},
"target-dir": "Symfony/Component/ExpressionLanguage",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Filesystem/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
"php": ">=5.3.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Filesystem\\": "" }
"psr-4": { "Symfony\\Component\\Filesystem\\": "" }
},
"target-dir": "Symfony/Component/Filesystem",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Finder/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
"php": ">=5.3.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Finder\\": "" }
"psr-4": { "Symfony\\Component\\Finder\\": "" }
},
"target-dir": "Symfony/Component/Finder",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Form/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
"symfony/framework-bundle": "For templating with PHP."
},
"autoload": {
"psr-0": { "Symfony\\Component\\Form\\": "" }
"psr-4": { "Symfony\\Component\\Form\\": "" }
},
"target-dir": "Symfony/Component/Form",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/HttpFoundation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
"symfony/expression-language": "~2.4"
},
"autoload": {
"psr-0": { "Symfony\\Component\\HttpFoundation\\": "" },
"psr-4": { "Symfony\\Component\\HttpFoundation\\": "" },
"classmap": [ "Symfony/Component/HttpFoundation/Resources/stubs" ]
},
"target-dir": "Symfony/Component/HttpFoundation",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/HttpKernel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@
"symfony/finder": ""
},
"autoload": {
"psr-0": { "Symfony\\Component\\HttpKernel\\": "" }
"psr-4": { "Symfony\\Component\\HttpKernel\\": "" }
},
"target-dir": "Symfony/Component/HttpKernel",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Intl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@
"ext-intl": "to use the component with locales other than \"en\""
},
"autoload": {
"psr-0": { "Symfony\\Component\\Intl\\": "" },
"psr-4": { "Symfony\\Component\\Intl\\": "" },
"classmap": [ "Symfony/Component/Intl/Resources/stubs" ],
"files": [ "Symfony/Component/Intl/Resources/stubs/functions.php" ]
},
"target-dir": "Symfony/Component/Intl",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Locale/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
"symfony/intl": ">=2.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Locale\\": "" }
"psr-4": { "Symfony\\Component\\Locale\\": "" }
},
"target-dir": "Symfony/Component/Locale",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/OptionsResolver/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
"php": ">=5.3.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\OptionsResolver\\": "" }
"psr-4": { "Symfony\\Component\\OptionsResolver\\": "" }
},
"target-dir": "Symfony/Component/OptionsResolver",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Process/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
"php": ">=5.3.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Process\\": "" }
"psr-4": { "Symfony\\Component\\Process\\": "" }
},
"target-dir": "Symfony/Component/Process",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/PropertyAccess/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
"php": ">=5.3.3"
},
"autoload": {
"psr-0": { "Symfony\\Component\\PropertyAccess\\": "" }
"psr-4": { "Symfony\\Component\\PropertyAccess\\": "" }
},
"target-dir": "Symfony/Component/PropertyAccess",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Routing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
"doctrine/annotations": "For using the annotation loader"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Routing\\": "" }
"psr-4": { "Symfony\\Component\\Routing\\": "" }
},
"target-dir": "Symfony/Component/Routing",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Security/Acl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
"doctrine/dbal": "For using the built-in ACL implementation"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\Acl\\": "" }
"psr-4": { "Symfony\\Component\\Security\\Acl\\": "" }
},
"target-dir": "Symfony/Component/Security/Acl",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Security/Core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
"ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\Core\\": "" }
"psr-4": { "Symfony\\Component\\Security\\Core\\": "" }
},
"target-dir": "Symfony/Component/Security/Core",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Security/Csrf/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
"symfony/http-foundation": "For using the class SessionTokenStorage."
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\Csrf\\": "" }
"psr-4": { "Symfony\\Component\\Security\\Csrf\\": "" }
},
"target-dir": "Symfony/Component/Security/Csrf",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Security/Http/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
"symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\Http\\": "" }
"psr-4": { "Symfony\\Component\\Security\\Http\\": "" }
},
"target-dir": "Symfony/Component/Security/Http",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
Expand Down
Loading