mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
fixup (#5897)
This commit is contained in:
parent
6f4b0b4ae9
commit
33daf1de2e
@ -50,8 +50,11 @@ final class DowngradeRectorConfig
|
|||||||
|
|
||||||
// use relative paths, so files are excluded on nested directory too
|
// use relative paths, so files are excluded on nested directory too
|
||||||
'vendor/symfony/http-kernel/HttpKernelBrowser.php',
|
'vendor/symfony/http-kernel/HttpKernelBrowser.php',
|
||||||
'vendor/symfony/string/Slugger/AsciiSlugger.php',
|
|
||||||
|
|
||||||
|
// not used at all
|
||||||
|
'vendor/symfony/http-foundation/Session/*',
|
||||||
|
'vendor/symfony/string/Slugger/AsciiSlugger.php',
|
||||||
|
'vendor/nette/caching/src/Bridges/*',
|
||||||
|
|
||||||
// always excluded
|
// always excluded
|
||||||
'*vendor/symfony/polyfill*/bootstrap80.php',
|
'*vendor/symfony/polyfill*/bootstrap80.php',
|
||||||
|
@ -30,5 +30,5 @@ for directory in $directories; do
|
|||||||
echo "[NOTE] Downgrading '$directory' directory\n"
|
echo "[NOTE] Downgrading '$directory' directory\n"
|
||||||
|
|
||||||
# --working-dir is needed, so "SKIP" parameter is applied in absolute path of nested directory
|
# --working-dir is needed, so "SKIP" parameter is applied in absolute path of nested directory
|
||||||
php -d memory_limit=-1 bin/rector process $directory --config build/config/config-downgrade.php --working-dir $BUILD_DIRECTORY --ansi
|
php -d memory_limit=-1 bin/rector process $directory --config build/config/config-downgrade.php --working-dir $BUILD_DIRECTORY --ansi --debug
|
||||||
done
|
done
|
||||||
|
@ -102,12 +102,12 @@ abstract class AbstractPhpDocInfoTest extends AbstractKernelTestCase
|
|||||||
{
|
{
|
||||||
$nodes = $this->fileInfoParser->parseFileInfoToNodesAndDecorate($fileInfo);
|
$nodes = $this->fileInfoParser->parseFileInfoToNodesAndDecorate($fileInfo);
|
||||||
|
|
||||||
$foundNode = $this->betterNodeFinder->findFirstInstanceOf($nodes, $nodeType);
|
$namespace = $this->betterNodeFinder->findFirstInstanceOf($nodes, $nodeType);
|
||||||
if (! $foundNode instanceof Node) {
|
if (! $namespace instanceof Node) {
|
||||||
throw new ShouldNotHappenException();
|
throw new ShouldNotHappenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $foundNode;
|
return $namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function printNodePhpDocInfoToString(Node $node): string
|
private function printNodePhpDocInfoToString(Node $node): string
|
||||||
|
@ -92,12 +92,12 @@ final class UseAddingPostRector extends AbstractPostRector
|
|||||||
$this->useNodesToAddCollector->clear($smartFileInfo);
|
$this->useNodesToAddCollector->clear($smartFileInfo);
|
||||||
|
|
||||||
// A. has namespace? add under it
|
// A. has namespace? add under it
|
||||||
$foundNode = $this->betterNodeFinder->findFirstInstanceOf($nodes, Namespace_::class);
|
$namespace = $this->betterNodeFinder->findFirstInstanceOf($nodes, Namespace_::class);
|
||||||
if ($foundNode instanceof Namespace_) {
|
if ($namespace instanceof Namespace_) {
|
||||||
// first clean
|
// first clean
|
||||||
$this->useImportsRemover->removeImportsFromNamespace($foundNode, $removedShortUses);
|
$this->useImportsRemover->removeImportsFromNamespace($namespace, $removedShortUses);
|
||||||
// then add, to prevent adding + removing false positive of same short use
|
// then add, to prevent adding + removing false positive of same short use
|
||||||
$this->useImportsAdder->addImportsToNamespace($foundNode, $useImportTypes, $functionUseImportTypes);
|
$this->useImportsAdder->addImportsToNamespace($namespace, $useImportTypes, $functionUseImportTypes);
|
||||||
|
|
||||||
return $nodes;
|
return $nodes;
|
||||||
}
|
}
|
||||||
|
@ -587,3 +587,6 @@ parameters:
|
|||||||
|
|
||||||
# phpstan bug
|
# phpstan bug
|
||||||
- '#Unable to resolve the template type T in call to method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findParentTypes\(\)#'
|
- '#Unable to resolve the template type T in call to method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findParentTypes\(\)#'
|
||||||
|
-
|
||||||
|
message: '#Function "interface_exists\(\)" cannot be used/left in the code#'
|
||||||
|
path: packages/Testing/PhpConfigPrinter/config/php-config-printer-config.php
|
||||||
|
@ -32,12 +32,12 @@ final class FullyQualifiedNameResolver
|
|||||||
*/
|
*/
|
||||||
public function resolveFullyQualifiedName(array $nodes, string $shortClassName): string
|
public function resolveFullyQualifiedName(array $nodes, string $shortClassName): string
|
||||||
{
|
{
|
||||||
$foundNode = $this->betterNodeFinder->findFirstInstanceOf($nodes, Namespace_::class);
|
$namespace = $this->betterNodeFinder->findFirstInstanceOf($nodes, Namespace_::class);
|
||||||
if (! $foundNode instanceof Namespace_) {
|
if (! $namespace instanceof Namespace_) {
|
||||||
return $shortClassName;
|
return $shortClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$namespaceName = $this->nodeNameResolver->getName($foundNode);
|
$namespaceName = $this->nodeNameResolver->getName($namespace);
|
||||||
if ($namespaceName === null) {
|
if ($namespaceName === null) {
|
||||||
return $shortClassName;
|
return $shortClassName;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user