Skip to content

Commit

Permalink
Introduce StubPhpDocProviderFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 2, 2021
1 parent 3d6a421 commit 23b1c7f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,10 @@ services:

stubPhpDocProvider:
class: PHPStan\PhpDoc\StubPhpDocProvider
factory: @PHPStan\PhpDoc\StubPhpDocProviderFactory::create()

-
class: PHPStan\PhpDoc\StubPhpDocProviderFactory
arguments:
stubFiles: %stubFiles%

Expand Down
42 changes: 42 additions & 0 deletions src/PhpDoc/StubPhpDocProviderFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php declare(strict_types = 1);

namespace PHPStan\PhpDoc;

use PHPStan\Parser\Parser;
use PHPStan\Type\FileTypeMapper;

class StubPhpDocProviderFactory
{

private \PHPStan\Parser\Parser $parser;

private \PHPStan\Type\FileTypeMapper $fileTypeMapper;

/** @var string[] */
private array $stubFiles;

/**
* @param \PHPStan\Parser\Parser $parser
* @param string[] $stubFiles
*/
public function __construct(
Parser $parser,
FileTypeMapper $fileTypeMapper,
array $stubFiles
)
{
$this->parser = $parser;
$this->fileTypeMapper = $fileTypeMapper;
$this->stubFiles = $stubFiles;
}

public function create(): StubPhpDocProvider
{
return new StubPhpDocProvider(
$this->parser,
$this->fileTypeMapper,
$this->stubFiles
);
}

}

0 comments on commit 23b1c7f

Please sign in to comment.