Skip to content

Commit

Permalink
ci(formatting): Fix formatting issues in .php-cs-fixer.php, examples/…
Browse files Browse the repository at this point in the history
…soar.options.docblock.php, and src/Support/ComposerScript.php

- Set 'phpdoc_summary' to false in .php-cs-fixer.php
- Update the docblock in examples/soar.options.docblock.php to remove the period after the default value
- Update the docblock in src/Support/ComposerScript.php to include copyright and license information, and update the @see link
  • Loading branch information
guanguans committed Jan 16, 2025
1 parent 7c36e18 commit cb13eec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
'prefix' => 'provide',
'suffix' => 'Cases',
],
'phpdoc_summary' => false,
'phpdoc_align' => [
'align' => 'left',
'spacing' => 1,
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
"@dump-soar-php-config",
"@dump-soar-yaml-config"
],
"dump-soar-docblock": "Guanguans\\SoarPHP\\Support\\ComposerScript::dumpSoarDocblock",
"dump-soar-php-config": "Guanguans\\SoarPHP\\Support\\ComposerScript::dumpSoarConfig",
"dump-soar-docblock": "Guanguans\\SoarPHP\\Support\\ComposerScripts::dumpSoarDocblock",
"dump-soar-php-config": "Guanguans\\SoarPHP\\Support\\ComposerScripts::dumpSoarConfig",
"dump-soar-yaml-config": "./bin/soar.darwin-amd64 -print-config -verbose > examples/soar.options.example.yaml",
"json-lint": "@php ./vendor/bin/jsonlint *.json .*rc",
"lint": [
Expand Down
2 changes: 1 addition & 1 deletion examples/soar.options.docblock.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @see https://github.com/guanguans/soar-php
*/
/**
* AllowCharsets (default "utf8,utf8mb4").
* AllowCharsets (default "utf8,utf8mb4")
*
* @method self addAllowCharsets(string $allowCharsets)
*
Expand Down
22 changes: 12 additions & 10 deletions src/Support/ComposerScript.php → src/Support/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* @internal
*/
final class ComposerScript
final class ComposerScripts
{
/**
* @noinspection PhpUnused
Expand All @@ -36,11 +36,12 @@ public static function dumpSoarDocblock(Event $event): int
declare(strict_types=1);
/**
* This file is part of the guanguans/soar-php.
* Copyright (c) 2019-2025 guanguans<ityaozm@gmail.com>
*
* (c) guanguans <ityaozm@gmail.com>
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* This source file is subject to the MIT license that is bundled.
* @see https://github.com/guanguans/soar-php
*/
/**
docblock;
Expand Down Expand Up @@ -73,7 +74,7 @@ static function (string $docblock, array $option) use ($typeOfMethod, $t): strin
$option['type'] = 'int';
}

if (0 === strncmp($typeOfMethod, 'get', \strlen('get')) && null === $option['type']) {
if (null === $option['type'] && 0 === strncmp($typeOfMethod, 'get', \strlen('get'))) {
$option['type'] = 'mixed';
}

Expand Down Expand Up @@ -115,11 +116,12 @@ public static function dumpSoarConfig(Event $event): int
declare(strict_types=1);
/**
* This file is part of the guanguans/soar-php.
* Copyright (c) 2019-2025 guanguans<ityaozm@gmail.com>
*
* (c) guanguans <ityaozm@gmail.com>
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* This source file is subject to the MIT license that is bundled.
* @see https://github.com/guanguans/soar-php
*/
// +----------------------------------------------------------------------+//
Expand Down Expand Up @@ -174,8 +176,8 @@ public static function extractOptionsFromHelp(): array

$default = $defaults[0] ?? null;

if (\is_string($default) && 0 === strncmp($default, $pre = '(default ', \strlen($pre = '(default '))) {
$default = rtrim(substr($default, \strlen($pre)), ')');
if (\is_string($default) && 0 === strncmp($default, $prefix = '(default ', \strlen($prefix))) {
$default = rtrim(substr($default, \strlen($prefix)), ')');
}

$options[$names[0]] = [
Expand Down

0 comments on commit cb13eec

Please sign in to comment.