-
-
Notifications
You must be signed in to change notification settings - Fork 473
Enable strict types #1983
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
Enable strict types #1983
Conversation
|
Does it at least reduce phpstan errors? I'm not much of a fan of this change, as it conflicts with Symfony CS and doesn't really bring us much. On the other hand it makes code more brittle and gives us more work of having to juggle things between types, while PHP could automatically for us. |
|
It does not reduce PHPStan errors, even at max level.
OK, but so what? This repository is in the doctrine organization and is checked with PHPCodeSniffer, using the Doctrine coding standard. I don't think we should strive to be close to Symfony CS here, which full disclosure, I don't like for several reasons.
The only thing I've had to change is to do some string casts. Benefiting from PHP automatic type casts is something I think is OK in a project, but in a library, I think it's more important to avoid silly type errors, even if it means slightly more ugly code. Finally since it's in our standard, that's what we do in all our other projects, including other Symfony bundles like the migrations or fixtures bundle. I don't see why this bundle should get a special treatment. |
ostrolucky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this, because I don't think it's worth it to make a fuss about such change. I am not a fan personally but at the same time it's not such a big deal that I want to block this. However, I want to remind certain things:
- This is a major symfony bundle. It's sitting between symfony and doctrine. Even supported PHP versions are mirrored to what Symfony LTS supports. Compromises from both sides are important here. It's not like you implied that repo is in doctrine organization so we do whatever doctrine wants. By the way this is why I didn't want to eagerly start 3.x branch. There are dependencies in Symfony to things we deprecated long time ago (eg.
%.classparams) that we cannot drop before Symfony stops using them. Such change is unlikely to happen in Symfony LTS and we need to support it. So it will take years until we can release 3.x (so that we can continue supporting LTS), unless we maintain both 2.x and 3.x like last time, which I would really like to avoid. On the other hand, maybe existence of 3.x having those things removed will push Symfony to stop using them? - This is a risky change and our CI is not perfect, like we saw in #1968. Whole point of strict types is that it will blow up more often than non-strict.
Ok, so either we drop support for 6.4 on 3.x, or we keep the |
|
Then the target branch is supposed to be |
|
🤔 no… I mean, there is no breaking change here, is there?
(from https://www.php.net/manual/en/language.types.declarations.php) |
Set branchname for versions without tags
It does something that is already achieved by the following
configuration:
<php>
<env name="DOCTRINE_DEPRECATIONS" value="trigger"/>
</php>
Migrate to attributes for PHPUnit
Remove bootstrap file
It is in our coding standard, and doing so is not a breaking change.
0dd6f9f to
40bc4bd
Compare
It is in our coding standard, and doing so is not a breaking change.