1.2.712. Mixed Keyword

Never becomes a PHP keyword. It is used for typing functions which never returns anything (either dies or throw an exception).

It should be avoided in classes, traits and interfaces. Methods, anonymous classes (sic), namespaces and functions are OK.

Setting a never class in a namespaces doesn’t make it legit.

<?php

// This is OK
function never() { }

// This is no OK
class never {  }

?>

See also mixed.

1.2.712.1. Suggestions

  • Rename the classes, traits and interfaces with a different name.

1.2.712.2. Specs

Short name

Php/MixedKeyword

Rulesets

All, CompatibilityPHP80, CompatibilityPHP81

Exakat since

2.3.0

PHP Version

With PHP 8.0 and older

Severity

Major

Time To Fix

Slow (1 hour)

Precision

Very high

Features

mixed

Available in

Entreprise Edition, Exakat Cloud