PHP

PHP

Made by DeepSource

Unknown magic method detected PHP-W1081

Bug risk
Major

Defined magic method doesn't match any of the PHP's built-in magic methods. Visit this link to view the list of all the allowed magic methods.

Magic methods are special methods which override PHP's default's action when certain actions are performed on an object. In case of any unknown magic method it will have no effect. This can mostly happen because of human errors. Therefore, it is recommended to make sure there are no typos in the magic methods.

Bad practice

class User
{
    // "__constrct" is misspelled, thus it will have no effect
    public function __constrct()
    {
    }
}

Recommended

class User
{
    public function __construct()
    {
    }
}

References