The 100 PHP classes that you have to know Here is the top 100 PHP classes : it is the list of the most often used PHP native classes. The classes are ranked in order of project frequency. In a corpus of 2500 OSS projects, the classes (and a few interfaces) were detected. They may […]
What does PHP mean ? So, PHP is an acronym, and its meaning has changed in time. There are more than expected usage of this name in various fields : this leads to funny situations where the word PHP has varying meaning. We collected them here. Official name PHP: Hypertext Preprocessor (Recursive acronym) Personal Home […]
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 […]
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). […]
Weekly reportekly The Weekly report is a special audit report. It sounds weird initially, to get a report per week, yet this is exactly what it does. Each week, a new report is built, based on a selection of different rules. And this is helps a lot with code quality! A different set every week […]
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 […]
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 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 […]
Move that foreach() inside the method Several PHP functions work with single or multiple values. For example, array_merge(), which merges several arrays into one. Or, isset(), which checks simultaneously the existence of several variables. str_replace() and preg_replace_callback() also come to mind. This is a good place to move that foreach() inside the method. This approach […]
PDFF : PHP Document File Format PDFF, or internally named PHP Document File Format, has been at the center of the development of Exakat since late 2021. It comes from a specific problem : describing dependencies, for the static analysis engine to understand and to take advantage of them, without auditing their source at the […]