1.2.1222. Type Could Be Integer

This rule marks arguments, class constants, properties and return types that can be set to int.

<?php

// Accept an int as input
function foo($b) {
    // Returns an int
    return $b + 8;
}

?>

1.2.1222.1. Suggestions

  • Add int typehint to the code.

1.2.1222.2. Specs

Short name

Typehints/CouldBeInt

Rulesets

All, CE, Typechecks

Exakat since

2.1.4

PHP Version

All

Severity

Major

Time To Fix

Quick (30 mins)

Precision

High

Features

integer, type

Available in

Entreprise Edition, Community Edition, Exakat Cloud