File tree Expand file tree Collapse file tree 10 files changed +127
-4
lines changed
Expand file tree Collapse file tree 10 files changed +127
-4
lines changed Original file line number Diff line number Diff line change 1+ formatter :
2+ type : basic
3+ eof_newline : true
4+ retain_line_breaks : true
5+ retain_line_breaks_single : true
6+ scan_folded_as_literal : true
7+ trim_trailing_whitespace : true
8+
Original file line number Diff line number Diff line change 172172 " @composer-dependency-analyser" ,
173173 " @test" ,
174174 " @phpstan" ,
175+ " @rule-doc-rector-generate" ,
175176 " @rector-dry-run"
176177 ],
177178 "class-leak" : " @php ./vendor/bin/class-leak --ansi -v" ,
271272 "release-minor-dry-run" : " @release-minor --dry-run" ,
272273 "release-patch" : " @release patch" ,
273274 "release-patch-dry-run" : " @release-patch --dry-run" ,
275+ "rule-doc" : [
276+ " @putenvs" ,
277+ " $PHP82 rule-doc-generator --ansi -vv"
278+ ],
279+ "rule-doc-rector-generate" : " @rule-doc generate src/Support/Rectors/ --output-file=src/Support/Rectors/rector-rules-overview.md --categorize=rector" ,
280+ "rule-doc-rector-validate" : " @rule-doc validate src/Support/Rectors/" ,
274281 "sk" : " @php ./vendor/bin/swiss-knife --ansi -v" ,
275282 "sk-check-commented-code" : " @sk check-commented-code ./config ./src --line-limit=5" ,
276283 "sk-check-conflicts" : " @sk check-conflicts ./config ./src" ,
Original file line number Diff line number Diff line change 1+ {
2+ "preset" : " laravel" ,
3+ "ignore" : {
4+ "words" : [
5+ " php"
6+ ],
7+ "paths" : []
8+ }
9+ }
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env php
2+ <?php
3+
4+ declare (strict_types=1 );
5+
6+ /**
7+ * Copyright (c) 2021-2025 guanguans<ityaozm@gmail.com>
8+ *
9+ * For the full copyright and license information, please view
10+ * the LICENSE file that was distributed with this source code.
11+ *
12+ * @see https://github.com/guanguans/laravel-skeleton
13+ */
14+
15+ namespace RuleDocGenerator202408 ;
16+
17+ require __DIR__ .'/vendor/autoload.php ' ;
18+
19+ require __DIR__ .'/vendor-bin/common/vendor/symplify/rule-doc-generator/bin/rule-doc-generator.php ' ;
Original file line number Diff line number Diff line change 2525use Rector \BetterPhpDocParser \PhpDocInfo \PhpDocInfoFactory ;
2626use Rector \Comments \NodeDocBlock \DocBlockUpdater ;
2727use Rector \Rector \AbstractRector ;
28+ use Symplify \RuleDocGenerator \Contract \DocumentedRuleInterface ;
2829use Symplify \RuleDocGenerator \Exception \PoorDocumentationException ;
2930use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
3031use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
3132
3233/**
3334 * @internal
3435 */
35- final class AddHasOptionsDocCommentRector extends AbstractRector
36+ final class AddHasOptionsDocCommentRector extends AbstractRector implements DocumentedRuleInterface
3637{
3738 public function __construct (
3839 private readonly DocBlockUpdater $ docBlockUpdater ,
Original file line number Diff line number Diff line change 1919use PhpParser \Node \ArrayItem ;
2020use Rector \PhpParser \Node \Value \ValueResolver ;
2121use Rector \Rector \AbstractRector ;
22+ use Symplify \RuleDocGenerator \Contract \DocumentedRuleInterface ;
2223use Symplify \RuleDocGenerator \Exception \PoorDocumentationException ;
2324use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
2425use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
2526
2627/**
2728 * @internal
2829 */
29- final class AddSoarOptionsDocCommentRector extends AbstractRector
30+ final class AddSoarOptionsDocCommentRector extends AbstractRector implements DocumentedRuleInterface
3031{
3132 public function __construct (
3233 private readonly ValueResolver $ valueResolver
Original file line number Diff line number Diff line change 2020use PhpParser \Node \Scalar \Int_ ;
2121use Rector \PhpParser \Node \Value \ValueResolver ;
2222use Rector \Rector \AbstractRector ;
23+ use Symplify \RuleDocGenerator \Contract \DocumentedRuleInterface ;
2324use Symplify \RuleDocGenerator \Exception \PoorDocumentationException ;
2425use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
2526use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
2627
2728/**
2829 * @internal
2930 */
30- final class SimplifyListIndexRector extends AbstractRector
31+ final class SimplifyListIndexRector extends AbstractRector implements DocumentedRuleInterface
3132{
3233 public function __construct (
3334 private readonly ValueResolver $ valueResolver
Original file line number Diff line number Diff line change 1+ # 3 Rules Overview
2+
3+ ## AddHasOptionsDocCommentRector
4+
5+ Add has options doc comment
6+
7+ - class: [ ` Guanguans\SoarPHP\Support\Rectors\AddHasOptionsDocCommentRector ` ] ( AddHasOptionsDocCommentRector.php )
8+
9+ ``` diff
10+ + /**
11+ + * @method \Guanguans\SoarPHP\Soar exceptVerbose() // Verbose
12+ + * @method \Guanguans\SoarPHP\Soar exceptVersion() // Print version info
13+ + * @method \Guanguans\SoarPHP\Soar exceptHelp() // Help
14+ + *
15+ + * @mixin \Guanguans\SoarPHP\Soar
16+ + */
17+ trait HasOptions
18+ {
19+ }
20+ ```
21+
22+ <br >
23+
24+ ## AddSoarOptionsDocCommentRector
25+
26+ Add soar options doc comment
27+
28+ - class: [ ` Guanguans\SoarPHP\Support\Rectors\AddSoarOptionsDocCommentRector ` ] ( AddSoarOptionsDocCommentRector.php )
29+
30+ ``` diff
31+ return [
32+ + // AllowCharsets (default "utf8,utf8mb4")
33+ '-allow-charsets' => [
34+ 0 => 'utf8',
35+ 1 => 'utf8mb4',
36+ ],
37+ +
38+ + // AllowCollates
39+ '-allow-collates' => [
40+ ],
41+ +
42+ + // AllowDropIndex, 允许输出删除重复索引的建议
43+ '-allow-drop-index' => false,
44+ ];
45+ ```
46+
47+ <br >
48+
49+ ## SimplifyListIndexRector
50+
51+ Simplify list index
52+
53+ - class: [ ` Guanguans\SoarPHP\Support\Rectors\SimplifyListIndexRector ` ] ( SimplifyListIndexRector.php )
54+
55+ ``` diff
56+ [
57+ - 0 => 'delimiter',
58+ - 1 => 'orderbynull',
59+ - 2 => 'groupbyconst',
60+ + 'delimiter',
61+ + 'orderbynull',
62+ + 'groupbyconst',
63+ ]
64+ ```
65+
66+ <br >
Original file line number Diff line number Diff line change 3030 ->beforeEach (function (): void {})
3131 ->afterEach (function (): void {})
3232 ->afterAll (function (): void {})
33- ->in (__DIR__ , __DIR__ .'/Feature ' , __DIR__ .'/Unit ' );
33+ ->in (
34+ __DIR__ ,
35+ __DIR__ .'/Arch/ ' ,
36+ __DIR__ .'/Feature/ ' ,
37+ __DIR__ .'/Integration/ ' ,
38+ __DIR__ .'/Unit/ '
39+ );
3440/*
3541|--------------------------------------------------------------------------
3642| Expectations
Original file line number Diff line number Diff line change 1+ {
2+ "require-dev" : {
3+ "symplify/rule-doc-generator" : " ^12.2"
4+ }
5+ }
You can’t perform that action at this time.
0 commit comments