Skip to content

Commit 6b00adf

Browse files
committed
misc
1 parent 811b6b9 commit 6b00adf

File tree

11 files changed

+51
-130
lines changed

11 files changed

+51
-130
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ jobs:
1515

1616
-
1717
name: 'Bare Run'
18-
run: bin/console
18+
run: bin/dump-nodes.php
1919

2020
-
2121
name: 'ECS'
22-
run: composer check-cs
22+
run: vendor/bin/ecs
2323

2424
-
2525
name: 'PHPStan'
26-
run: composer phpstan
26+
run: vendor/bin/phpstan
2727

2828
name: ${{ matrix.actions.name }}
2929
runs-on: ubuntu-latest

bin/console

Lines changed: 0 additions & 4 deletions
This file was deleted.

bin/console.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

bin/dump-nodes.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpParser\PrettyPrinter\Standard;
6+
use Rector\PhpParserNodesDocs\Finder\PhpFilesFinder;
7+
use Rector\PhpParserNodesDocs\NodeCodeSampleProvider;
8+
use Rector\PhpParserNodesDocs\NodeInfosFactory;
9+
use Rector\PhpParserNodesDocs\Printer\MarkdownNodeInfosPrinter;
10+
use Rector\PhpParserNodesDocs\Sorter\NodeInfoSorter;
11+
12+
require_once __DIR__ . '/../vendor/autoload.php';
13+
14+
$markdownNodeInfosPrinter = new MarkdownNodeInfosPrinter();
15+
$nodeInfosFactory = new NodeInfosFactory(
16+
new NodeCodeSampleProvider(new Standard(), new PhpFilesFinder()),
17+
new NodeInfoSorter()
18+
);
19+
20+
$nodeInfos = $nodeInfosFactory->create();
21+
$printedContent = $markdownNodeInfosPrinter->print($nodeInfos);
22+
23+
file_put_contents(getcwd() . '/README.md', $printedContent);
24+
25+
echo sprintf('<info>Documentation for %d nodes was generated to README.md</info>' . PHP_EOL, count($nodeInfos));
26+
27+
// success
28+
exit(0);

composer.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
"bin/console.php"
88
],
99
"require": {
10-
"php": "^8.2",
11-
"symfony/console": "^6.4",
10+
"php": "^8.3",
1211
"nikic/php-parser": "^5.6",
13-
"illuminate/container": "^12.33",
1412
"webmozart/assert": "^1.11"
1513
},
1614
"require-dev": {
1715
"symplify/easy-coding-standard": "^12.6",
1816
"phpstan/phpstan": "^2.1",
19-
"phpunit/phpunit": "^11.5",
17+
"phpunit/phpunit": "^12.4",
2018
"rector/rector": "^2.2.2"
2119
},
2220
"autoload": {

ecs.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,11 @@
33
declare(strict_types=1);
44

55
use Symplify\EasyCodingStandard\Config\ECSConfig;
6-
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
76

87
return ECSConfig::configure()
9-
->with
10-
return static function (ECSConfig $ecsConfig): void {
11-
$ecsConfig->paths([
8+
->withPaths([
9+
__DIR__ . '/bin',
1210
__DIR__ . '/src',
1311
__DIR__ . '/tests',
14-
]);
15-
16-
$ecsConfig->sets([
17-
SetList::STRICT,
18-
SetList::COMMON,
19-
SetList::PSR_12,
20-
]);
21-
};
12+
])
13+
->withPreparedSets(symplify: true, common: true, psr12: true);

src/Command/DumpNodesCommand.php

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/DependencyInjection/ContainerFactory.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/NodeCodeSampleProvider.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ public function provide(): array
4141

4242
$printedContent = $this->standard->prettyPrint([$node]);
4343

44-
$nodeCodeSamplesByNodeClass[$nodeClass][] = new NodeCodeSample(
45-
$fileContents,
46-
$printedContent
47-
);
44+
$nodeCodeSamplesByNodeClass[$nodeClass][] = new NodeCodeSample($fileContents, $printedContent);
4845
}
4946

5047
ksort($nodeCodeSamplesByNodeClass);

src/Sorter/NodeInfoSorter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ final class NodeInfoSorter
1414
*/
1515
public function sortNodeInfosByClass(array $nodeInfos): array
1616
{
17-
usort($nodeInfos, fn (NodeInfo $firstNodeInfo, NodeInfo $secondNodeInfo): int => $firstNodeInfo->getClass() <=> $secondNodeInfo->getClass());
17+
usort(
18+
$nodeInfos,
19+
fn (NodeInfo $firstNodeInfo, NodeInfo $secondNodeInfo): int => $firstNodeInfo->getClass() <=> $secondNodeInfo->getClass()
20+
);
1821

1922
return $nodeInfos;
2023
}

0 commit comments

Comments
 (0)