1--TEST-- 2#[Override] attribute in trait does not check for parent class implementations 3--FILE-- 4<?php 5 6class A { 7 public function foo(): void {} 8} 9 10interface I { 11 public function foo(): void; 12} 13 14trait T { 15 #[\Override] 16 public function foo(): void { 17 echo 'foo'; 18 } 19} 20 21// Works fine 22class B implements I { 23 use T; 24} 25 26// Works fine ("copied and pasted into the target class") 27class C extends A { 28 #[\Override] 29 public function foo(): void { 30 echo 'foo'; 31 } 32} 33 34// Does not work 35class D extends A { 36 use T; 37} 38echo "Done"; 39 40?> 41--EXPECT-- 42Done 43