Hi David, Robert, wt., 18 cze 2024 o 23:12 David Gebler <davidgeb...@gmail.com> napisał(a):
> ... > If I were to support any change to how this feature works for PHP 9, I > think it would be providing a mechanism to enable it for all files at once, > maybe either via a .ini setting such as strict_types_default=1 or a new > declare which applies to all files included or autoloaded from that point > on, i.e. a declare that could be used as the first line of an entrypoint > script to make all files in a project have strict typing mode > enabled/disabled (unless a particular file overrides for its own scope with > its own declare). > > Changing the name to anything other than what it is now, with or without > flipping the value, just seems like a major BC headache for no gain. > I share a similar opinion here. I'd also rather see a proposal that enables setting the declares outside of PHP files as this is mostly the same line for every file in most codebases I work with. # name it `.phpdeclare` in the execution directory or places where certain PHP files are read by the PHP interpreter, whatever ```ini # Global default directives [*.php] strict_types = 1 ticks = 0 encoding = UTF-8 # Directives for specific directories [src/*.php] strict_types = 1 [tests/*.php] strict_types = 0 # Directives for specific files [scripts/setup.php] strict_types = 1 ticks = 1 ``` Just an example, shoving some declares can be set using glob-like patterns or specific files. I see potential in this kind of declaring these directives for future extensions. This is something I'd love to consider instead of just renaming things we already have. Cheers, Michał Marcin Brzuchalski