Skip to content

Commit 23b1c7f

Browse files
committed
Introduce StubPhpDocProviderFactory
1 parent 3d6a421 commit 23b1c7f

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

conf/config.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,10 @@ services:
16121612

16131613
stubPhpDocProvider:
16141614
class: PHPStan\PhpDoc\StubPhpDocProvider
1615+
factory: @PHPStan\PhpDoc\StubPhpDocProviderFactory::create()
1616+
1617+
-
1618+
class: PHPStan\PhpDoc\StubPhpDocProviderFactory
16151619
arguments:
16161620
stubFiles: %stubFiles%
16171621

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\PhpDoc;
4+
5+
use PHPStan\Parser\Parser;
6+
use PHPStan\Type\FileTypeMapper;
7+
8+
class StubPhpDocProviderFactory
9+
{
10+
11+
private \PHPStan\Parser\Parser $parser;
12+
13+
private \PHPStan\Type\FileTypeMapper $fileTypeMapper;
14+
15+
/** @var string[] */
16+
private array $stubFiles;
17+
18+
/**
19+
* @param \PHPStan\Parser\Parser $parser
20+
* @param string[] $stubFiles
21+
*/
22+
public function __construct(
23+
Parser $parser,
24+
FileTypeMapper $fileTypeMapper,
25+
array $stubFiles
26+
)
27+
{
28+
$this->parser = $parser;
29+
$this->fileTypeMapper = $fileTypeMapper;
30+
$this->stubFiles = $stubFiles;
31+
}
32+
33+
public function create(): StubPhpDocProvider
34+
{
35+
return new StubPhpDocProvider(
36+
$this->parser,
37+
$this->fileTypeMapper,
38+
$this->stubFiles
39+
);
40+
}
41+
42+
}

0 commit comments

Comments
 (0)