Skip to content

[5.x]: Elements won't autocomplete customfields after first field in PHPStorm #15336

@myleshyson

Description

@myleshyson

What happened?

Description

Not sure if this is a bug per se, but would be nice to address. Been noticing that custom fields won't autocomplete after the first call even though they have a "static" return type in the CustomFieldBehavior.

I noticed this commit switched the method return types back from \$this to static.

When testing locally if I use self instead of static i'm able to chain just fine.

I'm using PHPStorm 2024.1.4

Steps to reproduce

  1. Open up a craft installation in php storm.
  2. Type the following:
$entry = new Entry();
$entry->someField('value')->anotherField('value');

Expected behavior

anotherField should show up in the method completion window.

Actual behavior

after typing someField, nothing else shows up in the completion window.

Craft CMS version

5.2.4.1

PHP version

8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions