TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
864 B

<?php
use TypePhp\Exception\TestError;
/**
* Private methods are not inherited in Zend: a child class may redeclare one
* with any signature, visibility or staticness, and FINAL is ignored on
* non-constructor private methods. Generated code stays correct because
* private calls devirtualize to the declaring class's body — PHP's own
* private-scope binding — and Native classes give private methods no virtual
* slot.
*/
class PrivateMethodRedeclareTest extends BaseTest
{
public function testPrivateMethodsMayBeRedeclaredFreely(): void
{
$this->compile('private_redeclare_valid.php');
}
public function testFinalPrivateConstructorIsStillProtectedFromOverride(): void
{
$this->exec(
'Cannot override final method `A::__construct()`',
'ctor_override_final_private.php',
);
}
}