bermudaphp / var-export
v1.2.2
2024-05-27 18:06 UTC
Requires
- php: ^8.1
- nikic/php-parser: ^5.0.2
README
composer require bermudaphp/var-export
Usage
$closure = static function (string $filename) use ($fileReader): string { return $fileReader->read($filename); }); dd(export_closure($closure)); ^ """ static function(string $filename) use($fileReader): string { return $fileReader->read($filename); } $closure = static fn(): string => __FILE__ ; dd(export_closure($closure)); ^ "static fn(): string => 'path/to/closure/filename'" class A { public function call() { $closure = fn(): string => self::class ; dd(export_closure($closure)); } } ^ "fn(): string => \A::class"