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

Use stricter PHPStan checking for better coverage. #17448

Merged
merged 4 commits into from Jan 13, 2024
Merged

Conversation

dereuromark
Copy link
Member

@dereuromark dereuromark commented Nov 24, 2023

Completes protection discussed and finalized in #17443 etc

I wonder how we can make PHPStan in CI work with this, though
Since we are using this split off task

I still think we should undo that and move CI validation back here directly, it would also help with #17439
There is no need in trying to keep this too agnostic IMO

@dereuromark dereuromark added testing github_actions Pull requests that update GitHub Actions code labels Nov 24, 2023
@dereuromark dereuromark added this to the 5.0.3 milestone Nov 24, 2023
composer.json Outdated
@@ -130,7 +131,7 @@
"phpstan-tests": "tools/phpstan analyze -c tests/phpstan.neon",
"phpstan-baseline": "tools/phpstan --generate-baseline",
"psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
"stan-setup": "phive install",
"stan-setup": "phive install && cp composer.json composer.backup && composer require --dev phpstan/extension-installer symplify/phpstan-rules && mv composer.backup composer.json",
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't these be standard dev deps? Having untracked changes sitting around isn't great.

Copy link
Member Author

Choose a reason for hiding this comment

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

They could, if PHPStan would also already be IMO.
But as it is, phive is installing that one.
We could split it sure, not sure if that works, as those might be dependant on it.

"require": {
        ...
        "phpstan/phpstan": "^1.10.30",

Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if phive would be able to install those, too.

Copy link
Member Author

Choose a reason for hiding this comment

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

See also https://github.com/phar-io/phar.io/issues/142#issuecomment-1826863632
Sounds more like we should remove that part from phive for now then.

@dereuromark
Copy link
Member Author

dereuromark commented Nov 26, 2023

This should work once we set the config here

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

It now also runs the other validation tasks only once, in the stan run
instead of each matrix element.

@markstory markstory modified the milestones: 5.0.3, 5.0.4 Nov 28, 2023
Comment on lines +65 to +67
"phpstan/phpstan": "^1.10.30",
"phpstan/extension-installer": "^1.3",
"symplify/phpstan-rules": "^12.4",
Copy link
Member

Choose a reason for hiding this comment

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

How much does this ruin your day @ADmad?

Copy link
Member

Choose a reason for hiding this comment

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

I am not thrilled about it, but since @dereuromark has ideas on how to streamline/automate our CI tasks I don't want to hold back the changes.

I'll let you guys be the judge on whether the simplyfy/phpstan-rules rules bring enough value to warrant this change.

@dereuromark Do you plan to install phpstan through composer for other repos too or just this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now the idea was only for this repo.
If you want to do that for others too in order to have it in general more available without 2nd install command, that is sure something we could do and would make it easier again to have a common install script.

For now the splitoff of core sounds warranted though, as there are more special needs for validation here, then for others like "just" plugins.

Copy link
Contributor

@LordSimal LordSimal Dec 5, 2023

Choose a reason for hiding this comment

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

if we don't want to bloat our dev dependencies we could create a separate composer-test.json and set a enviromment variable to let composer know to use that one instead of the default one.
https://getcomposer.org/doc/03-cli.md#composer

As far as I can tell phive doesn't allow phpstan extensions (unfortunately...)

Copy link
Member Author

Choose a reason for hiding this comment

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

I wouldnt want to duplicate the dependencies across those files.
I think it should be fair enough for now to have those extra ones in dev, they dont leak into any dependant repo.

@markstory markstory modified the milestones: 5.0.4, 5.0.5 Dec 28, 2023
@dereuromark
Copy link
Member Author

Can we move forward with this?

@dereuromark
Copy link
Member Author

We still would need the github token to be added

@dereuromark
Copy link
Member Author

With https://github.com/phpstan/phpstan/releases/tag/1.10.54 being released this would now be fully mergeable again.
It would also upgrade PHPStan again to latest version.

cc @markstory

@markstory markstory merged commit 86e42ad into 5.x Jan 13, 2024
8 of 11 checks passed
@markstory markstory deleted the phpstan-strict branch January 13, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants