Skip to content

Commit

Permalink
release PHP 7.2 downgraded
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jul 18, 2023
1 parent c23f0d0 commit 0d0bd25
Show file tree
Hide file tree
Showing 631 changed files with 64,501 additions and 623 deletions.
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

File renamed without changes.
9 changes: 3 additions & 6 deletions .github/workflows/bare_run.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Bare Run on various PHP versions
name: Bare Run

on:
push:
tags:
- '*.72'
on: [pull_request, push]

jobs:
bare_run:
Expand All @@ -18,7 +15,7 @@ jobs:
- uses: actions/checkout@v2

-
uses: shivammathur/setup-php@v3
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
coverage: none
Expand Down
10 changes: 0 additions & 10 deletions .gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Downloads total](https://img.shields.io/packagist/dt/tomasvotruba/class-leak.svg?style=flat-square)](https://packagist.org/packages/tomasvotruba/class-leak/stats)

Find leaking classes that you never use... and get rid of them.
Find leaking classes that you never use... and get rif of them.

## Install

Expand Down
18 changes: 14 additions & 4 deletions app/ClassNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@
*/
final class ClassNameResolver
{
public function __construct(
private readonly Parser $parser,
private readonly FullyQualifiedNameNodeDecorator $fullyQualifiedNameNodeDecorator
) {
/**
* @readonly
* @var \PhpParser\Parser
*/
private $parser;
/**
* @readonly
* @var \TomasVotruba\ClassLeak\NodeDecorator\FullyQualifiedNameNodeDecorator
*/
private $fullyQualifiedNameNodeDecorator;
public function __construct(Parser $parser, FullyQualifiedNameNodeDecorator $fullyQualifiedNameNodeDecorator)
{
$this->parser = $parser;
$this->fullyQualifiedNameNodeDecorator = $fullyQualifiedNameNodeDecorator;
}

/**
Expand Down
47 changes: 38 additions & 9 deletions app/Console/Commands/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,46 @@

final class CheckCommand extends Command
{
public function __construct(
private readonly ClassNamesFinder $classNamesFinder,
private readonly UseImportsResolver $useImportsResolver,
private readonly PossiblyUnusedClassesFilter $possiblyUnusedClassesFilter,
private readonly UnusedClassReporter $unusedClassReporter,
private readonly SymfonyStyle $symfonyStyle,
private readonly PhpFilesFinder $phpFilesFinder,
) {
/**
* @readonly
* @var \TomasVotruba\ClassLeak\Finder\ClassNamesFinder
*/
private $classNamesFinder;
/**
* @readonly
* @var \TomasVotruba\ClassLeak\UseImportsResolver
*/
private $useImportsResolver;
/**
* @readonly
* @var \TomasVotruba\ClassLeak\Filtering\PossiblyUnusedClassesFilter
*/
private $possiblyUnusedClassesFilter;
/**
* @readonly
* @var \TomasVotruba\ClassLeak\Reporting\UnusedClassReporter
*/
private $unusedClassReporter;
/**
* @readonly
* @var \Symfony\Component\Console\Style\SymfonyStyle
*/
private $symfonyStyle;
/**
* @readonly
* @var \TomasVotruba\ClassLeak\Finder\PhpFilesFinder
*/
private $phpFilesFinder;
public function __construct(ClassNamesFinder $classNamesFinder, UseImportsResolver $useImportsResolver, PossiblyUnusedClassesFilter $possiblyUnusedClassesFilter, UnusedClassReporter $unusedClassReporter, SymfonyStyle $symfonyStyle, PhpFilesFinder $phpFilesFinder)
{
$this->classNamesFinder = $classNamesFinder;
$this->useImportsResolver = $useImportsResolver;
$this->possiblyUnusedClassesFilter = $possiblyUnusedClassesFilter;
$this->unusedClassReporter = $unusedClassReporter;
$this->symfonyStyle = $symfonyStyle;
$this->phpFilesFinder = $phpFilesFinder;
parent::__construct();
}

protected function configure(): void
{
$this->setName('check');
Expand Down
2 changes: 1 addition & 1 deletion app/Filtering/PossiblyUnusedClassesFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function filter(array $filesWithClasses, array $usedClassNames, array $ty

private function isClassSkipped(FileWithClass $fileWithClass, string $typeToSkip): bool
{
if (! str_contains($typeToSkip, '*')) {
if (strpos($typeToSkip, '*') === false) {
return is_a($fileWithClass->getClassName(), $typeToSkip, true);
}

Expand Down
12 changes: 8 additions & 4 deletions app/Finder/ClassNamesFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@

final class ClassNamesFinder
{
public function __construct(
private readonly ClassNameResolver $classNameResolver,
) {
/**
* @readonly
* @var \TomasVotruba\ClassLeak\ClassNameResolver
*/
private $classNameResolver;
public function __construct(ClassNameResolver $classNameResolver)
{
$this->classNameResolver = $classNameResolver;
}

/**
* @param string[] $filePaths
* @return FileWithClass[]
Expand Down
5 changes: 4 additions & 1 deletion app/NodeVisitor/ClassNameNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ final class ClassNameNodeVisitor extends NodeVisitorAbstract
*/
private const API_TAG_REGEX = '#@api\b#';

private string|null $className = null;
/**
* @var string|null
*/
private $className = null;

/**
* @param Node\Stmt[] $nodes
Expand Down
7 changes: 5 additions & 2 deletions app/NodeVisitor/UsedClassNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class UsedClassNodeVisitor extends NodeVisitorAbstract
/**
* @var string[]
*/
private array $usedNames = [];
private $usedNames = [];

/**
* @param Stmt[] $nodes
Expand All @@ -31,7 +31,10 @@ public function beforeTraverse(array $nodes): array
return $nodes;
}

public function enterNode(Node $node): Node|null|int
/**
* @return \PhpParser\Node|null|int
*/
public function enterNode(Node $node)
{
if ($node instanceof FuncCall) {
return NodeTraverser::DONT_TRAVERSE_CHILDREN;
Expand Down
16 changes: 9 additions & 7 deletions app/Reporting/UnusedClassReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@

final class UnusedClassReporter
{
public function __construct(
private readonly SymfonyStyle $symfonyStyle
) {
/**
* @readonly
* @var \Symfony\Component\Console\Style\SymfonyStyle
*/
private $symfonyStyle;
public function __construct(SymfonyStyle $symfonyStyle)
{
$this->symfonyStyle = $symfonyStyle;
}

/**
Expand All @@ -25,10 +30,7 @@ public function reportResult(array $unusedFilesWithClasses, array $existingFiles
$this->symfonyStyle->newLine(2);

if ($unusedFilesWithClasses === []) {
$successMessage = sprintf(
'All the %d services are used. Great job!',
count($existingFilesWithClasses),
);
$successMessage = sprintf('All the %d services are used. Great job!', count($existingFilesWithClasses));
$this->symfonyStyle->success($successMessage);
return Command::SUCCESS;
}
Expand Down
19 changes: 14 additions & 5 deletions app/UseImportsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,21 @@
*/
final class UseImportsResolver
{
public function __construct(
private readonly Parser $parser,
private readonly FullyQualifiedNameNodeDecorator $fullyQualifiedNameNodeDecorator,
) {
/**
* @readonly
* @var \PhpParser\Parser
*/
private $parser;
/**
* @readonly
* @var \TomasVotruba\ClassLeak\NodeDecorator\FullyQualifiedNameNodeDecorator
*/
private $fullyQualifiedNameNodeDecorator;
public function __construct(Parser $parser, FullyQualifiedNameNodeDecorator $fullyQualifiedNameNodeDecorator)
{
$this->parser = $parser;
$this->fullyQualifiedNameNodeDecorator = $fullyQualifiedNameNodeDecorator;
}

/**
* @param string[] $filePaths
* @return string[]
Expand Down
18 changes: 14 additions & 4 deletions app/ValueObject/FileWithClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@

final class FileWithClass
{
public function __construct(
private readonly string $filePath,
private readonly string $className
) {
/**
* @readonly
* @var string
*/
private $filePath;
/**
* @readonly
* @var string
*/
private $className;
public function __construct(string $filePath, string $className)
{
$this->filePath = $filePath;
$this->className = $className;
}

public function getClassName(): string
Expand Down
52 changes: 0 additions & 52 deletions build/build-scoped.sh

This file was deleted.

21 changes: 0 additions & 21 deletions build/rector-downgrade-php-72.php

This file was deleted.

3 changes: 0 additions & 3 deletions build/target-repository/.github/FUNDING.yml

This file was deleted.

23 changes: 0 additions & 23 deletions build/target-repository/.github/workflows/bare_run.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions build/target-repository/README.md

This file was deleted.

Loading

0 comments on commit 0d0bd25

Please sign in to comment.