-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a00eb3f
commit 2bf30bf
Showing
19 changed files
with
596 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/DependencyInjection/Type/DynamicThrowTypeExtensionProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\DependencyInjection\Type; | ||
|
||
use PHPStan\Type\DynamicFunctionThrowTypeExtension; | ||
use PHPStan\Type\DynamicMethodThrowTypeExtension; | ||
use PHPStan\Type\DynamicStaticMethodThrowTypeExtension; | ||
|
||
interface DynamicThrowTypeExtensionProvider | ||
{ | ||
|
||
/** @return DynamicFunctionThrowTypeExtension[] */ | ||
public function getDynamicFunctionThrowTypeExtensions(): array; | ||
|
||
/** @return DynamicMethodThrowTypeExtension[] */ | ||
public function getDynamicMethodThrowTypeExtensions(): array; | ||
|
||
/** @return DynamicStaticMethodThrowTypeExtension[] */ | ||
public function getDynamicStaticMethodThrowTypeExtensions(): array; | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\DependencyInjection\Type; | ||
|
||
use PHPStan\DependencyInjection\Container; | ||
|
||
class LazyDynamicThrowTypeExtensionProvider implements DynamicThrowTypeExtensionProvider | ||
{ | ||
|
||
public const FUNCTION_TAG = 'phpstan.dynamicFunctionThrowTypeExtension'; | ||
public const METHOD_TAG = 'phpstan.dynamicMethodThrowTypeExtension'; | ||
public const STATIC_METHOD_TAG = 'phpstan.dynamicStaticMethodThrowTypeExtension'; | ||
|
||
private Container $container; | ||
|
||
public function __construct(Container $container) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
public function getDynamicFunctionThrowTypeExtensions(): array | ||
{ | ||
return $this->container->getServicesByTag(self::FUNCTION_TAG); | ||
} | ||
|
||
public function getDynamicMethodThrowTypeExtensions(): array | ||
{ | ||
return $this->container->getServicesByTag(self::METHOD_TAG); | ||
} | ||
|
||
public function getDynamicStaticMethodThrowTypeExtensions(): array | ||
{ | ||
return $this->container->getServicesByTag(self::STATIC_METHOD_TAG); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Type; | ||
|
||
use PhpParser\Node\Expr\FuncCall; | ||
use PHPStan\Analyser\Scope; | ||
use PHPStan\Reflection\FunctionReflection; | ||
|
||
interface DynamicFunctionThrowTypeExtension | ||
{ | ||
|
||
public function isFunctionSupported(FunctionReflection $functionReflection): bool; | ||
|
||
public function getThrowTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $funcCall, Scope $scope): ?Type; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Type; | ||
|
||
use PhpParser\Node\Expr\MethodCall; | ||
use PHPStan\Analyser\Scope; | ||
use PHPStan\Reflection\MethodReflection; | ||
|
||
interface DynamicMethodThrowTypeExtension | ||
{ | ||
|
||
public function isMethodSupported(MethodReflection $methodReflection): bool; | ||
|
||
public function getThrowTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Type; | ||
|
||
use PhpParser\Node\Expr\StaticCall; | ||
use PHPStan\Analyser\Scope; | ||
use PHPStan\Reflection\MethodReflection; | ||
|
||
interface DynamicStaticMethodThrowTypeExtension | ||
{ | ||
|
||
public function isStaticMethodSupported(MethodReflection $methodReflection): bool; | ||
|
||
public function getThrowTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, Scope $scope): ?Type; | ||
|
||
} |
Oops, something went wrong.