1.2.271. 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.271.1. Connex PHP features

1.2.271.1.1. Suggestions

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

1.2.271.1.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

Available in

Entreprise Edition, Community Edition, Exakat Cloud