<?php namespace test; use \Closure; class MyClass { protected Closure $modifier; public function __construct(callable $modifier) { $this->modifier = Closure::fromCallable($modifier); } } class SomeOtherClass { public static function func() { return ['a' => 'b']; } } // this will work fine $a = new MyClass(['\test\SomeOtherClass', 'func']); var_dump($a); // this will cause error $b = new MyClass(['SomeOtherClass', 'func']);
You have javascript disabled. You will not be able to edit any code.