Skip to content

Commit 6d9c96d

Browse files
committed
[ci] add job to check laravel rector with latest dev-main build
1 parent 5a20573 commit 6d9c96d

File tree

8 files changed

+31
-226
lines changed

8 files changed

+31
-226
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Rector Laravel with dev-main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: null
8+
9+
env:
10+
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
11+
COMPOSER_ROOT_VERSION: "dev-main"
12+
13+
jobs:
14+
rector_laravel_rector_dev:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
-
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.3
22+
coverage: none
23+
24+
# fixes https://github.com/rectorphp/rector/pull/4559/checks?check_run_id=1359814403, see https://github.com/shivammathur/setup-php#composer-github-oauth
25+
env:
26+
COMPOSER_TOKEN: ${{ secrets.ACCESS_TOKEN }}
27+
28+
- run: git clone https://github.com/driftingly/rector-laravel.git
29+
- run: composer require rector/rector:dev-main --working-dir rector-laravel
30+
- run: cd rector-laravel && vendor/bin/phpunit
31+

phpstan.neon

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,6 @@ parameters:
401401

402402
# condition check, just to be sure
403403
- '#Method Rector\\Rector\\AbstractRector\:\:enterNode\(\) never returns 3 so it can be removed from the return type#'
404-
<<<<<<< HEAD
405-
406-
# special case, working on a file-level
407-
-
408-
identifier: rector.noOnlyNullReturnInRefactor
409-
path: rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php
410-
411-
# handle next with FileNode
412-
-
413-
identifier: method.parentMethodFinalByPhpDoc
414-
path: rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php
415404

416405
# deprecated
417406
-
@@ -426,6 +415,3 @@ parameters:
426415
- rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php
427416
- rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php
428417
- rules/Php81/Enum/AttributeName.php
429-
430-
=======
431-
>>>>>>> ddfef52951 (cleanup phpstan errors)

rules-tests/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector/Fixture/keep_magic_parent_called_method.php.inc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,12 @@
33
namespace Rector\Tests\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector\Fixture;
44

55
use PhpParser\PrettyPrinter\Standard;
6-
<<<<<<< HEAD
7-
=======
86
use Rector\PhpParser\Node\FileNode;
9-
>>>>>>> fb58990e39 (extract LaravelClassName)
107

118
final class KeepMagicParentCalledMethod extends Standard
129
{
1310
// called from parent by $this->{'p'} method
14-
<<<<<<< HEAD
15-
protected function pFileNode($fileNode)
16-
=======
1711
protected function pFileNode(FileNode $fileNode)
18-
>>>>>>> fb58990e39 (extract LaravelClassName)
1912
{
2013
}
2114
}

rules/CodingStyle/Rector/FunctionLike/FunctionLikeToFirstClassCallableRector.php

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -54,66 +54,12 @@ public function getNodeTypes(): array
5454
*/
5555
public function refactor(Node $node): null|CallLike
5656
{
57-
<<<<<<< HEAD
5857
throw new ShouldNotHappenException(sprintf(
5958
'"%s" rule is deprecated. It was split into "%s" and "%s" rules.',
6059
self::class,
6160
ClosureDelegatingCallToFirstClassCallableRector::class,
6261
ArrowFunctionDelegatingCallToFirstClassCallableRector::class
6362
));
64-
=======
65-
if ($node instanceof Assign) {
66-
// @todo handle by existing attribute already
67-
if ($node->expr instanceof Closure || $node->expr instanceof ArrowFunction) {
68-
$node->expr->setAttribute(self::IS_IN_ASSIGN, true);
69-
}
70-
71-
return null;
72-
}
73-
74-
if ($node instanceof CallLike) {
75-
if ($node->isFirstClassCallable()) {
76-
return null;
77-
}
78-
79-
$methodReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($node);
80-
foreach ($node->getArgs() as $arg) {
81-
if (! $arg->value instanceof Closure && ! $arg->value instanceof ArrowFunction) {
82-
continue;
83-
}
84-
85-
if ($methodReflection instanceof NativeFunctionReflection) {
86-
$parametersAcceptors = ParametersAcceptorSelector::combineAcceptors(
87-
$methodReflection->getVariants()
88-
);
89-
foreach ($parametersAcceptors->getParameters() as $extendedParameterReflection) {
90-
if ($extendedParameterReflection->getType() instanceof CallableType && $extendedParameterReflection->getType()->isVariadic()) {
91-
$arg->value->setAttribute(self::HAS_CALLBACK_SIGNATURE_MULTI_PARAMS, true);
92-
}
93-
}
94-
95-
return null;
96-
}
97-
98-
$arg->value->setAttribute(self::HAS_CALLBACK_SIGNATURE_MULTI_PARAMS, true);
99-
}
100-
101-
return null;
102-
}
103-
104-
$callLike = $this->extractCallLike($node);
105-
if ($callLike === null) {
106-
return null;
107-
}
108-
109-
if ($this->shouldSkip($node, $callLike, ScopeFetcher::fetch($node))) {
110-
return null;
111-
}
112-
113-
$callLike->args = [new VariadicPlaceholder()];
114-
115-
return $callLike;
116-
>>>>>>> 24ed2fa7ac (add fixture to keep protected method)
11763
}
11864

11965
public function provideMinPhpVersion(): int

rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ public function __construct(
3131
private readonly OverrideByParentClassGuard $overrideByParentClassGuard,
3232
private readonly BetterNodeFinder $betterNodeFinder,
3333
private readonly LaravelModelGuard $laravelModelGuard,
34-
<<<<<<< HEAD
3534
private readonly ParentClassMagicCallGuard $parentClassMagicCallGuard,
36-
=======
37-
private readonly \Rector\Privatization\VisibilityGuard\ParentClassMagicCallGuard $parentClassMagicCallGuard
38-
>>>>>>> 4263eff61e (skip parent magic called method in PrivatizeFinalClassMethodRector)
3935
) {
4036
}
4137

@@ -113,10 +109,6 @@ public function refactor(Node $node): ?Node
113109
continue;
114110
}
115111

116-
if ($this->parentClassMagicCallGuard->containsParentClassMagicCall($node)) {
117-
continue;
118-
}
119-
120112
if ($this->classMethodVisibilityGuard->isClassMethodVisibilityGuardedByTrait(
121113
$classMethod,
122114
$classReflection

rules/Privatization/VisibilityGuard/ParentClassMagicCallGuard.php

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

src/PhpParser/Printer/BetterStandardPrinter.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public function print(Node | array | null $node): string
9797
return $this->prettyPrint($node);
9898
}
9999

100-
<<<<<<< HEAD
101100
/**
102101
* @param Node[] $stmts
103102
*/
@@ -109,16 +108,6 @@ public function prettyPrintFile(array $stmts): string
109108
return parent::prettyPrintFile($stmts) . PHP_EOL;
110109
}
111110

112-
// /**
113-
// * @api magic method in parent
114-
// */
115-
// public function pFileWithoutNamespace(FileWithoutNamespace $fileWithoutNamespace): string
116-
// {
117-
// return $this->pStmts($fileWithoutNamespace->stmts);
118-
// }
119-
120-
=======
121-
>>>>>>> ddfef52951 (cleanup phpstan errors)
122111
protected function p(
123112
Node $node,
124113
int $precedence = self::MAX_PRECEDENCE,

src/Testing/TestingParser/TestingParser.php

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,7 @@ public function __construct(
2828

2929
public function parseFilePathToFile(string $filePath): File
3030
{
31-
<<<<<<< HEAD
32-
<<<<<<< HEAD
3331
[$file, $stmts] = $this->parseToFileAndStmts($filePath);
34-
<<<<<<< HEAD
35-
=======
36-
// needed for PHPStan reflection, as it caches the last processed file
37-
$this->dynamicSourceLocatorProvider->setFilePath($filePath);
38-
39-
$fileContent = FileSystem::read($filePath);
40-
$file = new File($filePath, $fileContent);
41-
$stmts = $this->rectorParser->parseString($fileContent);
42-
43-
// wrap in FileNode to enable file-level rules
44-
$stmts = [new FileNode($stmts)];
45-
46-
$stmts = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($filePath, $stmts);
47-
48-
$file->hydrateStmtsAndTokens($stmts, $stmts, []);
49-
$this->currentFileProvider->setFile($file);
50-
>>>>>>> 2751658832 (introduce FileNode to handle file-level changes; deprecate IncreaseDeclareStrictTypesRector)
51-
=======
52-
[$file, $stmts] = $this->parseToFileAndStmts($filePath);
53-
>>>>>>> 8e51776f69 (cleanup phpstan errors)
54-
55-
=======
56-
>>>>>>> 90002f8aee (extract LaravelClassName)
5732
return $file;
5833
}
5934

@@ -64,37 +39,10 @@ public function parseFileToDecoratedNodes(string $filePath): array
6439
{
6540
[$file, $stmts] = $this->parseToFileAndStmts($filePath);
6641
return $stmts;
67-
<<<<<<< HEAD
68-
<<<<<<< HEAD
6942
}
7043

7144
/**
7245
* @return array{0: File, 1: Node[]}
73-
=======
74-
//
75-
// // needed for PHPStan reflection, as it caches the last processed file
76-
// $this->dynamicSourceLocatorProvider->setFilePath($filePath);
77-
//
78-
// $fileContent = FileSystem::read($filePath);
79-
// $stmts = $this->rectorParser->parseString($fileContent);
80-
// $file = new File($filePath, $fileContent);
81-
//
82-
// // wrap in FileNode to enable file-level rules
83-
// $stmts = [new FileNode($stmts)];
84-
//
85-
// $stmts = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($filePath, $stmts);
86-
// $file->hydrateStmtsAndTokens($stmts, $stmts, []);
87-
//
88-
// $this->currentFileProvider->setFile($file);
89-
//
90-
// return $stmts;
91-
=======
92-
>>>>>>> 90002f8aee (extract LaravelClassName)
93-
}
94-
95-
/**
96-
* @return array{0: File, 1: Node\Stmt[]}
97-
>>>>>>> 8e51776f69 (cleanup phpstan errors)
9846
*/
9947
private function parseToFileAndStmts(string $filePath): array
10048
{
@@ -105,16 +53,8 @@ private function parseToFileAndStmts(string $filePath): array
10553
$file = new File($filePath, $fileContent);
10654
$stmts = $this->rectorParser->parseString($fileContent);
10755

108-
<<<<<<< HEAD
109-
$stmts = $this->rectorParser->parseString($fileContent);
110-
=======
11156
// wrap in FileNode to enable file-level rules
11257
$stmts = [new FileNode($stmts)];
113-
<<<<<<< HEAD
114-
115-
>>>>>>> 2751658832 (introduce FileNode to handle file-level changes; deprecate IncreaseDeclareStrictTypesRector)
116-
=======
117-
>>>>>>> 90002f8aee (extract LaravelClassName)
11858
$stmts = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($filePath, $stmts);
11959

12060
$file->hydrateStmtsAndTokens($stmts, $stmts, []);

0 commit comments

Comments
 (0)