1.2.260. Could Be Parent

Mark arguments, return types and properties that can be set to parent.

This analysis works when typehints have already been configured.

<?php

class x extends w {
    // Accept a w object as input
    function foo(w $b) : w {
        // Returns a w object
        return $b;
    }
}

?>

1.2.260.1. Suggestions

  • Add parent typehint to the code.

  • Add the literal class/type typehint to the code.

1.2.260.2. Specs

Short name

Typehints/CouldBeParent

Rulesets

All, Typechecks

Exakat since

2.1.2

PHP Version

All

Severity

Major

Time To Fix

Quick (30 mins)

Precision

High

Features

typehint

Available in

Entreprise Edition, Exakat Cloud