1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | namespace PHPStan\BetterReflection\SourceLocator\Type; |
6: | |
7: | use InvalidArgumentException; |
8: | use PHPStan\BetterReflection\Identifier\Identifier; |
9: | use PHPStan\BetterReflection\SourceLocator\Ast\Locator; |
10: | use PHPStan\BetterReflection\SourceLocator\Exception\InvalidFileLocation; |
11: | use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource; |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: | class StringSourceLocator extends AbstractSourceLocator |
21: | { |
22: | |
23: | |
24: | |
25: | private $source; |
26: | |
27: | public function __construct(string $source, Locator $astLocator) |
28: | { |
29: | $this->source = $source; |
30: | parent::__construct($astLocator); |
31: | } |
32: | |
33: | |
34: | |
35: | |
36: | |
37: | |
38: | |
39: | protected function createLocatedSource(Identifier $identifier): ?\PHPStan\BetterReflection\SourceLocator\Located\LocatedSource |
40: | { |
41: | return new LocatedSource($this->source, $identifier->getName(), null); |
42: | } |
43: | } |
44: | |