@@ -713,13 +713,7 @@ private function isAllowedProperty(string $class, string $property, bool $writeA
713
713
return false ;
714
714
}
715
715
716
- // PHP 8.4: Asymmetric Visibility and Property Hooks
717
- $ hasAsymmetricVisibilityCapability = method_exists ($ reflectionProperty , 'isPrivateSet ' )
718
- && method_exists ($ reflectionProperty , 'isProtectedSet ' )
719
- && method_exists ($ reflectionProperty , 'isVirtual ' )
720
- && method_exists ($ reflectionProperty , 'hasHook ' );
721
-
722
- if ($ hasAsymmetricVisibilityCapability ) {
716
+ if (\PHP_VERSION_ID >= 80400 ) {
723
717
// If the property is virtual and has no setter, it's not writable.
724
718
if ($ writeAccessRequired && $ reflectionProperty ->isVirtual () && !$ reflectionProperty ->hasHook (\PropertyHookType::Set)) {
725
719
return false ;
@@ -969,19 +963,18 @@ private function getReadVisiblityForMethod(\ReflectionMethod $reflectionMethod):
969
963
970
964
private function getWriteVisiblityForProperty (\ReflectionProperty $ reflectionProperty ): string
971
965
{
972
- // PHP 8.4: Property hooks
973
- if ( method_exists ( $ reflectionProperty , ' isVirtual ' ) && method_exists ( $ reflectionProperty , ' hasHook ' )) {
966
+ if (\ PHP_VERSION_ID >= 80400 ) {
967
+ // If the property is virtual and has no setter, it's private
974
968
if ($ reflectionProperty ->isVirtual () && !$ reflectionProperty ->hasHook (\PropertyHookType::Set)) {
975
969
return PropertyWriteInfo::VISIBILITY_PRIVATE ;
976
970
}
977
- }
978
971
979
- // PHP 8.4: Asymmetric visibility
980
- if (method_exists ($ reflectionProperty , 'isPrivateSet ' ) && method_exists ($ reflectionProperty , 'isProtectedSet ' )) {
972
+ // If the property has private setter, it's not writable
981
973
if ($ reflectionProperty ->isPrivateSet ()) {
982
974
return PropertyWriteInfo::VISIBILITY_PRIVATE ;
983
975
}
984
976
977
+ // If the property has protected setter, it's protected
985
978
if ($ reflectionProperty ->isProtectedSet ()) {
986
979
return PropertyWriteInfo::VISIBILITY_PROTECTED ;
987
980
}
0 commit comments