1.2.281. Could Not Type

Mark arguments, return types and properties that could not be typed.

Arguments, return types and properties that have no explicit typehint, and that could yield no guess from the following analysis, are deemed unable to receive a type.

  • Typehints/CouldBeCIT

  • Typehints/CouldBeString

  • Typehints/CouldBeArray

  • Typehints/CouldBeBoolean

  • Typehints/CouldBeVoid

  • Typehints/CouldBeCallable

mixed typehint, which acts as the universal typehint, is not processed here.

There are situation which cannot be typed, and legit : the example below is an illustration. array_fill() is a native PHP example, where the second argument may be of any type. __get() and __set() are also notoriously difficult to type, given the broad usage of arguments.

<?php

// Accepts any input, and returns any input
// This may be used, but not typed.
function foo($b) {
    return $b;
}

?>

1.2.281.1. Specs

Short name

Typehints/CouldNotType

Rulesets

All, Changed Behavior

Exakat since

2.1.2

PHP Version

All

Severity

Major

Time To Fix

Quick (30 mins)

Precision

Medium

Features

typehint

Available in

Entreprise Edition, Exakat Cloud