1.2.316. Create Magic Property

This command creates a link DEFINITION between a __get and __set calls, and its equivalent magic method.

It also adds links between __invoke and __toString in adapted situations. This command may not detect all possible link for the __get and __set call. It may be missing information about the nature of the object.

<?php

class x {
    function foo() {
        // This is linked to __set
        $this->a = 1;

        // This is linked to __get
        return $this->b;
    }

    function __get($name) {
        return 1;
    }

    function __set($name, $value) {
        // Store the value
    }
}

?>

1.2.316.1. Specs

Short name

Complete/CreateMagicProperty

Rulesets

All, CE, Changed Behavior, NoDoc

Exakat since

1.9.2

PHP Version

All

Severity

Time To Fix

Precision

High

Features

magic-property

Available in

Entreprise Edition, Community Edition, Exakat Cloud