Cannot use ‘abstract’ as method modifier¶
Description¶
When resolving name conflicts during trait imports, it is not possible to use abstract with the as keyword. The situation is actually confusing: abstract may be the name of the alias, or it could also be understood as the modifier.
The same situation arise with abstract, final or readonly. On the other hand, it is valid to use the visibility modifier to actually change the visibility on the alias.
Example¶
<?php
trait T1 {
function foo() {}
}
class C1 {
use T1 {
T1::foo as abstract;
}
}
?>
Solutions¶
Use another name than
abstractfor the alias.Use another name than
abstractfor the original method.