-
Notifications
You must be signed in to change notification settings - Fork 47
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
Allow configuration with EloquentOrderByToLatestOrOldestRector
rule
#147
Comments
@johnbacon what's your thoughts, a list of columns or simply a regex to match? At current the rule will refactor if a variable is used. If this was enabled. It would only refactor with string literals. |
@peterfox The implementation allows for wildcards and a list of columns, but do you feel regex would provide more benefit on top of that? The fact that static analysis can't determine the name of a column within a variable was a bummer to learn. I "got around" that by allowing you to specify the name of a variable, e.g. |
Examining variable names is a bit risky. I'd likely stick to string literals. Regex, to me, makes the most sense rather than listing all possibilities someone might have. Wildcard could work, but sometimes it's more effort when Regex is more flexible, and the example of ends with |
Is that something you could possibly lend a hand on? I'm less comfortable with regex and even more so in the Laravel/Rector ecosystem, unfortunately. |
@johnbacon Sure, I'll see if I can find time to work on it. |
By default, EloquentOrderByToLatestOrOldestRector modifies all
orderBy
andorderByDesc
methods to uselatest()
oroldest()
instead.Our team feels we'd like to do this only regarding timestamps, as
oldest('name')
or similar could be confusing.As such, some configuration allowing for explicit column names you'd like to change to
oldest()
orlatest()
is desired.This suggestion was also briefly mentioned in the relevant PR:
The text was updated successfully, but these errors were encountered: