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

NEW Add rule to avoid use of "new" keyword #9

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Jul 18, 2024

I've tried to include tests for all the different possible usages of self and their contexts - let me know if there's something I'm missing and I'll add it.

Issue

@GuySartorelli GuySartorelli marked this pull request as draft July 18, 2024 03:56
@GuySartorelli GuySartorelli force-pushed the pulls/1/no-self branch 3 times, most recently from bba1b9f to 5731848 Compare July 22, 2024 01:40
src/PHPStan/KeywordSelfRule.php Show resolved Hide resolved
src/PHPStan/KeywordSelfRule.php Show resolved Hide resolved
src/PHPStan/KeywordSelfRule.php Show resolved Hide resolved
@GuySartorelli GuySartorelli marked this pull request as ready for review July 22, 2024 01:57
src/PHPStan/KeywordSelfRule.php Outdated Show resolved Hide resolved
src/PHPStan/KeywordSelfRule.php Show resolved Hide resolved
@GuySartorelli
Copy link
Member Author

You said something about refactoring this in person, but I don't see a comment about it here. IIRC it was that you want the switch statement to return errors instead of returning empty arrays (i.e. reverse the conditions)? Is that right?

@emteknetnz
Copy link
Member

emteknetnz commented Jul 23, 2024

Nah don't bother with the reversing, I think as long as there's some explanation (just a link to docs) that an empty array means "no issue" then that's good enough

@emteknetnz emteknetnz merged commit ee6a851 into silverstripe:1 Jul 23, 2024
9 checks passed
@emteknetnz emteknetnz deleted the pulls/1/no-self branch July 23, 2024 03:57
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.

2 participants