Replies: 1 comment 1 reply
-
Hi, thanks for your question. The prepared sets should include only safe path easy to integrate in the most projects. The reason is that strict types rule is excluded is that it can break existing code very easily. I haven't seen a project where it would not crash the code, even with 100 % type coverage. See: https://tomasvotruba.com/blog/how-adding-type-declarations-makes-your-code-dangerous It should be added explicitly and with caution. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I have just started to experiment with Rector and it seems fantasic: already applied to a few our projects starting with low-level and gradually moving up to max level.
I was wondering about one thing: I've read countless materials / articles about the benefit of using declare(strict_types=1) in all our PHP files.
As I checked what is included in the TypeDeclaration level, this rule seems to be missing. (https://github.com/rectorphp/rector-src/blob/main/src/Config/Level/TypeDeclarationLevel.php)
Is this by accident or there is a reasoning why this rule is not enforced from this level?
I know I can add it myself anytime, I am more interested about the 'WHY' - maybe it gives me a better picture why we might not need in our projects.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions