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

Skip to content

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

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 3 commits 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 @@ -79,7 +79,7 @@
"egulias/email-validator": "~1.2"
},
"autoload": {
"psr-0": { "Symfony\\": "src/" },
"psr-4": { "Symfony\\": "src/Symfony/" },
"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 @@ -24,11 +24,8 @@
"symfony/config": "2.3"
},
"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 @@ -48,9 +48,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/DebugBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
"symfony/dependency-injection": "For using as a service from the container"
},
"autoload": {
"psr-0": { "Symfony\\Bundle\\DebugBundle\\": "" }
"psr-4": { "Symfony\\Bundle\\DebugBundle\\": "" }
},
"target-dir": "Symfony/Bundle/DebugBundle",
"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 @@ -52,9 +52,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 @@ -33,9 +33,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 @@ -31,9 +31,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 @@ -28,9 +28,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.7-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
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,16 @@ private function getClassCandidates($class)
}
}
}
if ($function[0] instanceof ComposerClassLoader) {
foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
Copy link
Member

Choose a reason for hiding this comment

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

getPrefixesPsr4 only exists in the Composer ClassLoader, not in the Symfony one

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right I missed the second part of the if above, will fix :)

foreach ($paths as $path) {
$classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
}
}
}
}

return $classes;
return array_unique($classes);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,30 @@

use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
use Symfony\Component\Debug\DebugClassLoader;
use Composer\Autoload\ClassLoader as ComposerClassLoader;

class ClassNotFoundFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
{
public static function setUpBeforeClass()
{
foreach (spl_autoload_functions() as $function) {
if (!is_array($function)) {
continue;
}

// get class loaders wrapped by DebugClassLoader
if ($function[0] instanceof DebugClassLoader) {
$function = $function[0]->getClassLoader();
}

if ($function[0] instanceof ComposerClassLoader) {
$function[0]->add('Symfony\Component\Debug\Tests\Fixtures', dirname(dirname(dirname(dirname(dirname(__DIR__))))));
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity : Why so many dirnames, instead of ../s ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just to give it an absolute path directly, but yeah maybe this isn't so
nice at this point :)

Copy link
Contributor

Choose a reason for hiding this comment

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

You could use realpath(__DIR__ . "/../../../../../").

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I could but is there really a difference? Either way is fairly unreadable junk that forces you to count dir levels.

Choose a reason for hiding this comment

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

is not more readable using the standard unix '../' instead of dirname? Just asking.

break;
}
}
}

/**
* @dataProvider provideClassNotFoundData
*/
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 @@ -30,9 +30,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 @@ -47,9 +47,8 @@
"symfony/var-dumper": ""
},
"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 @@ -33,11 +33,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
Loading