From 938dbc089354abe890d06730b804335211fea4b1 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 5 Nov 2021 11:54:30 +0100 Subject: [PATCH] improve UseAnalyzerTest --- .../UseAnalyzer/Fixture/use_import.php.inc | 16 ++++++++++++++++ .../UseAnalyzer/UseAnalyzerTest.php | 17 +++++++++++++++++ .../RemoveUnusedAliasRectorTest.php | 2 ++ .../Rector/Use_/RemoveUnusedAliasRector.php | 4 ++++ 4 files changed, 39 insertions(+) create mode 100644 packages-tests/NameImporting/NodeAnalyzer/UseAnalyzer/Fixture/use_import.php.inc diff --git a/packages-tests/NameImporting/NodeAnalyzer/UseAnalyzer/Fixture/use_import.php.inc b/packages-tests/NameImporting/NodeAnalyzer/UseAnalyzer/Fixture/use_import.php.inc new file mode 100644 index 00000000000..7a0ee28b807 --- /dev/null +++ b/packages-tests/NameImporting/NodeAnalyzer/UseAnalyzer/Fixture/use_import.php.inc @@ -0,0 +1,16 @@ +getRealPath()); + $this->doTestFileInfo($fileInfo); } diff --git a/rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php b/rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php index 93cffe091e5..d98b6423480 100644 --- a/rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php +++ b/rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php @@ -100,6 +100,10 @@ public function refactor(Node $node): ?Node } $this->resolvedNamesAndParentsByShortName = $this->useAnalyzer->resolveUsedNameNodes($searchNode); + + dump(count($this->resolvedNamesAndParentsByShortName)); + die; + $this->resolvedDocPossibleAliases = $this->docAliasResolver->resolve($searchNode); $this->useNamesAliasToName = $this->useNameAliasToNameResolver->resolve($this->file);