Skip to content

Commit d25247b

Browse files
[HttpKernel] remove deprecated features
1 parent 83de78c commit d25247b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+73
-454
lines changed

src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function has(string $id): bool
106106
/**
107107
* {@inheritdoc}
108108
*/
109-
public function get(string $id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1): ?object
109+
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object
110110
{
111111
return $this->getPrivateContainer()->has($id) ? $this->getPrivateContainer()->get($id) : $this->getPublicContainer()->get($id, $invalidBehavior);
112112
}

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ private function make(string $id, int $invalidBehavior)
240240
unset($this->loading[$id]);
241241
}
242242

243-
if (/* self::EXCEPTION_ON_INVALID_REFERENCE */ 1 === $invalidBehavior) {
243+
if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) {
244244
if (!$id) {
245245
throw new ServiceNotFoundException($id);
246246
}

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,7 @@ private function getServiceCall(string $id, Reference $reference = null): string
19401940
return 'null';
19411941
}
19421942
if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $reference->getInvalidBehavior()) {
1943-
$code = sprintf('$this->get(%s, /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d)', $this->doExport($id), ContainerInterface::NULL_ON_INVALID_REFERENCE);
1943+
$code = sprintf('$this->get(%s, ContainerInterface::NULL_ON_INVALID_REFERENCE)', $this->doExport($id));
19441944
} else {
19451945
$code = sprintf('$this->get(%s)', $this->doExport($id));
19461946
}

src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@
219219
<xsd:complexType name="deprecated">
220220
<xsd:simpleContent>
221221
<xsd:extension base="xsd:string">
222-
<!-- In Symfony 6, make these attributes required -->
223-
<xsd:attribute name="package" type="xsd:string" />
224-
<xsd:attribute name="version" type="xsd:string" />
222+
<xsd:attribute name="package" type="xsd:string" use="required" />
223+
<xsd:attribute name="version" type="xsd:string" use="required" />
225224
</xsd:extension>
226225
</xsd:simpleContent>
227226
</xsd:complexType>

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/deprecated_alias_definitions_without_package_and_version.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,6 @@ public function testDeprecatedAliases()
466466
$this->assertSame($message, $container->getAlias('alias_for_foobar')->getDeprecation('alias_for_foobar')['message']);
467467
}
468468

469-
public function testDeprecatedAliaseWithoutPackageAndVersion()
470-
{
471-
$container = new ContainerBuilder();
472-
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
473-
474-
$this->expectException(InvalidArgumentException::class);
475-
$this->expectExceptionMessageMatches('/^Missing attribute "package" at node "deprecated" in "[^"]*".$/');
476-
$loader->load('deprecated_alias_definitions_without_package_and_version.xml');
477-
}
478-
479469
public function testConvertDomElementToArray()
480470
{
481471
$doc = new \DOMDocument('1.0');

src/Symfony/Component/HttpKernel/Attribute/ArgumentInterface.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove `ArgumentInterface`
8+
* Remove `ArgumentMetadata::getAttribute()`, use `getAttributes()` instead
9+
* Remove support for returning a `ContainerBuilder` from `KernelInterface::registerContainerConfiguration()`
10+
* Remove `KernelEvent::isMasterRequest()`, use `isMainRequest()` instead
11+
* Remove support for `service:action` syntax to reference controllers, use `serviceOrFqcn::method` instead
12+
413
5.4
514
---
615

src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ public function __construct(ContainerInterface $container, LoggerInterface $logg
3434

3535
protected function createController(string $controller)
3636
{
37-
if (1 === substr_count($controller, ':')) {
38-
$controller = str_replace(':', '::', $controller);
39-
trigger_deprecation('symfony/http-kernel', '5.1', 'Referencing controllers with a single colon is deprecated. Use "%s" instead.', $controller);
40-
}
41-
4237
return parent::createController($controller);
4338
}
4439

src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,8 @@ public function getController(Request $request)
4848
try {
4949
$controller[0] = $this->instantiateController($controller[0]);
5050
} catch (\Error | \LogicException $e) {
51-
try {
52-
// We cannot just check is_callable but have to use reflection because a non-static method
53-
// can still be called statically in PHP but we don't want that. This is deprecated in PHP 7, so we
54-
// could simplify this with PHP 8.
55-
if ((new \ReflectionMethod($controller[0], $controller[1]))->isStatic()) {
56-
return $controller;
57-
}
58-
} catch (\ReflectionException $reflectionException) {
59-
throw $e;
51+
if (\is_callable($controller)) {
52+
return $controller;
6053
}
6154

6255
throw $e;

0 commit comments

Comments
 (0)