1.2.270. Could Be String

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

<?php

// Accept a string as input
function foo($a) {
    // Returns a string
    return $a . 'string';
}

?>

1.2.270.1. Suggestions

  • Choose the string typehint, and add it to the code.

1.2.270.2. Specs

Short name

Typehints/CouldBeString

Rulesets

All, CE, Typechecks

Exakat since

2.1.2

PHP Version

All

Severity

Major

Time To Fix

Quick (30 mins)

Precision

High

Features

string

Available in

Entreprise Edition, Community Edition, Exakat Cloud