Cannot use “%s” when no class scope is active

Description

self`, static and parent refers to the classes, relative to the current one. As such, they can only be used inside a class or a trait.

Example

<?php

static::x;

?>

Solutions

  • Move the code inside a method, in a trait or a class.

  • Use the full name of the class that should be used.