Skip to content

Commit 36cf9a1

Browse files
committed
Change where TypeSpecifier is set into TypeSpecifierAwareExtension
1 parent fc6a2b1 commit 36cf9a1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/Analyser/LegacyTypeSpecifier.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,6 @@ public function __construct(
113113
private bool $rememberPossiblyImpureFunctionValues,
114114
)
115115
{
116-
foreach (array_merge($functionTypeSpecifyingExtensions, $methodTypeSpecifyingExtensions, $staticMethodTypeSpecifyingExtensions) as $extension) {
117-
if (!($extension instanceof TypeSpecifierAwareExtension)) {
118-
continue;
119-
}
120-
121-
$extension->setTypeSpecifier($this);
122-
}
123116
}
124117

125118
public function specifyTypesInCondition(

src/Analyser/TypeSpecifierFactory.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ public function __construct(private Container $container)
2424

2525
public function create(): TypeSpecifier
2626
{
27+
$functionTypeSpecifying = $this->container->getServicesByTag(self::FUNCTION_TYPE_SPECIFYING_EXTENSION_TAG);
28+
$methodTypeSpecifying = $this->container->getServicesByTag(self::METHOD_TYPE_SPECIFYING_EXTENSION_TAG);
29+
$staticMethodTypeSpecifying = $this->container->getServicesByTag(self::STATIC_METHOD_TYPE_SPECIFYING_EXTENSION_TAG);
2730
$typeSpecifier = new LegacyTypeSpecifier(
2831
$this->container->getByType(ExprPrinter::class),
2932
$this->container->getByType(ReflectionProvider::class),
3033
$this->container->getByType(PhpVersion::class),
31-
$this->container->getServicesByTag(self::FUNCTION_TYPE_SPECIFYING_EXTENSION_TAG),
32-
$this->container->getServicesByTag(self::METHOD_TYPE_SPECIFYING_EXTENSION_TAG),
33-
$this->container->getServicesByTag(self::STATIC_METHOD_TYPE_SPECIFYING_EXTENSION_TAG),
34+
$functionTypeSpecifying,
35+
$methodTypeSpecifying,
36+
$staticMethodTypeSpecifying,
3437
$this->container->getParameter('rememberPossiblyImpureFunctionValues'),
3538
);
3639

@@ -40,6 +43,9 @@ public function create(): TypeSpecifier
4043
$this->container->getServicesByTag(BrokerFactory::DYNAMIC_METHOD_RETURN_TYPE_EXTENSION_TAG),
4144
$this->container->getServicesByTag(BrokerFactory::DYNAMIC_STATIC_METHOD_RETURN_TYPE_EXTENSION_TAG),
4245
$this->container->getServicesByTag(BrokerFactory::DYNAMIC_FUNCTION_RETURN_TYPE_EXTENSION_TAG),
46+
$functionTypeSpecifying,
47+
$methodTypeSpecifying,
48+
$staticMethodTypeSpecifying,
4349
) as $extension) {
4450
if (!($extension instanceof TypeSpecifierAwareExtension)) {
4551
continue;

0 commit comments

Comments
 (0)