Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"require": {
"php": ">=8.4",
"entropy/entropy": "^0.4.2",
"entropy/entropy": "^0.4.6",
"nette/robot-loader": "^4.1",
"nette/utils": "^4.1",
"nikic/php-parser": "^5.7",
Expand Down
8 changes: 8 additions & 0 deletions src/Command/CheckCommentedCodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Entropy\Console\Contract\CommandInterface;
use Entropy\Console\Enum\ExitCode;
use Entropy\Console\Output\OutputPrinter;
use Entropy\Console\Output\ProgressBar;
use Rector\SwissKnife\Comments\CommentedCodeAnalyzer;
use Rector\SwissKnife\Finder\PhpFilesFinder;

Expand Down Expand Up @@ -34,17 +35,24 @@ public function run(array $sources, array $skipFiles = [], int $lineLimit = self
$message = sprintf('Analysing %d *.php files', count($phpFileInfos));
$this->outputPrinter->yellow($message);

$progressBar = new ProgressBar();
$progressBar->start(count($phpFileInfos));

$commentedLinesByFilePaths = [];
foreach ($phpFileInfos as $phpFileInfo) {
$commentedLines = $this->commentedCodeAnalyzer->process($phpFileInfo->getRealPath(), $lineLimit);

$progressBar->advance();

if ($commentedLines === []) {
continue;
}

$commentedLinesByFilePaths[$phpFileInfo->getRealPath()] = $commentedLines;
}

$progressBar->finish();

if ($commentedLinesByFilePaths === []) {
$this->outputPrinter->success('No commented code found');
return ExitCode::SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private function isConstantDefinedInParentClassAlso(Class_ $class, string $const
return in_array($constantName, $this->getClassConstantNames($parentClassName), true);
}
}

return array_any(
$class->implements,
fn ($implement): bool => in_array($constantName, $this->getClassConstantNames($implement->toString()), true)
Expand Down
1 change: 1 addition & 0 deletions src/Testing/UnitTestFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private function isUnitTest(string $class): bool
if (! is_a($class, 'PHPUnit\Framework\TestCase', true) && ! is_a($class, 'PHPUnit_Framework_TestCase', true)) {
return false;
}

return array_all(
self::NON_UNIT_TEST_CASE_CLASSES,
fn ($nonUnitTestCaseClass): bool => ! is_a($class, $nonUnitTestCaseClass, true)
Expand Down
Loading