-
Notifications
You must be signed in to change notification settings - Fork 53
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 configuring EloquentOrderByToLatestOrOldestRector #148
Allow configuring EloquentOrderByToLatestOrOldestRector #148
Conversation
We use |
- Refined the example and some naming - Ran `composer docs`
@driftingly That should be done now! Thanks for the heads up, it wasn't compatible without changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple things I'd consider changing
$query->orderBy($unallowed_variable_name); | ||
$query->orderBy('unallowed_column_name'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would probably be better to exist in their own file like skip_if_not_eloquent_builder.php.inc
// skip_if_column_not_allowed.php.inc
<?php
namespace RectorLaravel\Tests\Rector\Cast\DatabaseExpressionCastsToMethodCall\Fixture;
$query->orderBy($unallowed_variable_name);
$query->orderBy('unallowed_column_name');
?>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do this, but I thought these would be unallowed not because they weren't an instance of Builder but because they weren't desired to be automatically refactored. Does it still make sense to move to a different file? I'm not familiar with best practices in this regard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @peterfox is saying to create a file called skip_if_column_not_allowed.php.inc
or skip_if_column_not_configured.php.inc
similar to how he did with with the EloquentOrderByToLatestOrOldestRector fixtures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! At least... I think I got it. I don't have any experience with this at this point, besides following orders. Please let me know if I need to do something else!
Resolves #147.
ALLOWED_PATTERNS
array of strings to apply this rule toNotes
created_at
columns (as it did before)Tested