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

[2.x] Support vendor class aliasing #88

Merged
merged 2 commits into from
Feb 5, 2020
Merged

[2.x] Support vendor class aliasing #88

merged 2 commits into from
Feb 5, 2020

Conversation

jasonvarga
Copy link
Contributor

@jasonvarga jasonvarga commented Feb 3, 2020

This PR adds support for aliasing classes and namespaces inside the vendor directory.

Now if you're using a package within Tinker frequently you can add this sort of thing:

'alias' => [
  'Statamic\Facades',
],

I wanted to add tests, but there weren't any so this also contains tests for existing functionality.
Not sure if the dummy config helper is the way to go, but it worked.

Closes #76

@jasonvarga jasonvarga marked this pull request as ready for review February 3, 2020 15:58
@jasonvarga jasonvarga requested a review from driesvints February 3, 2020 15:58
composer.json Outdated Show resolved Hide resolved
src/ClassAliasAutoloader.php Outdated Show resolved Hide resolved
@driesvints driesvints changed the title Support vendor class aliasing [2.x] Support vendor class aliasing Feb 3, 2020
composer.json Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
src/ClassAliasAutoloader.php Outdated Show resolved Hide resolved
src/ClassAliasAutoloader.php Outdated Show resolved Hide resolved
@jasonvarga
Copy link
Contributor Author

@GrahamCampbell Now you've changed the signature of __construct and register. Isn't it technically a breaking change now?

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Feb 4, 2020

No. They have default values, and the old code was totally broken out side of laravel anyway. This package was made specifically so tinker could be used outside of laravel/framework, so we need to support that.

@jasonvarga
Copy link
Contributor Author

Alrighty.

@jasonvarga
Copy link
Contributor Author

Ah yeah the fallbacks. Cool.

You could have just asked for that. But hey, less for me to do. 🤘

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Feb 4, 2020

Was quicker for me to just write the code than do a bad job of explaining how to do it. The clearest way for me to explain what I wanted was to write it. ;)

@taylorotwell taylorotwell merged commit ac72016 into laravel:2.x Feb 5, 2020
@jasonvarga
Copy link
Contributor Author

Thanks!

@driesvints
Copy link
Member

Thanks to you both 👍

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.

Whitelist vendor classes for aliasing
4 participants