The magic method %s::%s() must have public visibility

Description

The magic methods must have the public visibility, as their features are available to external sources. It may also use the default visibility.

Example

<?php

class X {
    private function __isset($x) {}
    protected function __get($x) {}
}

?>

Literal Examples

  • The magic method X::__isset() must have public visibility

  • The magic method X::__get() must have public visibility

  • The magic method X::__set() must have public visibility

Solutions

  • Set the visibility to public.

  • Remove the visibility, to use the default of public.

  • Remove the magic method.