Skip to content

Commit

Permalink
Allow BetterReflection 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Jun 19, 2020
1 parent e849c6a commit 931870b
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 78 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"composer/composer": "^1.10.5",
"nikolaposa/version": "^4.0.0",
"ocramius/package-versions": "^1.5.1",
"roave/better-reflection": "^3.5.0",
"roave/better-reflection": "^3.5.0 || ^4.0.0",
"symfony/console": "^4.4.8",
"symfony/process": "^5.1.0",
"thecodingmachine/safe": "^1.1"
Expand Down
152 changes: 78 additions & 74 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/LocateDependencies/LocateDependenciesViaComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Assert\Assert;
use Composer\Installer;
use Roave\BetterReflection\SourceLocator\Ast\Locator;
use Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber;
use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator;
use Roave\BetterReflection\SourceLocator\Type\Composer\Factory\MakeLocatorForInstalledJson;
use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator;
Expand Down Expand Up @@ -55,7 +56,7 @@ public function __invoke(string $installationPath) : SourceLocator

return new AggregateSourceLocator([
(new MakeLocatorForInstalledJson())->__invoke($installationPath, $this->astLocator),
new PhpInternalSourceLocator($this->astLocator),
new PhpInternalSourceLocator($this->astLocator, new ReflectionSourceStubber()),
]);
}

Expand Down
6 changes: 4 additions & 2 deletions test/unit/StringReflectorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Roave\BetterReflection\BetterReflection;
use Roave\BetterReflection\Reflector\ClassReflector;
use Roave\BetterReflection\SourceLocator\Exception\EmptyPhpSourceCode;
use Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber;
use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator;
use Roave\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator;
use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator;
Expand All @@ -20,11 +21,12 @@ final class StringReflectorFactory
public function __invoke(string $sourceCode) : ClassReflector
{
$astLocator = (new BetterReflection())->astLocator();
$stubber = new ReflectionSourceStubber();

return new ClassReflector(
new AggregateSourceLocator([
new PhpInternalSourceLocator($astLocator),
new EvaledCodeSourceLocator($astLocator),
new PhpInternalSourceLocator($astLocator, $stubber),
new EvaledCodeSourceLocator($astLocator, $stubber),
new StringSourceLocator($sourceCode, $astLocator),
])
);
Expand Down

0 comments on commit 931870b

Please sign in to comment.