Skip to content
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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

zonuexe
Copy link

@zonuexe zonuexe commented Nov 13, 2024

All packages that are not compatible with PHPStan 2.0 have been temporarily removed.

refs rectorphp/rector#8815

@zonuexe zonuexe marked this pull request as draft November 13, 2024 07:42
@zonuexe
Copy link
Author

zonuexe commented Nov 13, 2024

I thought I needed a RuleErrorBuilderRector that works with PHPStan 1.x 😜

@zonuexe
Copy link
Author

zonuexe commented Nov 13, 2024

All tests pass in my environment.

スクリーンショット 2024-11-13 19 52 21

@zonuexe zonuexe marked this pull request as ready for review November 13, 2024 10:54
Comment on lines 43 to 45
/**
* @param FileNode $node
* @return string[]
*/
public function processNode(Node $node, Scope $scope): array
Copy link
Member

@TomasVotruba TomasVotruba Nov 13, 2024

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

Copy link
Author

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.

Copy link
Member

@TomasVotruba TomasVotruba Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My lattest PHPStorm still doesn't. What IDE do you use?


Without param type:

Screenshot from 2024-11-13 12-16-33

With param type:

Screenshot from 2024-11-13 12-17-43

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)

@zonuexe
Copy link
Author

zonuexe commented Nov 13, 2024

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>

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>.

Copy link
Author

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>

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>

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants