Semantic typing Semantic typing is an old practice, where the name of the parameter would also tell what its type is. It is typing, because a $string is supposed to be typed, and it is semantic, because only the human reader is actually using the meaning : PHP doesn’t really care. The interesting part is […]
PHP 8.1 features, one year later Closing on one year after PHP 8.1 publication, we can take a look at the published features, and how they are doing in current code. Let’s take the list of ‘PHP Core’ from the New Features ¶. Project corpus We’ll use that against the Exakat corpus, with 2696 PHP […]
Unpacked, named and positional arguments are in a call… Argument spread is the three dots operator, when used with arguments. Its primary usage is simple : it stands in front of a variable, and turns an array into a list of arguments. Recently, while checking the PHP 8.1 migration guide, I realized that named arguments […]
Code inventories An inventory is the list of items in a container, and it is also the process to making such list. The inventory is meant to provide a complete view over available ressources. Translated to code, PHP or else, it is an auditing process that collects code structures of one type, for further analysis. […]
The 3 nothings of PHP Mathematicians have the concept of infinity, which represents something that cannot be topped. Strangely enough, infinities come in different sizes : some infinities are larger than others. That sounds quite paradoxical, yet somewhat understandable. On the other hand, PHPians, if we can say that, have three kinds of nothing. The […]
Let’s make PHP more abstract abstract is a conception keyword. It is decided during the conception phase that some classes and some methods uses the abstract keyword. Later, that keyword might disappear as needed, yet abstract never appears sponteanously. Nobody decides abstraction late in the coding phase. That seems to be a lack of practise […]
Adding the last types to PHP code Adding types to PHP code is a staple of any PHP code refactoring. With a code base crawling towards 10 years and over 2000 classes, Exakat is quite a consistent piece of software, with a lot of parameters, methods and properties. Covering everything with types was long, and, […]
PHP native attributes In PHP 8.0, PHP added attributes to its vast arsenal of features. Later, the first native attribute, aka, available in the core of PHP, appeared. Here they are, for quick reference. In PHP 8.2, there are 4 native attributes. Attribute ReturnTypeWillChange SensitiveParameter AllowDynamicProperties Attribute Attribute is the attribute to make a class […]
Using Exakat with Docker Exakat is available on docker, as community version. It is available at hub.docker.com. Here is how to use it. Installation docker is needed to run this tutorial. To install exakat, start docker, then run the following command in the terminal : git pull exakat/exakat:latest With a graphical interface, such as Docker […]
The 100 PHP functions that you have to know Here is the top 100 PHP functions : it is the list of the most often used PHP native functions. The functions are named, and ranked from 1 to 100. The other 4500 functions are not ranked here. The frequency column represents how often this function […]