1.2.1045. Return Typehint Usage

Spot usage of return typehint. It is a PHP 7.0 feature.

Return typehint were introduced in PHP 7.0, and are backward incompatible with PHP 5.x.

<?php

function foo($a) : stdClass {
    return new \stdClass();
}

?>

See also RFC: Return Type Declarations and Return Type Declarations.

1.2.1045.1. Specs

Short name

Php/ReturnTypehintUsage

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

0.8.4

PHP Version

With PHP 7.0 and more recent

Severity

Time To Fix

Changed Behavior

PHP 7.0 - More

Precision

Very high

Features

returntype

Available in

Entreprise Edition, Community Edition, Exakat Cloud