mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-29 19:37:55 +01:00
Merge pull request #460 from rectorphp/br-4
Bump to better-reflection PR running on php-parser 4
This commit is contained in:
commit
34ba757e57
@ -13,11 +13,11 @@
|
||||
"nette/robot-loader": "^3.0",
|
||||
"nette/utils": "^2.5",
|
||||
"nikic/php-parser": "^4.0",
|
||||
"rector/better-reflection": "^4.0",
|
||||
"sebastian/diff": "^3.0",
|
||||
"symfony/console": "^4.0",
|
||||
"symfony/dependency-injection": "^4.0",
|
||||
"symfony/finder": "^4.0",
|
||||
"roave/better-reflection": "dev-master#f8b3fc6",
|
||||
"symplify/better-phpdoc-parser": "dev-master",
|
||||
"symplify/package-builder": "dev-master",
|
||||
"symplify/token-runner": "dev-master"
|
||||
|
@ -25,7 +25,7 @@ services:
|
||||
- 'PhpParser\Comment\Doc'
|
||||
- 'PhpParser\NodeTraverser'
|
||||
- 'Rector\DeprecationExtractor\Deprecation\*'
|
||||
- 'Rector\BetterReflection\SourceLocator\Located\LocatedSource'
|
||||
- 'Roave\BetterReflection\SourceLocator\Located\LocatedSource'
|
||||
- 'phpDocumentor\Reflection\Types\*'
|
||||
- 'Rector\Reporting\FileDiff'
|
||||
- 'Rector\RectorDefinition\*'
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Rector\BetterReflection\Reflector;
|
||||
|
||||
use Rector\BetterReflection\SourceLocator\SourceLocatorFactory;
|
||||
use Roave\BetterReflection\Reflector\ClassReflector;
|
||||
|
||||
final class ClassReflectorFactory
|
||||
{
|
||||
|
@ -6,8 +6,8 @@ use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Object_;
|
||||
use phpDocumentor\Reflection\Types\Self_;
|
||||
use phpDocumentor\Reflection\Types\Static_;
|
||||
use Rector\BetterReflection\Reflection\ReflectionMethod;
|
||||
use Rector\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Roave\BetterReflection\Reflection\ReflectionMethod;
|
||||
use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Throwable;
|
||||
|
||||
final class MethodReflector
|
||||
|
@ -4,8 +4,8 @@ namespace Rector\BetterReflection\Reflector;
|
||||
|
||||
use phpDocumentor\Reflection\Types\Array_;
|
||||
use phpDocumentor\Reflection\Types\Object_;
|
||||
use Rector\BetterReflection\Reflection\ReflectionProperty;
|
||||
use Rector\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Roave\BetterReflection\Reflection\ReflectionProperty;
|
||||
use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
|
||||
final class PropertyReflector
|
||||
{
|
||||
|
@ -6,9 +6,10 @@ use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use Rector\BetterReflection\Reflection\ReflectionClass;
|
||||
use Rector\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Rector\Configuration\Option;
|
||||
use Roave\BetterReflection\Reflection\ReflectionClass;
|
||||
use Roave\BetterReflection\Reflector\ClassReflector;
|
||||
use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Symplify\PackageBuilder\Parameter\ParameterProvider;
|
||||
use Throwable;
|
||||
|
||||
@ -88,8 +89,9 @@ final class SmartClassReflector
|
||||
|
||||
try {
|
||||
$classReflection = $this->reflect($className);
|
||||
|
||||
return $classReflection->getParentClassNames();
|
||||
if ($classReflection) {
|
||||
return $classReflection->getParentClassNames();
|
||||
}
|
||||
} catch (Throwable $throwable) {
|
||||
// intentionally empty
|
||||
}
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
namespace Rector\BetterReflection\SourceLocator;
|
||||
|
||||
use Rector\BetterReflection\SourceLocator\Ast\Locator;
|
||||
use Rector\BetterReflection\SourceLocator\Type\AggregateSourceLocator;
|
||||
use Rector\BetterReflection\SourceLocator\Type\AutoloadSourceLocator;
|
||||
use Rector\BetterReflection\SourceLocator\Type\DirectoriesSourceLocator;
|
||||
use Rector\BetterReflection\SourceLocator\Type\MemoizingSourceLocator;
|
||||
use Rector\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator;
|
||||
use Rector\BetterReflection\SourceLocator\Type\SingleFileSourceLocator;
|
||||
use Rector\BetterReflection\SourceLocator\Type\SourceLocator;
|
||||
use Roave\BetterReflection\SourceLocator\Ast\Locator;
|
||||
use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator;
|
||||
use Roave\BetterReflection\SourceLocator\Type\AutoloadSourceLocator;
|
||||
use Roave\BetterReflection\SourceLocator\Type\DirectoriesSourceLocator;
|
||||
use Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator;
|
||||
use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator;
|
||||
use Roave\BetterReflection\SourceLocator\Type\SingleFileSourceLocator;
|
||||
use Roave\BetterReflection\SourceLocator\Type\SourceLocator;
|
||||
|
||||
final class SourceLocatorFactory
|
||||
{
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
namespace Rector\BetterReflection\SourceLocator;
|
||||
|
||||
use Rector\BetterReflection\Identifier\Identifier;
|
||||
use Rector\BetterReflection\Identifier\IdentifierType;
|
||||
use Rector\BetterReflection\Reflection\Reflection;
|
||||
use Rector\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Rector\BetterReflection\Reflector\Reflector;
|
||||
use Rector\BetterReflection\SourceLocator\Ast\Locator;
|
||||
use Rector\BetterReflection\SourceLocator\Located\LocatedSource;
|
||||
use Rector\BetterReflection\SourceLocator\Type\SourceLocator;
|
||||
use Rector\BetterReflection\Stubber\SourceStubber;
|
||||
use Roave\BetterReflection\Identifier\Identifier;
|
||||
use Roave\BetterReflection\Identifier\IdentifierType;
|
||||
use Roave\BetterReflection\Reflection\Reflection;
|
||||
use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Roave\BetterReflection\Reflector\Reflector;
|
||||
use Roave\BetterReflection\SourceLocator\Ast\Locator;
|
||||
use Roave\BetterReflection\SourceLocator\Located\LocatedSource;
|
||||
use Roave\BetterReflection\SourceLocator\Type\SourceLocator;
|
||||
|
||||
/**
|
||||
* Located class in local stubs, as fallback locator if any other fails.
|
||||
|
@ -6,6 +6,6 @@ services:
|
||||
resource: '../'
|
||||
|
||||
# nikic\PHP-Parser
|
||||
Rector\BetterReflection\SourceLocator\Ast\Locator: ~
|
||||
Roave\BetterReflection\SourceLocator\Ast\Locator: ~
|
||||
|
||||
phpDocumentor\Reflection\FqsenResolver: ~
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace Rector\BetterReflection\Tests\Reflector;
|
||||
|
||||
use Rector\BetterReflection\Reflection\ReflectionClass;
|
||||
use Rector\BetterReflection\Reflector\ClassReflector;
|
||||
use Rector\BetterReflection\Reflector\ClassReflectorFactory;
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
use Roave\BetterReflection\Reflection\ReflectionClass;
|
||||
use Roave\BetterReflection\Reflector\ClassReflector;
|
||||
|
||||
final class ClassReflectorOnSourceTest extends AbstractContainerAwareTestCase
|
||||
{
|
||||
|
@ -3,11 +3,11 @@
|
||||
namespace Rector\NodeTraverserQueue;
|
||||
|
||||
use PhpParser\Lexer;
|
||||
use Rector\BetterReflection\Reflection\ReflectionFunction;
|
||||
use Rector\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use Rector\NodeTraverser\RectorNodeTraverser;
|
||||
use Rector\NodeTraverser\StandaloneTraverseNodeTraverser;
|
||||
use Rector\Parser\Parser;
|
||||
use Roave\BetterReflection\Reflection\ReflectionFunction;
|
||||
use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound;
|
||||
use SplFileInfo;
|
||||
|
||||
final class NodeTraverserQueue
|
||||
|
@ -9,13 +9,13 @@ use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use Rector\BetterReflection\Reflection\ReflectionFunction;
|
||||
use Rector\BetterReflection\Reflection\ReflectionFunctionAbstract;
|
||||
use Rector\BetterReflection\Reflection\ReflectionMethod;
|
||||
use Rector\BetterReflection\Reflector\MethodReflector;
|
||||
use Rector\Node\Attribute;
|
||||
use Rector\NodeAnalyzer\ClassLikeAnalyzer;
|
||||
use Rector\NodeTypeResolver\TypesExtractor\ConstructorPropertyTypesExtractor;
|
||||
use Roave\BetterReflection\Reflection\ReflectionFunction;
|
||||
use Roave\BetterReflection\Reflection\ReflectionFunctionAbstract;
|
||||
use Roave\BetterReflection\Reflection\ReflectionMethod;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterReflection\NodeCompiler;
|
||||
namespace Roave\BetterReflection\NodeCompiler;
|
||||
|
||||
use Rector\NodeTypeResolver\Tests\Source\NestedProperty\ClassWithPropertyLevel1;
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
namespace Rector\Regex;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\BetterReflection\Reflection\ReflectionClass;
|
||||
use Rector\BetterReflection\Reflection\ReflectionProperty;
|
||||
use Roave\BetterReflection\Reflection\ReflectionClass;
|
||||
use Roave\BetterReflection\Reflection\ReflectionProperty;
|
||||
|
||||
final class MagicMethodMatcher
|
||||
{
|
||||
|
@ -34,7 +34,10 @@ final class ClassLikeAnalyzerTest extends AbstractContainerAwareTestCase
|
||||
['SomeClass'],
|
||||
$this->classLikeAnalyzer->resolveTypeAndParentTypes(new Class_('SomeClass'))
|
||||
);
|
||||
}
|
||||
|
||||
public function testClassWithParentClass(): void
|
||||
{
|
||||
$classWithParent = $this->builderFactory->class('SomeClass')
|
||||
->extend('ParentClass')
|
||||
->getNode();
|
||||
@ -51,7 +54,10 @@ final class ClassLikeAnalyzerTest extends AbstractContainerAwareTestCase
|
||||
['SomeInterface'],
|
||||
$this->classLikeAnalyzer->resolveTypeAndParentTypes(new Interface_('SomeInterface'))
|
||||
);
|
||||
}
|
||||
|
||||
public function testInterfaceWithParentInterface(): void
|
||||
{
|
||||
$interfaceWithParent = $this->builderFactory->interface('SomeInterface')
|
||||
->extend('AnotherInterface')
|
||||
->getNode();
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterReflection\NodeCompiler;
|
||||
namespace Roave\BetterReflection\NodeCompiler;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterReflection\NodeCompiler;
|
||||
namespace Roave\BetterReflection\NodeCompiler;
|
||||
|
||||
use PhpParser\Node\Stmt\Property as PropertyNode;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterReflection\NodeCompiler;
|
||||
namespace Roave\BetterReflection\NodeCompiler;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterReflection\NodeCompiler;
|
||||
namespace Roave\BetterReflection\NodeCompiler;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterReflection\NodeCompiler;
|
||||
namespace Roave\BetterReflection\NodeCompiler;
|
||||
|
||||
use PhpParser\Node\Stmt\Property as PropertyNode;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterReflection\NodeCompiler;
|
||||
namespace Roave\BetterReflection\NodeCompiler;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user