1.2.438. Extends stdClass

Those classes extends stdClass.

Traditionally, classes are defined independently, without any native class extension.

In PHP 8.2, dynamic properties are deprecated, and yield a warning in the logs. Adding ‘extends `stdClass <https://www.php.net/stdclass>`_’ to classes signature removes this warning, as stdclass is the empty class, without any method, property nor constants.

<?php

class myClass extends \stdClass {
    function __set($a, $b) {
        $this->$a = $b;
    }
}

?>

1.2.438.1. Specs

Short name

Classes/ExtendsStdclass

Rulesets

All, Changed Behavior, CompatibilityPHP82, Inventory

Exakat since

2.3.2

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

stdclass, dynamic-property

Available in

Entreprise Edition, Exakat Cloud