-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RelativeUnusedPublicClassMethodRule (#111)
* misc * remove deprecated twig_template_paths * Add RelativeUnusedPublicClassMethodRule
- Loading branch information
1 parent
8e3fd00
commit 8d4fc84
Showing
13 changed files
with
391 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TomasVotruba\UnusedPublic; | ||
|
||
use PHPStan\Node\CollectedDataNode; | ||
use TomasVotruba\UnusedPublic\CollectorMapper\MethodCallCollectorMapper; | ||
use TomasVotruba\UnusedPublic\Collectors\Callable_\AttributeCallableCollector; | ||
use TomasVotruba\UnusedPublic\Collectors\Callable_\CallUserFuncCollector; | ||
use TomasVotruba\UnusedPublic\Collectors\MethodCall\MethodCallableCollector; | ||
use TomasVotruba\UnusedPublic\Collectors\MethodCall\MethodCallCollector; | ||
use TomasVotruba\UnusedPublic\Collectors\StaticCall\StaticMethodCallableCollector; | ||
use TomasVotruba\UnusedPublic\Collectors\StaticCall\StaticMethodCallCollector; | ||
use TomasVotruba\UnusedPublic\ValueObject\LocalAndExternalMethodCallReferences; | ||
|
||
final readonly class NodeCollectorExtractor | ||
{ | ||
public function __construct( | ||
private MethodCallCollectorMapper $methodCallCollectorMapper | ||
) { | ||
} | ||
|
||
public function extractLocalAndExternalMethodCallReferences( | ||
CollectedDataNode $collectedDataNode | ||
): LocalAndExternalMethodCallReferences { | ||
$collectedDatas = $this->extractCollectedDatas($collectedDataNode); | ||
return $this->methodCallCollectorMapper->mapToLocalAndExternal($collectedDatas); | ||
} | ||
|
||
/** | ||
* @return string[] | ||
*/ | ||
public function extractMethodCallReferences(CollectedDataNode $collectedDataNode): array | ||
{ | ||
$collectedDatas = $this->extractCollectedDatas($collectedDataNode); | ||
return $this->methodCallCollectorMapper->mapToMethodCallReferences($collectedDatas); | ||
} | ||
|
||
/** | ||
* @return mixed[] | ||
*/ | ||
private function extractCollectedDatas(CollectedDataNode $collectedDataNode): array | ||
{ | ||
return [ | ||
$collectedDataNode->get(MethodCallCollector::class), | ||
$collectedDataNode->get(MethodCallableCollector::class), | ||
$collectedDataNode->get(StaticMethodCallCollector::class), | ||
$collectedDataNode->get(StaticMethodCallableCollector::class), | ||
$collectedDataNode->get(AttributeCallableCollector::class), | ||
$collectedDataNode->get(CallUserFuncCollector::class), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.