First Commit

This commit is contained in:
Esteban
2026-07-03 16:27:34 +02:00
commit 7a7440daab
8955 changed files with 1117958 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Bundle;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Kernel\AbstractBundle as BaseAbstractBundle;
/**
* A Bundle that provides configuration hooks.
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
abstract class AbstractBundle extends Bundle
{
public function getContainerExtension(): ?ExtensionInterface
{
return BaseAbstractBundle::getContainerExtension();
}
public function getPath(): string
{
return BaseAbstractBundle::getPath();
}
}
+95
View File
@@ -0,0 +1,95 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Bundle;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Kernel\AbstractBundle as BaseAbstractBundle;
/**
* An implementation of BundleInterface that adds a few conventions for DependencyInjection extensions.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class Bundle extends BaseAbstractBundle implements BundleInterface
{
private string $namespace;
/**
* Returns the bundle's container extension.
*
* @throws \LogicException
*/
public function getContainerExtension(): ?ExtensionInterface
{
if (!isset($this->extension)) {
$extension = $this->createContainerExtension();
if (null !== $extension) {
if (!$extension instanceof ExtensionInterface) {
throw new \LogicException(\sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_debug_type($extension)));
}
// check naming convention
$basename = preg_replace('/Bundle$/', '', $this->getName());
$expectedAlias = Container::underscore($basename);
if ($expectedAlias != $extension->getAlias()) {
throw new \LogicException(\sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias()));
}
$this->extension = $extension;
} else {
$this->extension = false;
}
}
return $this->extension ?: null;
}
public function getNamespace(): string
{
return $this->namespace ??= false === ($pos = strrpos(static::class, '\\')) ? '' : substr(static::class, 0, $pos);
}
public function getPath(): string
{
return $this->path ??= \dirname((new \ReflectionClass($this))->getFileName());
}
/**
* @deprecated since Symfony 8.1, use the #[AsCommand] attribute or the "console.command" service tag instead of overriding this method
*/
public function registerCommands(Application $application): void
{
trigger_deprecation('symfony/http-kernel', '8.1', 'The "%s::registerCommands()" method is deprecated, use the #[AsCommand] attribute or the "console.command" service tag instead of overriding this method', self::class);
}
/**
* Returns the bundle's container extension class.
*/
protected function getContainerExtensionClass(): string
{
$basename = preg_replace('/Bundle$/', '', $this->getName());
return $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension';
}
/**
* Creates the bundle's container extension.
*/
protected function createContainerExtension(): ?ExtensionInterface
{
return class_exists($class = $this->getContainerExtensionClass()) ? new $class() : null;
}
}
+70
View File
@@ -0,0 +1,70 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Kernel\BundleInterface as BaseBundleInterface;
/**
* @internal
*/
final class BundleAdapter implements BundleInterface
{
private string $namespace;
public function __construct(
private readonly BaseBundleInterface $bundle,
) {
}
public function boot(): void
{
$this->bundle->boot();
}
public function shutdown(): void
{
$this->bundle->shutdown();
}
public function build(ContainerBuilder $container): void
{
$this->bundle->build($container);
}
public function getContainerExtension(): ?ExtensionInterface
{
return $this->bundle->getContainerExtension();
}
public function getName(): string
{
return $this->bundle->getName();
}
public function getNamespace(): string
{
return $this->namespace ??= false === ($pos = strrpos($this->bundle::class, '\\')) ? '' : substr($this->bundle::class, 0, $pos);
}
public function getPath(): string
{
return $this->bundle->getPath();
}
public function setContainer(?ContainerInterface $container): void
{
$this->bundle->setContainer($container);
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Bundle;
use Symfony\Component\DependencyInjection\Kernel\BundleInterface as BaseBundleInterface;
/**
* @deprecated since Symfony 8.1, use Symfony\Component\DependencyInjection\Kernel\BundleInterface instead
*/
interface BundleInterface extends BaseBundleInterface
{
public function getNamespace(): string;
}