One less hidden bug with Enum

potato potato

One less hidden bug with Enum PHP 8.1 provides now enumerations, a.k.a. enums, as a native PHP construct. They provide a custom type with a limited set of values. Enumerations have been around in PHP in various forms, for a long time : check bensampo/laravel-enum, spatie/enum, marc-mabe/php-enum, eloquent/enumeration or even any framework (CakePHP-enums). Before that, […]

6 unicity traps that sideline PHP code

Thorny issues

6 unicity traps that sideline PHP code Sometimes, code is being ignored by PHP : code is painstakingly written but never gets executed. How is that even possible? May be, because it was not so painstakingly coded. Indeed, there are some PHP coding structures which natively and silently overwrites or ignore code. This leads to […]

Speeding up array_merge()

While doing a crowd review of naval battle code at @afup_rennes (in French), it appeared that the ‘no array_merge() in loops’ rule was known but not clear. Indeed, why is it that this function in particular, should be avoided in loops. Hence, this article, with a journey to memory management, coding and classic PHP features. […]

Fix inherited static variables in PHP 8.1

Configuring Exakat with Rules

Remove static variables One discreet update of PHP 8.1 is the upgrade of PHP static variables behavior in classes : Static variables in methods inheritance. Let’s review what are static variables in PHP, why they were problematic so far, and strategies to upgrade the code to remove this problem. PHP static variables While static properties […]

Installing Exakat to monitor several projects

Installing Exakat to monitor several projects Exakat is the smart Static analysis tool for PHP. It reviews the source for PHP compatibility (8.0, 8.1, 8.2 already, Security, and much more. When running it for several projects, it is convenient to use the ‘projects’ style of installation, more than the ‘in-code’ configuration. The ‘projects’ installation is […]

Prepare for PHP migration with Exakat

Prepare for PHP migration with Exakat Exakat detects compatibility issues in your code, for each minor PHP versions since PHP 5.3. It scans the source for function apparence or disappearance, new syntax and behaviors. init-project-done With a local docker system and access to your code, you can use the following command line to execute Exakat. […]