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

[5.3] allow passing object instance to class_uses_recursive #15223

Conversation

jarektkaczyk
Copy link
Contributor

This PR makes class_uses_recursive more useful and compatible with class_uses native function:

screenshot from 2016-09-02 12 05 27

As you can see in the screenshot, when you try to feed it with an object, rather than class name, you get pretty annoying and useless error message.

This PR gets rid of that:

>>> class_uses_recursive('App\User')
=> [
     "Illuminate\Notifications\Notifiable" => "Illuminate\Notifications\Notifiable",
     "Illuminate\Notifications\HasDatabaseNotifications" => "Illuminate\Notifications\HasDatabaseNotifications",
     "Illuminate\Notifications\RoutesNotifications" => "Illuminate\Notifications\RoutesNotifications",
     "Illuminate\Auth\Authenticatable" => "Illuminate\Auth\Authenticatable",
     "Illuminate\Foundation\Auth\Access\Authorizable" => "Illuminate\Foundation\Auth\Access\Authorizable",
     "Illuminate\Auth\Passwords\CanResetPassword" => "Illuminate\Auth\Passwords\CanResetPassword",
   ]
>>> class_uses_recursive(new App\User)
=> [
     "Illuminate\Notifications\Notifiable" => "Illuminate\Notifications\Notifiable",
     "Illuminate\Notifications\HasDatabaseNotifications" => "Illuminate\Notifications\HasDatabaseNotifications",
     "Illuminate\Notifications\RoutesNotifications" => "Illuminate\Notifications\RoutesNotifications",
     "Illuminate\Auth\Authenticatable" => "Illuminate\Auth\Authenticatable",
     "Illuminate\Foundation\Auth\Access\Authorizable" => "Illuminate\Foundation\Auth\Access\Authorizable",
     "Illuminate\Auth\Passwords\CanResetPassword" => "Illuminate\Auth\Passwords\CanResetPassword",
   ]
>>> 

@taylorotwell taylorotwell merged commit 4199fb0 into laravel:5.3 Sep 2, 2016
@jarektkaczyk jarektkaczyk deleted the 5.3-allow-passing-object-to-class-uses-recursive branch July 12, 2018 08:24
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.

2 participants