Skip to content

Commit ff744b1

Browse files
committed
refactor(docs): Improve PHPDoc comments and code style
- Added PHPDoc for the exceptOptions method to specify parameter type. - Updated PHPDoc annotations for default values to improve clarity. - Refactored array spread syntax for better readability. - Adjusted PHP CS Fixer configuration to prevent extra blank lines in specific tokens. Signed-off-by: guanguans <ityaozm@gmail.com>
1 parent 5eccbb7 commit ff744b1

File tree

8 files changed

+32
-9
lines changed

8 files changed

+32
-9
lines changed

.php-cs-fixer.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,24 @@
142142
'anonymous_class' => false,
143143
'named_class' => false,
144144
],
145+
'no_extra_blank_lines' => [
146+
'tokens' => [
147+
'attribute',
148+
'break',
149+
'case',
150+
// 'comma',
151+
'continue',
152+
'curly_brace_block',
153+
'default',
154+
'extra',
155+
'parenthesis_brace_block',
156+
'return',
157+
'square_brace_block',
158+
'switch',
159+
'throw',
160+
'use',
161+
],
162+
],
145163
'ordered_traits' => [
146164
'case_sensitive' => true,
147165
],
@@ -234,6 +252,7 @@
234252
'stick_comment_to_next_continuous_control_statement' => true,
235253
],
236254
'static_lambda' => false, // pest
255+
'static_private_method' => false,
237256
]));
238257

239258
$ruleSet->withCustomFixers(Fixers::fromFixers(

composer-updater

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ $status = (new SingleCommandApplication)
218218
$dependencyVersions = [$this->toDependencyVersion($package['version'])];
219219

220220
if ($lowestArrayVersion[0] !== $highestArrayVersion[0]) {
221-
$dependencyVersions = array_merge($dependencyVersions, array_map(
221+
$dependencyVersions = [...$dependencyVersions, ...array_map(
222222
static fn (string $major): string => "^$major.0",
223223
range($lowestArrayVersion[0] + 1, $highestArrayVersion[0])
224-
));
224+
)];
225225
}
226226

227227
$package['dependency_version'] = implode(' || ', $dependencyVersions);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
"pest-coverage": "@pest --coverage-html=./.build/phpunit/ --coverage-clover=./.build/phpunit/clover.xml",
223223
"pest-highest": [
224224
"@putenvs",
225-
"$PHP83 ./vendor/bin/pest --coverage"
225+
"$PHP84 ./vendor/bin/pest --coverage"
226226
],
227227
"pest-migrate-configuration": "@pest --migrate-configuration",
228228
"pest-profile": "@pest --profile",

rector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
3030
use Rector\Config\RectorConfig;
3131
use Rector\DeadCode\Rector\ClassLike\RemoveAnnotationRector;
32-
use Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector;
32+
use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector;
3333
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
3434
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
3535
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
@@ -147,7 +147,7 @@ classes(),
147147
)
148148
)
149149
->withSkip([
150-
DowngradeArraySpreadStringKeyRector::class,
150+
DowngradeArraySpreadRector::class,
151151
EncapsedStringsToSprintfRector::class,
152152
ExplicitBoolCompareRector::class,
153153
LogicalToBooleanRector::class,

src/Concerns/HasOptions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ public function exceptOption(string $name): self
503503
return $this;
504504
}
505505

506+
/**
507+
* @param list<string> $names
508+
*/
506509
public function exceptOptions(array $names): self
507510
{
508511
foreach ($names as $name) {

src/Support/Rectors/AddHasOptionsDocCommentRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function refactor(Node $node): ?Node
9090
* @var array<string, array{
9191
* name: string,
9292
* type: string,
93-
* default: string|null,
93+
* default: null|string,
9494
* description: string,
9595
* }> $options
9696
*/

src/Support/Rectors/AddSoarOptionsDocCommentRector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ public function refactor(Node $node): ?Node
9797
/**
9898
* @throws \Guanguans\SoarPHP\Exceptions\InvalidOptionException
9999
*
100-
* @var array{
100+
* @var null|array{
101101
* name: string,
102102
* type: string,
103-
* default: string|null,
103+
* default: null|string,
104104
* description: string,
105-
* }|null $help
105+
* } $help
106106
*/
107107
$help = $soarHelp->get($this->valueResolver->getValue($node->key));
108108

tests/Concerns/WithRunableTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ protected function shouldApplySudoPassword(): bool
5757
'sudo: no password was provided',
5858
'sudo: 1 incorrect password attempt',
5959
]))
60+
->skip()
6061
->skip(running_in_github_action());
6162

6263
it('can run soar process with tapper', function (): void {

0 commit comments

Comments
 (0)