- Introduced runtimeMethodRequiresDynamicScope to check method visibility - Integrated reflection-based method modifier checking - Updated nullsafe access trait to pass expression objects for scope analysis - Added test case for nullsafe method calls preserving private visibility - Refactored method call processing to handle dynamic scope requirementspull/48/head
parent
7190bea4a5
commit
b77fee697e
3 changed files with 87 additions and 10 deletions
@ -0,0 +1,29 @@ |
|||||||
|
--TEST-- |
||||||
|
Nullsafe method calls preserve private visibility when required |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
|
||||||
|
final class NullsafePrivateScope |
||||||
|
{ |
||||||
|
private function value(): string |
||||||
|
{ |
||||||
|
return 'private-ok'; |
||||||
|
} |
||||||
|
|
||||||
|
public function read(?self $object): ?string |
||||||
|
{ |
||||||
|
return $object?->value(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main(): void |
||||||
|
{ |
||||||
|
$object = new NullsafePrivateScope(); |
||||||
|
var_dump($object->read($object)); |
||||||
|
var_dump($object->read(null)); |
||||||
|
} |
||||||
|
|
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
string(10) "private-ok" |
||||||
|
NULL |
||||||
Loading…
Reference in new issue