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

[PHP] Enum method not found #8286

Open
NReib opened this issue Mar 2, 2025 · 0 comments · May be fixed by #8287
Open

[PHP] Enum method not found #8286

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

Comments

@NReib
Copy link

NReib commented Mar 2, 2025

Apache NetBeans version

Apache NetBeans 25 release candidate

What happened

The following 2 enums should demonstrate the Problem

namespace test;

enum TestA{

	case X;

	public function get(string $param): string{
		return '';
	}
}
namespace test;

enum TestB{

	case X;

	public function get(): string{
		return '';
	}
}

...

\test\TestA::X->get('xxx');

Now 2 things are wrong: we cannot go to declaration of method "get" and Ctrl + P does not work there either (Show param list).

Apparently in VariousUtils.java extractVariableTypeFromVariableBase the unqualified Classname is determined. If we change it to qualified Name the behaviour will be as expected. For StaticMethodInvocation the Qualified name is already used, so I assume there would be no harm in doing the same here.

Language / Project Type / NetBeans Component

No response

How to reproduce

x

Did this work correctly in an earlier version?

No / Don't know

Operating System

Mageia

JDK

x

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

Yes

@NReib NReib added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Mar 2, 2025
@troizet troizet added the PHP [ci] enable extra PHP tests (php/php.editor) label Mar 2, 2025
@junichi11 junichi11 removed the needs:triage Requires attention from one of the committers label Mar 4, 2025
@junichi11 junichi11 added this to the NB26 milestone Mar 4, 2025
NReib added a commit to NReib/netbeans that referenced this issue Mar 4, 2025
…name

-Accessing a Constant of an Enum/Class now uses FQ name if possible

Example:
namespace test;
enum TestA{

        case X;

        public function get(string $param): string{
                return '';
        }
}

namespace test2;
enum TestB{

        case X;

        public function get(): string{
                return '';
        }
}

\test\TestA::X->get();
NReib added a commit to NReib/netbeans that referenced this issue Mar 5, 2025
…name

-Accessing a Constant of an Enum/Class now uses FQ name if possible

Example:
```php
namespace test;

enum TestA{

        case X;

        public function get(string $param): string{
                return '';
        }
}

namespace test2;

enum TestB{

        case X;

        public function get(): string{
                return '';
        }
}

\test\TestA::X->get('xxx'); // go to declaration and mark occurences do not work
```
NReib added a commit to NReib/netbeans that referenced this issue Mar 6, 2025
…name

-Accessing a Constant of an Enum/Class now uses FQ name if possible

Example:
```php
namespace test;

enum TestA{

        case X;

        public function get(string $param): string{
                return '';
        }
}

namespace test2;

enum TestB{

        case X;

        public function get(): string{
                return '';
        }
}

\test\TestA::X->get('xxx'); // go to declaration and mark occurences do not work
```
NReib added a commit to NReib/netbeans that referenced this issue Mar 6, 2025
…name

-Accessing a Constant of an Enum/Class now uses FQ name if possible

Example:
```php
namespace test;

enum TestA{

        case X;

        public function get(string $param): string{
                return '';
        }
}

namespace test2;

enum TestB{

        case X;

        public function get(): string{
                return '';
        }
}

\test\TestA::X->get('xxx'); // go to declaration and mark occurences do not work
```
NReib added a commit to NReib/netbeans that referenced this issue Mar 6, 2025
…name

-Accessing a Constant of an Enum/Class now uses FQ name if possible

Example:
```php
namespace test;

enum TestA{

        case X;

        public function get(string $param): string{
                return '';
        }
}

namespace test2;

enum TestB{

        case X;

        public function get(): string{
                return '';
        }
}

\test\TestA::X->get('xxx'); // go to declaration and mark occurences do not 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