Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b735e0a

Browse filesBrowse files
Neirda24nicolas-grekas
authored andcommitted
[DependencyInjection] Add missing template notation on ServiceLocator
1 parent 1f7bc10 commit b735e0a
Copy full SHA for b735e0a

File tree

Expand file treeCollapse file tree

3 files changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-3
lines changed

‎src/Symfony/Component/DependencyInjection/ServiceLocator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/ServiceLocator.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
/**
2424
* @author Robin Chalas <robin.chalas@gmail.com>
2525
* @author Nicolas Grekas <p@tchwork.com>
26+
*
27+
* @template-covariant T of mixed
28+
* @implements ServiceProviderInterface<T>
2629
*/
2730
class ServiceLocator implements ServiceProviderInterface, \Countable
2831
{

‎src/Symfony/Component/ErrorHandler/DebugClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/DebugClassLoader.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
384384

385385
// Detect annotations on the class
386386
if ($doc = $this->parsePhpDoc($refl)) {
387-
$classIsTemplate = isset($doc['template']);
387+
$classIsTemplate = isset($doc['template']) || isset($doc['template-covariant']);
388388

389389
foreach (['final', 'deprecated', 'internal'] as $annotation) {
390390
if (null !== $description = $doc[$annotation][0] ?? null) {
@@ -531,7 +531,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
531531
// To read method annotations
532532
$doc = $this->parsePhpDoc($method);
533533

534-
if (($classIsTemplate || isset($doc['template'])) && $method->hasReturnType()) {
534+
if (($classIsTemplate || isset($doc['template']) || isset($doc['template-covariant'])) && $method->hasReturnType()) {
535535
unset($doc['return']);
536536
}
537537

‎src/Symfony/Contracts/Service/ServiceProviderInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Contracts/Service/ServiceProviderInterface.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @author Nicolas Grekas <p@tchwork.com>
2020
* @author Mateusz Sip <mateusz.sip@gmail.com>
2121
*
22-
* @template T of mixed
22+
* @template-covariant T of mixed
2323
*/
2424
interface ServiceProviderInterface extends ContainerInterface
2525
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.