Skip to content

Commit 45878bd

Browse files
committed
Minor tweaks
1 parent 855f82d commit 45878bd

File tree

4 files changed

+27
-46
lines changed

4 files changed

+27
-46
lines changed

src/Symfony/Component/Config/Definition/Configurator/DefinitionConfigurator.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@
2121
*/
2222
class DefinitionConfigurator
2323
{
24-
private TreeBuilder $treeBuilder;
25-
private DefinitionFileLoader $loader;
26-
private string $path;
27-
private string $file;
28-
29-
public function __construct(TreeBuilder $treeBuilder, DefinitionFileLoader $loader, string $path, string $file)
30-
{
31-
$this->treeBuilder = $treeBuilder;
32-
$this->loader = $loader;
33-
$this->path = $path;
34-
$this->file = $file;
24+
public function __construct(
25+
private TreeBuilder $treeBuilder,
26+
private DefinitionFileLoader $loader,
27+
private string $path,
28+
private string $file
29+
) {
3530
}
3631

3732
final public function import(string $resource, string $type = null, bool $ignoreErrors = false): void

src/Symfony/Component/Config/Definition/Loader/DefinitionFileLoader.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919

2020
/**
21+
* DefinitionFileLoader loads config definitions from a PHP file.
22+
*
23+
* The PHP file is required.
24+
*
2125
* @author Yonel Ceruto <yonelceruto@gmail.com>
2226
*/
2327
class DefinitionFileLoader extends FileLoader
2428
{
25-
private TreeBuilder $treeBuilder;
26-
private ?ContainerBuilder $container;
27-
28-
public function __construct(TreeBuilder $treeBuilder, FileLocatorInterface $locator, ContainerBuilder $container = null)
29-
{
30-
$this->treeBuilder = $treeBuilder;
31-
$this->container = $container;
32-
29+
public function __construct(
30+
private TreeBuilder $treeBuilder,
31+
FileLocatorInterface $locator,
32+
private ?ContainerBuilder $container = null,
33+
) {
3334
parent::__construct($locator);
3435
}
3536

@@ -38,7 +39,7 @@ public function __construct(TreeBuilder $treeBuilder, FileLocatorInterface $loca
3839
*/
3940
public function load(mixed $resource, string $type = null): mixed
4041
{
41-
// the loader variable are exposed to the included file below
42+
// the loader variable is exposed to the included file below
4243
$loader = $this;
4344

4445
$path = $this->locator->locate($resource);
@@ -77,9 +78,7 @@ public function supports(mixed $resource, string $type = null): bool
7778

7879
private function executeCallback(callable $callback, DefinitionConfigurator $configurator, string $path): void
7980
{
80-
if (!$callback instanceof \Closure) {
81-
$callback = \Closure::fromCallable($callback);
82-
}
81+
$callback = $callback(...);
8382

8483
$arguments = [];
8584
$r = new \ReflectionFunction($callback);

src/Symfony/Component/HttpKernel/Bundle/BundleConfiguration.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@
2525
*/
2626
class BundleConfiguration implements ConfigurationInterface
2727
{
28-
private MicroBundle $bundle;
29-
private ContainerBuilder $container;
30-
private string $alias;
31-
32-
public function __construct(MicroBundle $bundle, ContainerBuilder $container, string $alias)
33-
{
34-
$this->bundle = $bundle;
35-
$this->container = $container;
36-
$this->alias = $alias;
28+
public function __construct(
29+
private MicroBundle $bundle,
30+
private ContainerBuilder $container,
31+
private string $alias
32+
) {
3733
}
3834

3935
public function getConfigTreeBuilder(): TreeBuilder

src/Symfony/Component/HttpKernel/Bundle/BundleExtension.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Config\Loader\DelegatingLoader;
1818
use Symfony\Component\Config\Loader\LoaderResolver;
1919
use Symfony\Component\DependencyInjection\ContainerBuilder;
20-
use Symfony\Component\DependencyInjection\ContainerInterface;
2120
use Symfony\Component\DependencyInjection\Extension\Extension;
2221
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
2322
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
@@ -36,13 +35,10 @@
3635
*/
3736
class BundleExtension extends Extension implements PrependExtensionInterface
3837
{
39-
private MicroBundle $bundle;
40-
private string $alias;
41-
42-
public function __construct(MicroBundle $bundle, string $alias)
43-
{
44-
$this->bundle = $bundle;
45-
$this->alias = $alias;
38+
public function __construct(
39+
private MicroBundle $bundle,
40+
private string $alias
41+
) {
4642
}
4743

4844
public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface
@@ -55,11 +51,6 @@ public function getAlias(): string
5551
return $this->alias;
5652
}
5753

58-
public function getXsdValidationBasePath(): string|false
59-
{
60-
return false;
61-
}
62-
6354
public function prepend(ContainerBuilder $container): void
6455
{
6556
$callback = function (ContainerConfigurator $configurator) use ($container) {
@@ -100,7 +91,7 @@ private function executeConfiguratorCallback(ContainerBuilder $container, \Closu
10091
}
10192
}
10293

103-
private function createContainerLoader(ContainerInterface $container, string $env): DelegatingLoader
94+
private function createContainerLoader(ContainerBuilder $container, string $env): DelegatingLoader
10495
{
10596
$buildDir = $container->getParameter('kernel.build_dir');
10697
$locator = new FileLocator();

0 commit comments

Comments
 (0)