Remove unecessary calls to func_get_args #79
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I've suffered from the same issue as flagged up in Issue #77, where passing a single string to the
tag()
method does nothing. For example:$article->tag('test'); //does nothing
This is caused by the following code which appears in several places throughout the
Taggable.php
class:When this code runs on a method with only one argument, such as the
tag
method, it is shifting the only argument off the array, leaving nothing. ForscopeWithAllTags
andscopeWithAnyTags
which both take two parameters, it removes the$query
argument, which makes sense.It looks like this code is there to convert a string value to an array, however immediately after it in all four of the places it appears is a call to
makeTagArray
which does exactly the same thing. So this block of code is not needed, and given it's causing issues, should be removed.This was on v2.0.4 of the code, on Laravel 5.1.20 and PHP 5.5