-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support PHPStan 2.0 #144
base: main
Are you sure you want to change the base?
Support PHPStan 2.0 #144
Conversation
I thought I needed a |
9dce5c1
to
c823f54
Compare
/** | ||
* @param FileNode $node | ||
* @return string[] | ||
*/ | ||
public function processNode(Node $node, Scope $scope): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @param
should remain, so IDE can fill the methods on $node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that doesn't make sense for an IDE that supports generics, but let's restore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why: #144 (review)
e66aa45
to
7986458
Compare
I have to hurry up and catch a long-distance bus now, but I've finished what I can do. |
use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface; | ||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; | ||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; | ||
|
||
/** | ||
* @implements <FileNode> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The autocompletion does not work because this should say @implements Rule<FileNode>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -17,7 +17,7 @@ | |||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; | |||
|
|||
/** | |||
* @implements <FileNode> | |||
* @implements Node<FileNode> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be Rule<FileNode>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Running PHPStan on the code will report that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
"symplify/rule-doc-generator": "^12.2", | ||
"phpunit/phpunit": "^10.5", | ||
"symfony/framework-bundle": "6.1.*", | ||
"rector/rector": "^1.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you use
"rector/rector": "dev-main as 1.2.10",
to test rector for CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applied it to f83aafa
4678d29
to
e9c6e15
Compare
.github/workflows/code_analysis.yaml
Outdated
@@ -22,6 +22,7 @@ jobs: | |||
|
|||
- | |||
name: 'Rector' | |||
if: ${{ false }} # Temporarily disabled as it is not compatible with PHPStan 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you revert this, rector should run now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -69,7 +67,7 @@ public function processNode(Node $node, Scope $scope): array | |||
return []; | |||
} | |||
|
|||
return [self::ERROR_MESSAGE]; | |||
return [RuleErrorBuilder::message(self::ERROR_MESSAGE)->build()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add identifier here as well
@@ -53,7 +50,7 @@ public function processNode(Node $node, Scope $scope): array | |||
return []; | |||
} | |||
|
|||
return [self::ERROR_MESSAGE]; | |||
return [RuleErrorBuilder::message(self::ERROR_MESSAGE)->build()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add identifier here as well
@@ -132,7 +131,7 @@ private function processClassNameAndShort(ClassReflection $classReflection): arr | |||
} | |||
|
|||
$errorMessage = sprintf(self::ERROR_MESSAGE, $expectedSuffix); | |||
return [$errorMessage]; | |||
return [RuleErrorBuilder::message($errorMessage)->build()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add identifier here as well
@@ -58,7 +56,7 @@ public function processNode(Node $node, Scope $scope): array | |||
return []; | |||
} | |||
|
|||
return [self::ERROR_MESSAGE]; | |||
return [RuleErrorBuilder::message(self::ERROR_MESSAGE)->build()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add identifier here as well
@@ -74,6 +75,6 @@ public function processNode(Node $node, Scope $scope): array | |||
return []; | |||
} | |||
|
|||
return [self::ERROR_MESSAGE]; | |||
return [RuleErrorBuilder::message(self::ERROR_MESSAGE)->build()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add identifier here as well
@@ -77,6 +75,6 @@ public function processNode(Node $node, Scope $scope): array | |||
return []; | |||
} | |||
|
|||
return [self::ERROR_MESSAGE]; | |||
return [RuleErrorBuilder::message(self::ERROR_MESSAGE)->build()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add identifier here as well, basically, add unique identifier on message error
hey @zonuexe thanks for your current work! 💪 we are currently waiting for this extension to be compatible with PHPStan 2, so I want to offer my help 🙂 let me know, if I can somehow support here |
All packages that are not compatible with PHPStan 2.0 have been temporarily removed.
refs rectorphp/rector#8815