Skip to content

Commit 8d70cb7

Browse files
authored
Merge pull request #7 from rectorphp/next-2
misc
2 parents 671918b + 780f419 commit 8d70cb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+363
-265
lines changed

README.md

Lines changed: 193 additions & 96 deletions
Large diffs are not rendered by default.

bin/dump-nodes.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use PhpParser\PrettyPrinter\Standard;
6-
use Rector\PhpParserNodesDocs\Finder\PhpFilesFinder;
75
use Rector\PhpParserNodesDocs\NodeCodeSampleProvider;
86
use Rector\PhpParserNodesDocs\NodeInfosFactory;
97
use Rector\PhpParserNodesDocs\Printer\MarkdownNodeInfosPrinter;
@@ -12,17 +10,15 @@
1210
require_once __DIR__ . '/../vendor/autoload.php';
1311

1412
$markdownNodeInfosPrinter = new MarkdownNodeInfosPrinter();
15-
$nodeInfosFactory = new NodeInfosFactory(
16-
new NodeCodeSampleProvider(new Standard(), new PhpFilesFinder()),
17-
new NodeInfoSorter()
18-
);
13+
14+
$nodeInfosFactory = new NodeInfosFactory(new NodeCodeSampleProvider(), new NodeInfoSorter());
1915

2016
$nodeInfos = $nodeInfosFactory->create();
2117
$printedContent = $markdownNodeInfosPrinter->print($nodeInfos);
2218

2319
file_put_contents(getcwd() . '/README.md', $printedContent);
2420

25-
echo sprintf('<info>Documentation for %d nodes was generated to README.md</info>' . PHP_EOL, count($nodeInfos));
21+
echo sprintf('Documentation for %d nodes was generated to README.md' . PHP_EOL . PHP_EOL, count($nodeInfos));
2622

2723
// success
2824
exit(0);

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"require": {
1010
"php": "^8.3",
1111
"nikic/php-parser": "^5.6",
12-
"webmozart/assert": "^1.11"
12+
"webmozart/assert": "^1.11",
13+
"symfony/finder": "^7.3"
1314
},
1415
"require-dev": {
1516
"symplify/easy-coding-standard": "^12.6",

ecs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
__DIR__ . '/bin',
1010
__DIR__ . '/src',
1111
__DIR__ . '/tests',
12+
__DIR__ . '/snippet'
1213
])
1314
->withPreparedSets(symplify: true, common: true, psr12: true);

phpstan.neon

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ parameters:
55
- bin
66
- src
77
- tests
8+
- snippet
89

910
treatPhpDocTypesAsCertain: false
10-
11-
ignoreErrors:
12-
-
13-
path: src/Finder/PhpFilesFinder.php
14-
identifier: varTag.nativeType

rector.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66
use Rector\Config\RectorConfig;
77
use Rector\Set\ValueObject\LevelSetList;
88

9-
return static function (RectorConfig $rectorConfig): void {
10-
$rectorConfig->importNames();
11-
12-
$rectorConfig->paths([
9+
return RectorConfig::configure()
10+
->withImportNames()
11+
->withPaths([
12+
__DIR__ . '/snippet',
1313
__DIR__ . '/src',
1414
__DIR__ . '/tests',
15-
]);
16-
17-
$rectorConfig->sets([
18-
LevelSetList::UP_TO_PHP_81
19-
]);
20-
};
15+
])
16+
->withPhpSets();

snippet/alias.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5+
use PhpParser\Modifiers;
56
use PhpParser\Node\Name\FullyQualified;
6-
use PhpParser\Node\Stmt\Class_;
77
use PhpParser\Node\Stmt\TraitUseAdaptation\Alias;
88

99
$traitFullyQualified = new FullyQualified('TraitName');
1010

11-
return new Alias($traitFullyQualified, 'method', Class_::MODIFIER_PUBLIC, 'aliasedMethod');
11+
return new Alias($traitFullyQualified, 'method', Modifiers::PUBLIC, 'aliasedMethod');

snippet/array_dim_fetch.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use PhpParser\Node\Expr\ArrayDimFetch;
66
use PhpParser\Node\Expr\Variable;
7-
use PhpParser\Node\Scalar\LNumber;
7+
use PhpParser\Node\Scalar\Int_;
88

99
$variable = new Variable('variableName');
10-
$dimension = new LNumber(0);
10+
$dimension = new Int_(0);
1111

1212
return new ArrayDimFetch($variable, $dimension);

snippet/assign_op/assign_op_coalesce.php

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

55
use PhpParser\Node\Expr\AssignOp\Coalesce;
6-
use PhpParser\Node\Scalar\LNumber;
6+
use PhpParser\Node\Scalar\Int_;
77

8-
$left = new LNumber(5);
9-
$right = new LNumber(10);
8+
$left = new Int_(5);
9+
$right = new Int_(10);
1010

1111
return new Coalesce($left, $right);

snippet/assign_op/assign_op_concat.php

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

55
use PhpParser\Node\Expr\AssignOp\Concat;
6-
use PhpParser\Node\Scalar\LNumber;
6+
use PhpParser\Node\Scalar\Int_;
77

8-
$left = new LNumber(5);
9-
$right = new LNumber(10);
8+
$left = new Int_(5);
9+
$right = new Int_(10);
1010

1111
return new Concat($left, $right);

0 commit comments

Comments
 (0)