Cannot use $this as parameter

Description

Cannot use $this as parameter. Using $this as a method parameter is not allowed in PHP.

Example

<?php

    function foo($this) { }

?>

Solutions

  • Pass the object as a parameter by creating a method that accepts an object parameter instead.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.