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