- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ClassAttributesSeparationFixer - add option for no new lines between properties #4875
ClassAttributesSeparationFixer - add option for no new lines between properties #4875
Conversation
This is because the unit tests for fixers first check that the input code is changed to the expected code then it checks that the expected code is not changed again when used as input. It means the fixer changes code that is not expected to change. |
tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php
Outdated
Show resolved
Hide resolved
6228f39
to
8769cc4
Compare
@juliendufresne @kubawerlos Thanks for checking this PR, with the help of @ruudk this PR is now ready for review. |
a8aed0e
to
951fb16
Compare
@kubawerlos Thanks! Fixed |
951fb16
to
aa08cc5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
f4c2ae5
to
117e617
Compare
117e617
to
6236ce2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing this PR 🙌
@SpacePossum What do you think? You also replied in #4755 to provide a solution.
@keradus @GrahamCampbell What do you think of this? Would love to be able to remove all those empty newlines from our project 🙏 |
@adri Before we merge this PR, could you please rebase and squash commits to keep one commit per authorship? |
Sorry missed your comment @julienfalque and already compiled the list of PR te merge. Sadly the merge script didn't squash the commit, but we can do without it. |
Thanks for merging this. I see this is merged to
@SpacePossum Thanks, hope it too 😊 |
yeah this will be in 2.17.0 :) |
@SpacePossum What's the ETA for 2.17.0? |
My hope is within two months, however it depends on what we find during regression testing it and the time the maintainer has, maybe not ideal but we shouldn't rush it. People can help out a lot by using the master version for now and report any bugs they find on their repo's, as I think 2.17 is mostly feature-complete by this point. |
When properties have comments, the newlines are also removed. I don't think it should behave like that. 'class_attributes_separation' => ['elements' => ['property' => 'none']], class Entity
{
/**
* @ORM\Column(name="id", type="uuid")
* @ORM\Id
*/
private UuidInterface $id;
/**
* @ORM\Column(name="description", type="text")
*/
private string $description = '';
} gets converted to class Entity
{
/**
* @ORM\Column(name="id", type="uuid")
* @ORM\Id
*/
private UuidInterface $id;
/**
* @ORM\Column(name="description", type="text")
*/
private string $description = '';
} What do you think? How should this behave? |
I would prefer keeping the empty line when there is a DocBlock comment. Same with constants and methods. |
Indeed, that's also what I expected, so maybe it's a bug in this PR? I don't know enough from the internals to know where this responsibility resides. |
I would expect it to be removed as the configuration chosen is |
I agree with @kubawerlos here, for |
@SpacePossum @kubawerlos @julienfalque Implemented in #5060. What do you think? |
Implementation for #4755
Changes the
class_attributes_separation
option to take options for each type (const
,method
orproperty
. The options can be eitherone
ornone
, indicating one or no spaces between the types.Example
A configuration like this:
Would change this example code:
to this: