1.2.275. Could Be Void

Mark return types that can be set to void.

All abstract methods (in classes or in interfaces) are omitted here.

<?php

// No return, this should be void.
function foo() {
    ++$a; // Not useful
}

?>

1.2.275.1. Suggestions

  • Add the void typehint to the code.

1.2.275.2. Specs

Short name

Typehints/CouldBeVoid

Rulesets

All, Typechecks

Exakat since

2.1.2

PHP Version

All

Severity

Major

Time To Fix

Quick (30 mins)

Precision

High

Features

void

Available in

Entreprise Edition, Exakat Cloud