Skip to content

Private const properties get marked as unused when used in attributes #8244

@rarila

Description

@rarila

Apache NetBeans version

Apache NetBeans 24

What happened

Current behavior

A private constant property gets marked as unused although used in class attributes:

Image

Expected behavior

Image

Related

Other related functionality executed on this class constant like

  • Find usage
  • Go to Deklaration
  • Refactor->Rename

works as expected and handles its usage inside the attribute without a problem.

Language / Project Type / NetBeans Component

PHP

How to reproduce

<?php

namespace FooBar;

use Attribute;

#[Attribute(Attribute::TARGET_CLASS)]
class SomeAttribute
{
    public function __construct(string $name) {}
}

#[SomeAttribute(name: self::NAME)]
class Test
{
    private const string NAME = 'foobar';
}

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows

JDK

jdk-23.0.2

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

Labels

PHP[ci] enable extra PHP tests (php/php.editor)kind:bugBug report or fix

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions