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

TASK: Migrate to PHPStan for Flow 8 #3218

Merged
merged 10 commits into from
Nov 7, 2023
Merged

TASK: Migrate to PHPStan for Flow 8 #3218

merged 10 commits into from
Nov 7, 2023

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Nov 5, 2023

This is a backport of #3216

Adds PHPStan level 1 to the whole Flow code base and CI.
Psalm was removed.

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked wit !!! and have upgrade-instructions

@github-actions github-actions bot added the 8.0 label Nov 5, 2023
@mhsdesign mhsdesign force-pushed the task/addPhpStanFlow8 branch 3 times, most recently from 8e188c4 to 0e6568a Compare November 5, 2023 15:19
@mhsdesign
Copy link
Member Author

We would need to adjust https://github.com/neos/flow-development-distribution to provide phpstan

@mhsdesign mhsdesign marked this pull request as ready for review November 5, 2023 21:20
@mhsdesign mhsdesign changed the title Task/add php stan flow8 Task: migrate to phpstan (Flow 8) Nov 5, 2023
@github-actions github-actions bot added the Task label Nov 5, 2023
@mhsdesign mhsdesign force-pushed the task/addPhpStanFlow8 branch 2 times, most recently from e6c795c to 3e1ba73 Compare November 6, 2023 18:56
Copy link
Member Author

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

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

.

@kdambekalns kdambekalns changed the title Task: migrate to phpstan (Flow 8) TASK: migrate to phpstan (Flow 8) Nov 7, 2023
@kdambekalns kdambekalns changed the title TASK: migrate to phpstan (Flow 8) TASK: Migrate to PHPStan for Flow 8 Nov 7, 2023
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

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

Mostly comments, but one real change request for the ResourceCommandController

@mhsdesign mhsdesign force-pushed the task/addPhpStanFlow8 branch 2 times, most recently from 536cccc to 49ab156 Compare November 7, 2023 09:10
Copy link
Member

@kitsunet kitsunet left a comment

Choose a reason for hiding this comment

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

I think I am fine with this overall for now, thanks for putting the work in!

Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

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

Yeah, why not.

@kdambekalns
Copy link
Member

… but fix the PHPStan complaints first. 🤣

…uctor

... as flows proxy building doesnt like it when on multiple level of inheritance:

Cannot override final method Neos\Flow\Security\Authentication\Provider\AbstractProvider::__construct() in /home/runner/work/flow-development-collection/flow-development-collection/flow-development-distribution/Data/Temporary/Testing/Cache/Code/Flow_Object_Classes/Neos_Flow_Security_Authentication_Provider_TestingProvider.php on line 130

see also https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
The method `buildMethodParametersCode` does not exist and most likely `$proxyMethod->buildMethodParametersCode` is meant.

> This dates back to Andi and I believe the solution is as simple as this being
> $proxyMethod->setMethodParametersCode($proxyMethod->buildMethodParametersCode($declaringClassName, $methodName, true));

> Which becomes even clearer looking at the sibling code in AdvicedMethodInterceptorBuilder where it is like I suggested

#3218 (comment)
@mhsdesign
Copy link
Member Author

Thank you for your quick reviews ❤️

@mhsdesign mhsdesign merged commit 6b52a48 into 8.0 Nov 7, 2023
9 checks passed
@mhsdesign mhsdesign deleted the task/addPhpStanFlow8 branch November 7, 2023 11:40
mhsdesign added a commit that referenced this pull request Nov 7, 2023
- fix types where neos depends on it (by correcting types and adding `never`)

- adjust unit test as `never` cannot be doubled
eventually this will be fixed via: sebastianbergmann/phpunit#5048

- fix ci and style as neos 9 followup for #3218
mhsdesign added a commit that referenced this pull request Nov 7, 2023
With #3218 PHPStan level 1 was added to the whole Flow code base and CI for Flow 8. This upmerged change needs some adjustments to pass the CI in Flow 9

- fix types and remove deprecated code
- fix types where neos depends on it (by correcting types and adding `never`)
- adjust unit test as `never` cannot be doubled (eventually this will be fixed via: sebastianbergmann/phpunit#5048)
- fix ci and style as neos 9 followup for #3218
neos-bot pushed a commit to neos/flow that referenced this pull request Nov 7, 2023
The method `buildMethodParametersCode` does not exist and most likely `$proxyMethod->buildMethodParametersCode` is meant.

> This dates back to Andi and I believe the solution is as simple as this being
> $proxyMethod->setMethodParametersCode($proxyMethod->buildMethodParametersCode($declaringClassName, $methodName, true));

> Which becomes even clearer looking at the sibling code in AdvicedMethodInterceptorBuilder where it is like I suggested

neos/flow-development-collection#3218 (comment)
neos-bot pushed a commit to neos/cache that referenced this pull request Nov 8, 2023
With neos/flow-development-collection#3218 PHPStan level 1 was added to the whole Flow code base and CI for Flow 8. This upmerged change needs some adjustments to pass the CI in Flow 9

- fix types and remove deprecated code
- fix types where neos depends on it (by correcting types and adding `never`)
- adjust unit test as `never` cannot be doubled (eventually this will be fixed via: sebastianbergmann/phpunit#5048)
- fix ci and style as neos 9 followup for neos/flow-development-collection#3218
neos-bot pushed a commit to neos/eel that referenced this pull request Nov 8, 2023
With neos/flow-development-collection#3218 PHPStan level 1 was added to the whole Flow code base and CI for Flow 8. This upmerged change needs some adjustments to pass the CI in Flow 9

- fix types and remove deprecated code
- fix types where neos depends on it (by correcting types and adding `never`)
- adjust unit test as `never` cannot be doubled (eventually this will be fixed via: sebastianbergmann/phpunit#5048)
- fix ci and style as neos 9 followup for neos/flow-development-collection#3218
neos-bot pushed a commit to neos/flow that referenced this pull request Nov 8, 2023
With neos/flow-development-collection#3218 PHPStan level 1 was added to the whole Flow code base and CI for Flow 8. This upmerged change needs some adjustments to pass the CI in Flow 9

- fix types and remove deprecated code
- fix types where neos depends on it (by correcting types and adding `never`)
- adjust unit test as `never` cannot be doubled (eventually this will be fixed via: sebastianbergmann/phpunit#5048)
- fix ci and style as neos 9 followup for neos/flow-development-collection#3218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants