Welcome Guest, Not a member yet? Register   Sign In
CI4 - Can now safely follow PHP 7.00 recommendations

(This post was last modified: 06-29-2020, 08:48 AM by John_Betong.)

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:


$file strrchr(__file__'/');

'file: ' .$file
OK, what do you expect, run it locally and see the result.

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 Smile

To enable this feature on your own system all that is necessary is to change the system path:

./app/Config/Paths.php -> public $systemDirectory = __DIR__ . '/../../system';

./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:
  $path   = ['app''public''system''writable'] ; 

Personally I think this feature should be added to the GitHub development version to follow the new PHP recommendations.

Theme © iAndrew 2016 - Forum software by © MyBB