Laravel version update
Laravel version update
This commit is contained in:
46
vendor/symfony/http-kernel/Bundle/Bundle.php
vendored
46
vendor/symfony/http-kernel/Bundle/Bundle.php
vendored
@@ -11,12 +11,12 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Bundle;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
/**
|
||||
* An implementation of BundleInterface that adds a few conventions
|
||||
@@ -31,6 +31,7 @@ abstract class Bundle implements BundleInterface
|
||||
protected $name;
|
||||
protected $extension;
|
||||
protected $path;
|
||||
private $namespace;
|
||||
|
||||
/**
|
||||
* Boots the Bundle.
|
||||
@@ -53,8 +54,6 @@ abstract class Bundle implements BundleInterface
|
||||
*
|
||||
* This method can be overridden to register compilation passes,
|
||||
* other extensions, ...
|
||||
*
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
@@ -74,7 +73,7 @@ abstract class Bundle implements BundleInterface
|
||||
|
||||
if (null !== $extension) {
|
||||
if (!$extension instanceof ExtensionInterface) {
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_class($extension)));
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension)));
|
||||
}
|
||||
|
||||
// check naming convention
|
||||
@@ -106,9 +105,11 @@ abstract class Bundle implements BundleInterface
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
$class = get_class($this);
|
||||
if (null === $this->namespace) {
|
||||
$this->parseClassName();
|
||||
}
|
||||
|
||||
return substr($class, 0, strrpos($class, '\\'));
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,7 +121,7 @@ abstract class Bundle implements BundleInterface
|
||||
{
|
||||
if (null === $this->path) {
|
||||
$reflected = new \ReflectionObject($this);
|
||||
$this->path = dirname($reflected->getFileName());
|
||||
$this->path = \dirname($reflected->getFileName());
|
||||
}
|
||||
|
||||
return $this->path;
|
||||
@@ -129,7 +130,7 @@ abstract class Bundle implements BundleInterface
|
||||
/**
|
||||
* Returns the bundle parent name.
|
||||
*
|
||||
* @return string The Bundle parent name it overrides or null if no parent
|
||||
* @return string|null The Bundle parent name it overrides or null if no parent
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
@@ -142,14 +143,11 @@ abstract class Bundle implements BundleInterface
|
||||
*/
|
||||
final public function getName()
|
||||
{
|
||||
if (null !== $this->name) {
|
||||
return $this->name;
|
||||
if (null === $this->name) {
|
||||
$this->parseClassName();
|
||||
}
|
||||
|
||||
$name = get_class($this);
|
||||
$pos = strrpos($name, '\\');
|
||||
|
||||
return $this->name = false === $pos ? $name : substr($name, $pos + 1);
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,8 +157,6 @@ abstract class Bundle implements BundleInterface
|
||||
*
|
||||
* * Commands are in the 'Command' sub-directory
|
||||
* * Commands extend Symfony\Component\Console\Command\Command
|
||||
*
|
||||
* @param Application $application An Application instance
|
||||
*/
|
||||
public function registerCommands(Application $application)
|
||||
{
|
||||
@@ -183,13 +179,16 @@ abstract class Bundle implements BundleInterface
|
||||
}
|
||||
$class = $ns.'\\'.$file->getBasename('.php');
|
||||
if ($this->container) {
|
||||
$commandIds = $this->container->hasParameter('console.command.ids') ? $this->container->getParameter('console.command.ids') : array();
|
||||
$alias = 'console.command.'.strtolower(str_replace('\\', '_', $class));
|
||||
if ($this->container->has($alias)) {
|
||||
if (isset($commandIds[$alias]) || $this->container->has($alias)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$r = new \ReflectionClass($class);
|
||||
if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
|
||||
@trigger_error(sprintf('Auto-registration of the command "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Use PSR-4 based service discovery instead.', $class), E_USER_DEPRECATED);
|
||||
|
||||
$application->add($r->newInstance());
|
||||
}
|
||||
}
|
||||
@@ -218,4 +217,13 @@ abstract class Bundle implements BundleInterface
|
||||
return new $class();
|
||||
}
|
||||
}
|
||||
|
||||
private function parseClassName()
|
||||
{
|
||||
$pos = strrpos(static::class, '\\');
|
||||
$this->namespace = false === $pos ? '' : substr(static::class, 0, $pos);
|
||||
if (null === $this->name) {
|
||||
$this->name = false === $pos ? static::class : substr(static::class, $pos + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -36,8 +36,6 @@ interface BundleInterface extends ContainerAwareInterface
|
||||
* Builds the bundle.
|
||||
*
|
||||
* It is only ever called once when the cache is empty.
|
||||
*
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
public function build(ContainerBuilder $container);
|
||||
|
||||
@@ -56,6 +54,8 @@ interface BundleInterface extends ContainerAwareInterface
|
||||
* bundle.
|
||||
*
|
||||
* @return string The Bundle name it overrides or null if no parent
|
||||
*
|
||||
* @deprecated This method is deprecated as of 3.4 and will be removed in 4.0.
|
||||
*/
|
||||
public function getParent();
|
||||
|
||||
|
Reference in New Issue
Block a user