-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[11.x] use promoted properties #53807
Conversation
this commit uses promoted properties to remove a lot of boilerplate code. I avoided promoting any `public` properties that lacked type-hints, but had type-hints in the constructor signature. while unlikely to cause issues, this technically is a change in behavior, and should be handled against the `master` branch. I **did** upgrade `protected` properties that lacked type hints to the type hint provided in the constructor signature. This should be okay because even though the properties themselves weren't type-hinted, the only way to update them was through a type-hinted constructor. some styling decisions made in this PR: - ALWAYS use multiline constructors, with each parameter on a new line - use a trailing comma in multiline constructors - leave in constructor docblocks for now. could/should be removed eventually
random question, but is there a reason we're still using StyleCI? it would be great to have a configuration option to allow for single line empty bodies (as you often see in constructors with promoted properties), but as far as I can tell, that isn't possible. would it make sense to use Pint to format the framework? |
This reverts commit 69b19ce.
@browner12 can you actually send this to master? |
StyleCI rarely changes the |
Glad to know that folks who work at Laravel see this as a problem too. @crynobone Using Pint with the The workaround I've taken is to just copy all of the defaults that are currently set and create our own |
@cosmastech, I recommend pinning a specific version of Pint, rather than a range. That way you choose when to update and receive potential rule changes. |
this commit uses promoted properties to remove a lot of boilerplate code.
I avoided promoting any
public
properties that lacked type-hints, but had type-hints in the constructor signature. while unlikely to cause issues, this technically is a change in behavior, and should be handled against themaster
branch.I did upgrade
protected
properties that lacked type hints to the type hint provided in the constructor signature. This should be okay because even though the properties themselves weren't type-hinted, the only way to update them was through a type-hinted constructor.some styling decisions made in this PR:
there are many more to go, but wanted to test the waters with how this would be received first.