1.2.240. Constructors

Mark methods as constructors.

<?php

class x {
    // Normal constructor
    function __construct() {}
}

class y {
    // Old style constructor, obsolete since PHP 7.1
    function y() {}
}

class z {
    // Normal constructor
    function __construct() {}

    // Old style constructor, but with lower priority
    function z() {}
}

?>

See also Constructors and Destructors.

1.2.240.1. Specs

Short name

Classes/Constructor

Rulesets

All

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

class, constructor

Available in

Entreprise Edition, Exakat Cloud