Task #72785
closedTask #72292: PHP7 >= only
Add declare(strict_types=1); on every PHP file
0%
Description
I think we should add this to get better type error handling.
http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.strict
https://evertpot.com/strict-types-pollresults/
Updated by Mathias Brodala almost 9 years ago
Do we really need this in every file or in the access points (currently /index.php
, typo3/index.php
and typo3/cli_dispatch.phpsh
) only?
Updated by Mathias Brodala almost 9 years ago
Ah thanks, didn't know that the declaration of included files was respected in addition to the calling file.
Updated by Markus Klein over 8 years ago
There seems to be a contradiction in the docs.
http://php.net/manual/en/control-structures.declare.php
says:
The declare construct can also be used in the global scope, affecting all code following it (however if the file with declare was included then it does not affect the parent file)
So setting the declare() once in the entry script should actually force this for all included files as well.
Updated by Mathias Brodala over 8 years ago
Markus Klein wrote:
So setting the declare() once in the entry script should actually force this for all included files as well.
Thanks for confirming. :-)
Updated by Alexander Opitz over 8 years ago
- Status changed from On Hold to Resolved
New classes will get the declare statement.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed