1.2.150. Clone Usage

This rule lists of all clone expressions. Cloning objects leads to creating a new object without calling the constructor, but rather the __clone method, when available.

<?php
    $dateTime = new DateTime();
    echo (clone $dateTime)->format('Y');
?>

See also Object cloning.

1.2.150.1. Connex PHP features

1.2.150.1.1. Specs

Short name

Classes/CloningUsage

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Available in

Entreprise Edition, Community Edition, Exakat Cloud