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

Check fixtures with PHPStan #5026

Merged
merged 52 commits into from
Sep 22, 2023
Merged

Check fixtures with PHPStan #5026

merged 52 commits into from
Sep 22, 2023

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 16, 2023

as discussed in #5018 (comment)

@staabm
Copy link
Contributor Author

staabm commented Sep 16, 2023

is this what you had in mind?

composer.json Outdated Show resolved Hide resolved
@TomasVotruba
Copy link
Member

TomasVotruba commented Sep 19, 2023

On second looks, this might be useful 🙂

Could you fix the static errors and make PR pass?

@staabm
Copy link
Contributor Author

staabm commented Sep 19, 2023

On second looks, this might be useful 🙂

I think so, too. I just wanted to make sure we talk about the same errors.

should all test Fixtures/Sources have a namespace or do certain rules/tests exist which should not have a namespace?

Could you fix the static errors and make PR pass?

sure

@TomasVotruba
Copy link
Member

Only those that should exist. Some are missing namespace on purpose e.g. Should be clear from rule context:)

@staabm staabm marked this pull request as ready for review September 19, 2023 19:18
@staabm
Copy link
Contributor Author

staabm commented Sep 19, 2023

fixed a bunch of namespace errors. the only thing left is #5026 (comment)

Comment on lines 19 to 23
excludePaths:
- '*/Fixture/*'
- '*/RenameClassRector/*'
- '*/Source/phpstan.phar/*'
- '*/ImportFullyQualifiedNamesRector/*'
- '*/TagValueNodeReprint/*'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this list now includes those which I was not sure how/whether to resolve.

@staabm
Copy link
Contributor Author

staabm commented Sep 21, 2023

@TomasVotruba I think this one should be good to go now

@TomasVotruba
Copy link
Member

TomasVotruba commented Sep 21, 2023

Looks good, thanks 👍

The paths */Fixture/* should be fixed though, as that's main goal for this check.

@staabm
Copy link
Contributor Author

staabm commented Sep 21, 2023

would be great someone could look into the few remaining errors

//cc @samsonasik maybe?

@@ -1,6 +1,6 @@
<?php

namespace Rector\Comments\Tests\CommentRemover\Fixture;
// intentional without namespace
Copy link
Member

Choose a reason for hiding this comment

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

you can create a class/function and move the content inside a class to ensure no cache conflict phpstan for anonymous function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this test uses intentionally no namespace and therefore intentionally does not define a function or class, so it will not define stuff in the global namespace.

@staabm
Copy link
Contributor Author

staabm commented Sep 21, 2023

@TomasVotruba finally green. I think this is good enough for now.

@staabm
Copy link
Contributor Author

staabm commented Sep 22, 2023

@TomasVotruba @samsonasik would be great to get it merged, as it would easily conflict with other PRs which get merged in the meantime

@samsonasik samsonasik merged commit d9d1fd2 into rectorphp:main Sep 22, 2023
38 checks passed
@staabm staabm deleted the fixtures-stan branch September 22, 2023 15:28
@samsonasik
Copy link
Member

Thank you @staabm

@TomasVotruba
Copy link
Member

Thanks 👏

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