Skip to content

Commit

Permalink
Remove emitProperty() following hooks and asymmetric visibility are b…
Browse files Browse the repository at this point in the history
…oth merged

See #182 (comment)
  • Loading branch information
thekid committed Aug 31, 2024
1 parent 12ae79a commit ab07d7c
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/main/php/lang/ast/emit/PHP84.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php namespace lang\ast\emit;

use ReflectionProperty;
use lang\ast\types\{
IsArray,
IsFunction,
Expand All @@ -20,10 +19,6 @@
*/
class PHP84 extends PHP {
use RewriteBlockLambdaExpressions;
use PropertyHooks, AsymmetricVisibility {
PropertyHooks::emitProperty as emitPropertyHooks;
AsymmetricVisibility::emitProperty as emitAsymmetricVisibility;
}

public $targetVersion= 80400;

Expand Down Expand Up @@ -58,25 +53,4 @@ public function __construct() {
IsGeneric::class => function($t) { return null; }
];
}

protected function emitProperty($result, $property) {
static $asymmetric= null;
static $hooks= null;

// TODO Remove once https://github.com/php/php-src/pull/15063 and
// https://github.com/php/php-src/pull/13455 are merged
if (
!($asymmetric ?? $asymmetric= method_exists(ReflectionProperty::class, 'isPrivateSet')) &&
array_intersect($property->modifiers, ['private(set)', 'protected(set)', 'public(set)'])
) {
return $this->emitAsymmetricVisibility($result, $property);
} else if (
!($hooks ?? $hooks= method_exists(ReflectionProperty::class, 'getHooks')) &&
$property->hooks
) {
return $this->emitPropertyHooks($result, $property);
}

parent::emitProperty($result, $property);
}
}

0 comments on commit ab07d7c

Please sign in to comment.