1.2.251. Could Be CIT

Mark arguments and return types that can be set to a class, interface definition.

<?php

// Accept an object as input
function foo($b) {
    // Returns new object
    return new ($b->classname);
}

?>

1.2.251.1. Suggestions

  • Add the class or interface typehint to the code.

1.2.251.2. Specs

Short name

Typehints/CouldBeCIT

Rulesets

All, CE

Exakat since

2.1.2

PHP Version

All

Severity

Major

Time To Fix

Quick (30 mins)

Precision

High

Features

class

Available in

Entreprise Edition, Community Edition, Exakat Cloud