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

Pint renames relation in model. #329

Open
JordanchoEftimov opened this issue Jan 5, 2025 · 2 comments
Open

Pint renames relation in model. #329

JordanchoEftimov opened this issue Jan 5, 2025 · 2 comments

Comments

@JordanchoEftimov
Copy link

Pint Version

1.18.3

PHP Version

8.1

Description

If you have a relation that starts with the word "test," like testQuestions in my case, Laravel automatically converts it to test_questions. I assume this happens due to the naming conventions used for tests.

Steps To Reproduce

Screen.Recording.2025-01-05.at.12.14.25.mov
@ricdizio
Copy link

Check your pint.json file. There you be a property called php_unit_method_casing set to snake_case. The default value should be camel_case

@markwalet
Copy link
Contributor

@ricdizio I think the problem here is that this class is not a testcase. It's an eloquent model. So the php_unit_method_casing rule should not even apply here.

However, this is just how the rule is implemented in PHP-CS-Fixer: I found the following code snippet that determines if a method is interpreted as a test or not. I don't think this is an issue with Laravel Pint, but rather with PHP-CS-Fixer. So I suggest creating an issue there. I'm guessing this is pretty difficult to fix because PHP-CS-Fixer mostly does string comparisons based on the class and method name. Which in you case both contains Test. But maybe there are some contributors there who can help you further.

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

No branches or pull requests

3 participants