Hi internals, Since we have declare(strict_types=1) I was thinking that it makes sense to have declare(strict_comparisons=1) that will enforce: - only strict comparisons with === and !==, == and != should throw a parse error - in_array(), array_search(), array_keys() and similar should by default have their $strict argument set to TRUE and should throw run time error if a FALSE argument is passed. I need to do some more research in regards what else is appropriate to be enforced in such mode but wanted to hear your thoughts first.
Additionally as there will be union types coming in PHP 8.0 (and we have property types in 7.4) I think now makes sense also to introduce declare(strict_declarations=1). This will enforce: - all parameters must have type as well the return values - all properties to have types too Also (not so important in my view) we could have declare(strict_classes=1) to prevent the declaration of new class properties during run time. This seems to be a source of mistakes because of mistyped property names. And lastly I would like to suggest to have declare(strict=1); which will be equivalent to the all four: - declare(strict_types=1); - declare(strict_comparisons=1); - declare(strict_declarations=1); - declare(strict_classes=1); This shorthand could include more strict modes in future if such are added - basically puts the engine in the strictest mode possible. And perhaps the following syntax looks better: declare( strict_types=1, strict_comparisons=1, strict_declarations=1, strict_classes=1, //support trailing comma too ); All of that of course for the next major version (PHP 8). Any comments are welcome. Thank you Vesko P.S. Please excuse me if this has been already discussed. In general Im following the internals discussions but may have missed something.