Skip to content

Commit 2049575

Browse files
committed
Less memory-hungry BetterReflection
1 parent 11ef998 commit 2049575

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"nette/utils": "dev-master as 3.1.99",
2222
"nikic/php-parser": "4.7.0",
2323
"ondram/ci-detector": "^3.4.0",
24-
"ondrejmirtes/better-reflection": "4.3.23",
24+
"ondrejmirtes/better-reflection": "4.3.24",
2525
"phpdocumentor/reflection-docblock": "4.3.4",
2626
"phpstan/phpdoc-parser": "^0.4.8",
2727
"react/child-process": "^0.6.1",

src/DependencyInjection/ContainerFactory.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use PHPStan\Broker\Broker;
88
use PHPStan\Command\CommandHelper;
99
use PHPStan\File\FileHelper;
10+
use Roave\BetterReflection\BetterReflection;
11+
use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber;
1012

1113
class ContainerFactory
1214
{
@@ -97,6 +99,16 @@ public function create(
9799

98100
$container = $configurator->createContainer();
99101

102+
// @phpstan-ignore-next-line
103+
BetterReflection::populate(
104+
$container->getService('betterReflectionSourceLocator'),
105+
$container->getService('betterReflectionClassReflector'),
106+
$container->getService('betterReflectionFunctionReflector'),
107+
$container->getService('betterReflectionConstantReflector'),
108+
$container->getService('phpParserDecorator'),
109+
$container->getByType(PhpStormStubsSourceStubber::class)
110+
);
111+
100112
/** @var Broker $broker */
101113
$broker = $container->getByType(Broker::class);
102114
Broker::registerInstance($broker);

0 commit comments

Comments
 (0)