Czukowski created NETBEANS-5719: ----------------------------------- Summary: Unused property hint shown when used to instantiate an anonymous class Key: NETBEANS-5719 URL: https://issues.apache.org/jira/browse/NETBEANS-5719 Project: NetBeans Issue Type: Bug Components: php - Editor Affects Versions: 12.4 Environment: Product Version: Apache NetBeans IDE 12.4 Java: 15.0.2; OpenJDK 64-Bit Server VM 15.0.2+7-27 Runtime: OpenJDK Runtime Environment 15.0.2+7-27 Reporter: Czukowski Attachments: image-2021-05-27-12-06-22-136.png
If a class property is used only to create an instance of an anonymous class, it is marked with an 'Unused' hint. The example code is below. There is also an image attached with a screenshot, note how {{$anyParameter}} in {{Factory1}} constructor is underlined. This goes for both constructor argument promotion and the PHP7-style property declaration. {code:php} <?php declare(strict_types = 1); namespace Cz\Test\UsedProperty; class Factory1 { public function __construct(private bool $anyParameter) { } public function create(): Interface1 { return new class ($this->anyParameter) implements Interface1 { public function __construct(private bool $parameter1) { } public function getSomeParameter(): bool { return $this->parameter1; } }; } } interface Interface1 { function getSomeParameter(): bool; } {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists