Skip to content

Commit 8b4d698

Browse files
committed
Replace classResolver extension for generics
1 parent 91491a0 commit 8b4d698

File tree

6 files changed

+26
-138
lines changed

6 files changed

+26
-138
lines changed

extension.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@ services:
264264
-
265265
class: mglaman\PHPStanDrupal\Type\ContainerDynamicReturnTypeExtension
266266
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
267-
-
268-
class: mglaman\PHPStanDrupal\Type\DrupalClassResolverDynamicReturnTypeExtension
269-
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
270267
-
271268
class: mglaman\PHPStanDrupal\Type\EntityQuery\EntityQueryDynamicReturnTypeExtension
272269
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
@@ -279,9 +276,6 @@ services:
279276
-
280277
class: mglaman\PHPStanDrupal\Type\EntityAccessControlHandlerReturnTypeExtension
281278
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
282-
-
283-
class: mglaman\PHPStanDrupal\Type\DrupalClassResolverDynamicStaticReturnTypeExtension
284-
tags: [phpstan.broker.dynamicStaticMethodReturnTypeExtension]
285279
-
286280
class: mglaman\PHPStanDrupal\Type\DrupalServiceDynamicReturnTypeExtension
287281
tags: [phpstan.broker.dynamicStaticMethodReturnTypeExtension]

src/Type/DrupalClassResolverDynamicReturnTypeExtension.php

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

src/Type/DrupalClassResolverDynamicStaticReturnTypeExtension.php

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

src/Type/DrupalClassResolverReturnType.php

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Drupal\Core\DependencyInjection;
4+
5+
interface ClassResolverInterface {
6+
7+
/**
8+
* @template T of object
9+
* @param class-string<T> $definition
10+
* @return T
11+
*/
12+
public function getInstanceFromDefinition(string $definition): object;
13+
}

stubs/Drupal/Drupal.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
class Drupal {
4+
5+
/**
6+
* @template T of object
7+
* @param ?class-string<T> $class
8+
* @return ($class is null ? \Drupal\Core\DependencyInjection\ClassResolverInterface : T)
9+
*/
10+
public static function classResolver(?string $class = NULL) {
11+
12+
}
13+
}

0 commit comments

Comments
 (0)