From 0e27274118db76f9261021d664123b421f53e2a9 Mon Sep 17 00:00:00 2001 From: Nils Reibold Date: Sat, 15 Mar 2025 16:48:39 +0100 Subject: [PATCH] [GH 8334] PHP do not display override hint for constructors The following leads to a compile error in PHP - so we should not display the Add Override hint for constructors. ```php hints, Ba if (CancelSupport.getDefault().isCancelled()) { return; } + if (CodeUtils.isConstructor(method)) { + // Override on constructor results in compile Error (checked in PHP 8.4) + return; + } Identifier methodName = method.getFunction().getFunctionName(); AddOverrideFix fix = new AddOverrideFix(document, method, ts); hints.add(new Hint(AddOverrideAttributeHint.this, diff --git a/php/php.editor/test/unit/data/testfiles/verification/AddOverrideAttributeHint/testNoOverrideHintOnConstructor_01.php b/php/php.editor/test/unit/data/testfiles/verification/AddOverrideAttributeHint/testNoOverrideHintOnConstructor_01.php new file mode 100644 index 000000000000..cf89481f596a --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/verification/AddOverrideAttributeHint/testNoOverrideHintOnConstructor_01.php @@ -0,0 +1,39 @@ +