Skip to content

Commit cf6f56a

Browse files
committed
Fix PHP 8.1 compatibility
Calling static trait method T::__init is deprecated, it should only be called on a class using the trait
1 parent e219849 commit cf6f56a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/php/lang/ast/emit/PHP.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,9 @@ protected function emitTrait($result, $trait) {
527527
$this->emitOne($result, $member);
528528
$result->out->write("\n");
529529
}
530+
$result->out->write('}');
530531

531-
$result->out->write('static function __init() {');
532532
$this->emitMeta($result, $trait->name, $trait->annotations, $trait->comment);
533-
$result->out->write('}} '.$trait->name.'::__init();');
534533
}
535534

536535
protected function emitUse($result, $use) {

0 commit comments

Comments
 (0)