lint: require parentheses when instantiating a new class#1157
Merged
Conversation
Set the `laravel/pint` config `new_with_parentheses` to `true` Bug: T428714
outdooracorn
commented
Jun 10, 2026
Member
Author
There was a problem hiding this comment.
I personally find this more explicit that a new instance is created. I've had times when I've missed that a class was instantiated (vs just a reference to the class). This is likely because I come from Python where the parenthesis are used to differentiate between instantiation of a class and just a reference to a class:
class MyClass:
def __init__(self):
print("MyClass was intantiated")
a = MyClass() # instance
b = MyClass # reference
print(a)
print(b)
## Outputs
# MyClass was intantiated
# <__main__.MyClass object at 0x7d5a4ec09bb0>
# <class '__main__.MyClass'>
tarrow
approved these changes
Jun 10, 2026
tarrow
left a comment
Contributor
There was a problem hiding this comment.
I have no objections to this style change. I think it is mostly personal preference and I don't have a strong opinion
Contributor
|
quick chat in the daily confirms nobody present there today has objections against us just moving forwards |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Set the
laravel/pintconfignew_with_parenthesestotrueto make it more explicit that a new instance is created.Bug: T428714