1.2.666. Maybe Missing New

This functioncall looks like a class instantiation that is missing the new keyword.

Any function definition was found for that function, but a class with that name was. New is probably missing.

<?php

// Functioncall
$a = foo();

// Class definition
class foo {}
// Function definition
function foo {}


// Functioncall
$a = BAR;

// Function definition
class bar {}
// Constant definition
const BAR = 1;


?>

1.2.666.1. Suggestions

  • Add the new

  • Rename the class to distinguish it from the function

  • Rename the function to distinguish it from the class

1.2.666.2. Specs

Short name

Structures/MissingNew

Rulesets

All, Analyze, Changed Behavior

Exakat since

1.0.4

PHP Version

All

Severity

Critical

Time To Fix

Instant (5 mins)

Precision

Medium

Features

new

Available in

Entreprise Edition, Exakat Cloud