Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean-up unusedcode #125

Merged
merged 4 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ composer.lock
cs-check.json
.phpunit.result.cache
/build/
*.phar
*.phar
.php-cs-fixer.cache
15 changes: 15 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

return (new PhpCsFixer\Config())
->setRules([
'no_unused_imports' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->notPath('assets/TestFiles/UseSingleLineNoGroup.php')
->in([__DIR__.'/src/', __DIR__.'/tests/'])
)
;
1 change: 0 additions & 1 deletion src/Parser/PHP/Strategy/FullQualifiedParameterStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ComposerUnused\SymbolParser\Parser\PHP\Strategy;

use PhpParser\Node;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Name\FullyQualified;

final class FullQualifiedParameterStrategy implements StrategyInterface
Expand Down
1 change: 0 additions & 1 deletion src/Parser/PHP/SymbolCollectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ComposerUnused\SymbolParser\Parser\PHP;

use Closure;
use ComposerUnused\SymbolParser\Symbol\SymbolName;
use PhpParser\NodeVisitor;

interface SymbolCollectorInterface extends NodeVisitor
Expand Down
2 changes: 1 addition & 1 deletion src/Symbol/Loader/FileSymbolLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function load(PackageInterface $package): Generator
array_merge(...$paths)
);

$sourceFolders = array_filter($sourceFolders, [$this, 'filterExistingDir']);
$sourceFolders = array_filter($sourceFolders, fn (string $dir): bool => $this->filterExistingDir($dir));

$finder = new Finder();

Expand Down
3 changes: 2 additions & 1 deletion src/Symbol/Loader/PsrSymbolLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Generator;
use ComposerUnused\SymbolParser\Symbol\NamespaceSymbol;

use function array_keys;
use function array_merge;

final class PsrSymbolLoader implements SymbolLoaderInterface
Expand All @@ -19,7 +20,7 @@ public function load(PackageInterface $package): Generator
$package->getAutoload()['psr-0'] ?? []
);

foreach ($namespaces as $namespace => $dir) {
foreach (array_keys($namespaces) as $namespace) {
yield new NamespaceSymbol($namespace);
}
}
Expand Down
Loading