From fa662221f3b30df5ba0fcb36b0140a5f62106c1b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 10 Feb 2024 19:43:11 +0100 Subject: [PATCH] cleanup --- README.md | 4 ---- src/EntityClassResolver.php | 5 +++-- src/NodeTraverser/NodeTraverserFactory.php | 26 ---------------------- src/ParentClassResolver.php | 5 +++-- 4 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 src/NodeTraverser/NodeTraverserFactory.php diff --git a/README.md b/README.md index d9c1690..6b0ffe1 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,7 @@ composer require tomasvotruba/finalize --dev ## Usage ```bash -<<<<<<< HEAD -vendor/bin/finalize detect src/ tests/ -======= vendor/bin/finalize finalize src tests ->>>>>>> 0155139 (misc) ``` It will: diff --git a/src/EntityClassResolver.php b/src/EntityClassResolver.php index 18f584b..f19f139 100644 --- a/src/EntityClassResolver.php +++ b/src/EntityClassResolver.php @@ -6,7 +6,6 @@ use PhpParser\NodeTraverser; use Symfony\Component\Finder\SplFileInfo; -use TomasVotruba\Finalize\NodeTraverser\NodeTraverserFactory; use TomasVotruba\Finalize\NodeVisitor\EntityClassNameCollectingNodeVisitor; use TomasVotruba\Finalize\PhpParser\CachedPhpParser; @@ -24,7 +23,9 @@ public function __construct( public function resolve(array $phpFileInfos, \Closure $progressClosure): array { $entityClassNameCollectingNodeVisitor = new EntityClassNameCollectingNodeVisitor(); - $nodeTraverser = NodeTraverserFactory::createWithNodeVisitor($entityClassNameCollectingNodeVisitor); + + $nodeTraverser = new NodeTraverser(); + $nodeTraverser->addVisitor($entityClassNameCollectingNodeVisitor); $this->traverseFileInfos($phpFileInfos, $nodeTraverser, $progressClosure); diff --git a/src/NodeTraverser/NodeTraverserFactory.php b/src/NodeTraverser/NodeTraverserFactory.php deleted file mode 100644 index 8bc1110..0000000 --- a/src/NodeTraverser/NodeTraverserFactory.php +++ /dev/null @@ -1,26 +0,0 @@ -addVisitor(new NameResolver()); - - $nodeTraverser->addVisitor($nodeVisitor); - - return $nodeTraverser; - } -} diff --git a/src/ParentClassResolver.php b/src/ParentClassResolver.php index 12f0337..a300fcd 100644 --- a/src/ParentClassResolver.php +++ b/src/ParentClassResolver.php @@ -6,7 +6,6 @@ use PhpParser\NodeTraverser; use Symfony\Component\Finder\SplFileInfo; -use TomasVotruba\Finalize\NodeTraverser\NodeTraverserFactory; use TomasVotruba\Finalize\NodeVisitor\ParentClassNameCollectingNodeVisitor; use TomasVotruba\Finalize\PhpParser\CachedPhpParser; @@ -24,7 +23,9 @@ public function __construct( public function resolve(array $phpFileInfos, \Closure $progressClosure): array { $parentClassNameCollectingNodeVisitor = new ParentClassNameCollectingNodeVisitor(); - $nodeTraverser = NodeTraverserFactory::createWithNodeVisitor($parentClassNameCollectingNodeVisitor); + + $nodeTraverser = new NodeTraverser(); + $nodeTraverser->addVisitor($parentClassNameCollectingNodeVisitor); $this->traverseFileInfos($phpFileInfos, $nodeTraverser, $progressClosure);