Skip to content

Commit

Permalink
update: 修复测试并优化
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Oct 30, 2023
1 parent b8a25ec commit 7268758
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/HandleCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ public static function cleanComments(string $comments, int $paddingLen = 0, bool
$output = self::trimCommentEmpty($output);
$output = \array_reverse($output);

$output[] = $pad . " */";
$output = implode("\n", $output);

if (self::isEmptyComments($output)) {
return '';
}
$output[] = $pad . " */";
$output = implode("\n", $output);
return "/**\n" . $output;
}

Expand All @@ -239,9 +240,9 @@ protected static function trimCommentEmpty(array $lines): array
return $output;
}

protected static function isEmptyComments(string $comments): bool
protected static function isEmptyComments(array $lines): bool
{
foreach (\explode("\n", $comments) as $comment) {
foreach ($lines as $comment) {
if (preg_match('/^[\s*\/]*$/', $comment) === 0) {
return false;
}
Expand Down
2 changes: 0 additions & 2 deletions tests/CodeRewriteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ class TestEnum extends BaseEnum
use Imi\Aop\Annotation\Inject;
use Imi\Bean\Annotation\Bean;
use Imi\Cron\Contract\ICronManager;
use Imi\Cron\CronCalculator;
use Imi\Cron\CronLock;
/**
* 定时任务调度器
Expand Down

0 comments on commit 7268758

Please sign in to comment.