Skip to content

Conversation

EmanueleCoppola
Copy link

@EmanueleCoppola EmanueleCoppola commented May 18, 2023

Summary

Enable the recognition of attributes without any return type in the declared closures.

The following example was not recognized before:

protected function attributeWithoutReturnTypes(): Attribute
{
    return new Attribute(
        function (?string $name) {
            return $name;
        },
        function (?string $name) {
            return $name === null ? null : ucfirst($name);
        }
    );
}

Now the aforementioned method should produce the following declaration:

 * @property mixed $attribute_without_return_types

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • Existing tests have been adapted and/or new tests have been added
  • Add a CHANGELOG.md entry
  • Update the README.md
  • Code style has been fixed via composer fix-style

@EmanueleCoppola EmanueleCoppola changed the title Enable the recognition of attributes without any return type in the declared closures Add support for attribute accessors without return type declared in closures May 18, 2023
@@ -11,6 +11,7 @@
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Attributes\Models\Simple
*
* @property integer $id
* @property mixed $attribute_without_return_types
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was returned before?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before it didn't even show the attribute

@barryvdh
Copy link
Owner

barryvdh commented Feb 8, 2024

Is this fixed with #1411 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants