Skip to content

lint: require parentheses when instantiating a new class#1157

Merged
outdooracorn merged 1 commit into
mainfrom
pint-add-new_with_parentheses-rule
Jun 10, 2026
Merged

lint: require parentheses when instantiating a new class#1157
outdooracorn merged 1 commit into
mainfrom
pint-add-new_with_parentheses-rule

Conversation

@outdooracorn

@outdooracorn outdooracorn commented Jun 10, 2026

Copy link
Copy Markdown
Member

Set the laravel/pint config new_with_parentheses to true to make it more explicit that a new instance is created.

Bug: T428714

Set the `laravel/pint` config `new_with_parentheses` to `true`

Bug: T428714
@outdooracorn outdooracorn self-assigned this Jun 10, 2026

@outdooracorn outdooracorn left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tarrow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no objections to this style change. I think it is mostly personal preference and I don't have a strong opinion

@tarrow tarrow changed the title lint: require parentheses when instanciating a new class lint: require parentheses when instantiating a new class Jun 10, 2026
@tarrow

tarrow commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

quick chat in the daily confirms nobody present there today has objections against us just moving forwards

@outdooracorn outdooracorn merged commit 08ebdc3 into main Jun 10, 2026
5 checks passed
@outdooracorn outdooracorn deleted the pint-add-new_with_parentheses-rule branch June 10, 2026 10:20
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