CI4 - Can now safely follow PHP 7.00 recommendations |
I am delighted to say that the latest CI4 4.0.3 Development GitHub download is clear of all strict type restrictions and can now safely add declare(strict_types-1); to all PHP files.
Since PHP 7.0 was released **NOT** adding strict types to your development system is like having a five gear car and only using the first four gears. Try this simple test on your own computer to see the benefits: PHP Code: <?php Now enable the strict_type declaration and see the result. As you may notice PHP has enabled strict_types on all of the functions and this is your fifth gear ![]() To enable this feature on your own system all that is necessary is to change the system path: OLD: ./app/Config/Paths.php -> public $systemDirectory = __DIR__ . '/../../system'; NEW: ./app/Config/Paths.php -> public $systemDirectory = __DIR__ . '/../../system-strict'; All the system files require updating and also the app folder. Needless to say the two folders should be backed up before activating the following PHP file in folder above the root. Conversion script: The above conversion script is virtually instant on modifying over 400 files set at the start of the conversion script file: PHP Code: <?php DECLARE(STRICT_TYPES=1); Personally I think this feature should be added to the GitHub development version to follow the new PHP recommendations. |
Welcome Guest, Not a member yet? Register Sign In |