Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rarila opened this issue Feb 13, 2025 · 2 comments · May be fixed by #8250
Open

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

rarila opened this issue Feb 13, 2025 · 2 comments · May be fixed by #8250
Assignees
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Milestone

Comments

@rarila
Copy link

rarila commented Feb 13, 2025

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

@rarila rarila added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Feb 13, 2025
@troizet troizet added the PHP [ci] enable extra PHP tests (php/php.editor) label Feb 13, 2025
@junichi11
Copy link
Member

Thank you for reporting it. Reproducible.

@junichi11 junichi11 removed the needs:triage Requires attention from one of the committers label Feb 15, 2025
@junichi11 junichi11 self-assigned this Feb 15, 2025
@junichi11 junichi11 added this to the NB26 milestone Feb 15, 2025
junichi11 added a commit to junichi11/netbeans that referenced this issue Feb 16, 2025
- apache#8244
- Scan attributes after `ConstantDeclaration`s are scanned
@junichi11 junichi11 linked a pull request Feb 16, 2025 that will close this issue
4 tasks
@junichi11 junichi11 linked a pull request Feb 16, 2025 that will close this issue
4 tasks
@rarila
Copy link
Author

rarila commented Feb 16, 2025

@junichi11
I have to thank you for your really great work! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants