Skip to content

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

@DamImpr

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?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    PHP[ci] enable extra PHP tests (php/php.editor)kind:bugBug report or fixneeds:triageRequires attention from one of the committers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions