Final, abstract and other family classes

abstract art

Final, abstract and other cousins Counting classes in an application How many classes are there in a PHP application? A simple count based on the class keyword gives a quick answer. Modern PHP application range from a dozen of units to a dozen of thousands. Yet, each class keyword doesn’t produce a concrete class. Inheritance […]

Weekly report for the week from 20-06-2022 to 26-06-2022

weekly report 28

Weekly report for the week from 20-06-2022 to 26-06-2022 These are the focus rules for this week : Unthrown Exception : List of exceptions that are defined in the code but never thrown. Undefined static:: Or self:: : The identified property or method are undefined. Use Constant : Some functioncalls have a constant equivalent, that […]

Weekly report for the week from June 13th, 2022 to Jun 19th, 2022

weekly report 28

Weekly report for the week from 13-06-2022 to 19-06-2022 These are the focus rules for this week : Unthrown Exception Undefined static:: Or self:: Use Constant Reuse Existing Variable Empty Classes       Weekly reports are a list of 5 reviews, shared across the community of Exakat users. They represent a reasonable amount of […]

When does PHP check for Fatal Error?

Study hard that code

Late, later and latest PHP checks PHP applies various checks when processing source code. When those checks fail, they might generate a Fatal errorand stop execution. They are the bane of production servers, and every PHP developper tries to avoid them as much as possible (unlike static code analyser authors which try to generate them). […]

Reviewing Property Declaration In PHP

Reviewing Property Declaration In PHP Properties are a foundation part of classes. They are declared with their visibility, and their name. Then, they might be augmented with a default value, a type (even several), and may be also options like static or readonly. With hierarchies and large families of classes, we shall start reviewing property […]

The very useful variadic argument

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 […]

Adoption of PHP 8 attributes in 2022

Adoption of PHP 8 attributes in 2022 PHP 8 introduced the attributes, in lieu of the phpdoc comments. They may be added to classes, methods, functions, parameters, properties and class constants and provide a PHP-way to write custom configurations. This is a great addition for the static analysis tools, and PHP in general. 18 months […]