Defining a custom assert() function is not allowed,

Description

assert() is a PHP native function, used to create assertions. To avoid confusion, or redefinition of this function, it is not allowed to create a custom version of this function, even in a namespace.

Example

<?php

namespace x;

function assert() {}

?>

Solutions

  • Give another name to that function.

  • Make it a method.

  • Make it a Closure.

See Also