void cannot be used as a parameter type

Description

Void is a type, that can only be used with return type, on methods or functions. Here, void represents the absence of value: this is not possible for a property or an argument. The null value is then the closest possible type that can be assigned to a property, yet representing no value.

Example

<?php

  function foo(void $p) { }

?>

Solutions

  • Use another type for the argument.

  • Remove the argument.

  • Use the null type.

See Also