Skip to content

Commit

Permalink
version 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
christopheexakat committed Nov 14, 2023
1 parent e24af05 commit de8a3f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Reference/Rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59611,19 +59611,20 @@ _____
Recycled Variables
++++++++++++++++++

A recycled variable is used for two distinct missions in a method. There is usually a first
A recycled variable is a variable used for two distinct missions in a method. There is usually a first part, with its own initialization, then, later in the method, a second part with a new initialization and a distinct usage of the variable.

Recycled variables leads to confusion: with the new initialization, the variable changes its purpose. Yet, with the same name, and with a bit of lost context, it is easy to confuse it later.

.. code-block:: php

<?php

function foo() {
$variable = initial; // first initialisation
$variable = initial; // first initialisation
$variable = goo($variable); // processing the variable
hoo($variable); // sending the variable to a final destination

$variable = second ; // second initialisation
$variable = second ; // second initialisation
hoo2($variable); // sending the variable to a different final destination
}
?>
Expand Down Expand Up @@ -59658,7 +59659,7 @@ _____
+--------------+-------------------------------------------------------------------------------------------------------------------------+
| Precision | High |
+--------------+-------------------------------------------------------------------------------------------------------------------------+
| Features | variable |
| Features | variable, readability |
+--------------+-------------------------------------------------------------------------------------------------------------------------+
| Available in | `Entreprise Edition <https://www.exakat.io/entreprise-edition>`_, `Exakat Cloud <https://www.exakat.io/exakat-cloud/>`_ |
+--------------+-------------------------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -107582,6 +107583,7 @@ Exakat links each rules to PHP features.

+ :ref:`Collect Readability <collect-readability>`
+ :ref:`Preprocessable <preprocessable>`
+ :ref:`Recycled Variables <recycled-variables>`

+ Readonly

Expand Down

0 comments on commit de8a3f8

Please sign in to comment.