make DeclareStrictTypesRector skip files without namespace, as very risky in files without PSR-4 autodiscovery#7585
Conversation
08c41db to
bcd485b
Compare
…isky in files without PSR-4 autodsicovery
bcd485b to
95c72aa
Compare
6a2a708 to
b65e5ba
Compare
b65e5ba to
61d2789
Compare
|
How can I automatically clean my files which do not have namespace to not use strict_types? Is there a rule which does that? |
|
What's the goal of that? |
|
You mentioned that using strict_types in files without namespace is risky. Running and older version of this package, it added strict_types everywhere, like in config files, public/index.php, helpers etc.. Is there a way to revert that automatically or do I have to manually check all files and remove strict_types in files without namespace? Maybe this rule should remove strict_types in files without namespace or create a new rule specifically for that purpose? |
|
I see. Maybe I'm trying to be too safe here :) Have you noticed any bugs during this application? What we can do is to have 2 rules, one for namespaced files (modern PHP 5.3+ approach) and one for non-namespaced files (configs and more free files where more vague types can appear). |
|
Everything is working fine in my app, I did not notice any problems because of that. |
This will improve rule usability, as will skip front-controller files, handy scripts and legacy codebases without PSR-4.
There strict types might not be a best way to apply at first. The rest of project would benefit though 👍