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

Default values as enums cases #1463

Closed
d8vjork opened this issue Aug 28, 2023 · 0 comments · Fixed by #1464
Closed

Default values as enums cases #1463

d8vjork opened this issue Aug 28, 2023 · 0 comments · Fixed by #1464
Labels

Comments

@d8vjork
Copy link
Contributor

d8vjork commented Aug 28, 2023

Versions:

  • ide-helper Version: 2.12.3
  • Laravel Version: 10.19.0
  • PHP Version: 8.2.8

Description:

In case we want to add a default value using an enum typed argument on a model query scope like so:

<?php

class MyModel extends Model
{
    public function scopeHasAbility(Builder $query, Authenticatable $user, ?CrudAction $ability = CrudAction::Read)
    {
        // code here...
    }
}

This will run fine in PHP 8+ but IDE helper models docblock generator command will complain with the following error:

image

Error comes from this line:

$default = "'" . trim($default) . "'";

Steps To Reproduce:

  • Add code from description
  • Run php artisan ide-helper:models -w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant