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

Cover specs with PHPStan #10059

Merged
merged 6 commits into from
Jan 2, 2019
Merged

Cover specs with PHPStan #10059

merged 6 commits into from
Jan 2, 2019

Conversation

pamil
Copy link
Contributor

@pamil pamil commented Dec 31, 2018

Q A
Branch? 1.2
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets -
License MIT

Tried to add proget-hq/phpstan-phpspec to our PHPStan but ended up reporting proget-hq/phpstan-phpspec#8 and covering our specs with PHPStan and some ignored errors.

This led me to find over ten specs which were not run due to class name/namespace/filename mismatches and some wrong Argument:: calls in specs.

@pamil pamil added Potential Bug Potential bugs or bugfixes, that needs to be reproduced. Maintenance CI configurations, READMEs, releases, etc. labels Dec 31, 2018
@pamil pamil requested a review from a team as a code owner December 31, 2018 13:19
@pamil pamil changed the title 1.2 phpstan phpspec Cover specs with PHPStan Dec 31, 2018
"spec\\Sylius\\Bundle\\TaxonomyBundle\\": "src/Sylius/Bundle/TaxonomyBundle/spec/",
"spec\\Sylius\\Bundle\\ThemeBundle\\": "src/Sylius/Bundle/ThemeBundle/spec/",
"spec\\Sylius\\Bundle\\UiBundle\\": "src/Sylius/Bundle/UiBundle/spec/",
"spec\\Sylius\\Bundle\\UserBundle\\": "src/Sylius/Bundle/UserBundle/spec/"
Copy link
Contributor

Choose a reason for hiding this comment

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

These repeated autoloads can be very hard to maintain and keep completed.

For monorepo and autoload-dev, the post autoload script might be sustainable solution: deprecated-packages/symplify@4d9ed30

Copy link
Contributor Author

@pamil pamil Jan 2, 2019

Choose a reason for hiding this comment

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

It looks like a pretty nice idea, but I think I prefer explicit configuration within composer.json to implicit one done by some PHP code which almost no one expects. Our list of components and bundles is quite stable, so maintenance won't be an issue here. Thanks for the heads up! :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure :)
Since it's monorepo and this removes the maintenance completely, I see the values in clear composer.json overrulling the lost explicitnes.

I got some feedback that monorepo autoloads are pretty WTF, compared to single psr-4 lines.

@pamil pamil merged commit 60d4175 into Sylius:1.2 Jan 2, 2019
@pamil pamil deleted the 1.2-phpstan-phpspec branch January 2, 2019 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance CI configurations, READMEs, releases, etc. Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants