.. _classes-couldbefinal:
.. _class-could-be-final:
Class Could Be Final
++++++++++++++++++++
Any class that has no extension should be ``final`` by default.
As stated by ``Matthias Noback`` : ``If a class is not marked final, it has at least one subclass``.
Prevent the classes from being subclassed by making them ``final``. Sometimes, classes are not meant or thought to be derivable.
.. code-block:: php
See also `Negative architecture, and assumptions about code `_ and `When to declare methods final `_.
Connex PHP features
-------------------
+ `final `_
Suggestions
___________
* Make the class final
* Extends the class
Specs
_____
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Short name | Classes/CouldBeFinal |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior `, :ref:`Class Review ` |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Exakat since | 1.4.3 |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| PHP Version | All |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Severity | Minor |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Time To Fix | Quick (30 mins) |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Precision | Very high |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Available in | `Entreprise Edition `_, `Exakat Cloud `_ |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+