Skip to content

Commit 1caf667

Browse files
Move phpstan docblock usage flag to constructor
Signed-off-by: Bart Jaskulski <bjaskulski@protonmail.com>
1 parent c277f18 commit 1caf667

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎lib/WorseReflection/Core/ServiceLocator.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function __construct(
6363
Cache $cache,
6464
private CacheForDocument $cacheForDocument,
6565
bool $enableContextualLocation = false,
66+
bool $usePhpStanDocblock = false,
6667
) {
6768
$sourceReflector = $reflectorFactory->create($this);
6869

@@ -90,10 +91,10 @@ public function __construct(
9091

9192
$this->sourceLocator = $sourceLocator;
9293

93-
if (!true) {
94-
$this->docblockFactory = new DocblockParserFactory($this->reflector);
95-
} else {
94+
if ($usePhpStanDocblock) {
9695
$this->docblockFactory = new PHPStanDocblockParserFactory($this->reflector);
96+
} else {
97+
$this->docblockFactory = new DocblockParserFactory($this->reflector);
9798
}
9899

99100
$this->docblockFactory = new UnsupportedTagsParserFactory($this->docblockFactory);

‎lib/WorseReflection/ReflectorBuilder.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ final class ReflectorBuilder
3636

3737
private bool $enableContextualSourceLocation = false;
3838

39+
private bool $usePhpStanDocblock = true;
40+
3941
private ?SourceCodeReflectorFactory $sourceReflectorFactory = null;
4042

4143
/**
@@ -144,7 +146,8 @@ public function build(): Reflector
144146
$this->memberContextResolvers,
145147
$this->buildCache(),
146148
$this->cacheForDocument ?? new CacheForDocument(fn () => new NullCache()),
147-
$this->enableContextualSourceLocation
149+
$this->enableContextualSourceLocation,
150+
$this->usePhpStanDocblock
148151
))->reflector();
149152
}
150153

0 commit comments

Comments
 (0)