Skip to content

[PHP] 'Generate override' feature assigns the return type in the constructor #9171

Closed

Description

@DamImpr

Apache NetBeans version

Apache NetBeans 28

What happened

When using the ‘generate override’ feature on a class that extends another class, and selecting the constructor, it is created by also assigning the return type, which is not permitted for a constructor.

Image Image

Language / Project Type / NetBeans Component

PHP project

How to reproduce

  1. In a PHP project, create a class that extends another class.
Image
  1. Right-click on the editor and select ‘Insert code’ to bring up the “Generate” menu, then select ‘Override & implement methods’.
Image
  1. Select "__constructor", then press "Ok" button
Image
  1. The constructor with return type is generated.
Image

Did this work correctly in an earlier version?

No / Don't know

Operating System

Arch Linux

JDK

jdk21-openjdk

Apache NetBeans packaging

Community provided installer

Anything else

  • The error shown in the screenshot was generated when running PHP version 8.3, but the same error also occurs in version 8.4.
  • The bug does not occur when ‘Constructor’ is selected in the same ‘Generate’ menu.
Image Image

Are you willing to submit a pull request?

Yes

Activity

  1. added
    kind:bug
    needs:triage
    on Jan 28, 2026
  2. added
    PHP
    on Jan 28, 2026
  3. added a commit that references this issue on May 26, 2026
    eb8afbe
  4. removed
    needs:triage
    on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PHPkind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions