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

DX: check fixer's options for wording #7543

Merged
merged 6 commits into from Dec 14, 2023
Merged

DX: check fixer's options for wording #7543

merged 6 commits into from Dec 14, 2023

Conversation

kubawerlos
Copy link
Contributor

Fixer align_multiline_comment currently has:

Configuration
-------------

``comment_type``
~~~~~~~~~~~~~~~~

Whether to fix PHPDoc comments only (``phpdocs_only``), any multi-line comment
whose lines all start with an asterisk (``phpdocs_like``) or any multi-line
comment (``all_multiline``).

Allowed values: ``'all_multiline'``, ``'phpdocs_like'`` and ``'phpdocs_only'``

Maybe better would be to update available option to all, phpdoc_like and phpdoc_only?

@coveralls
Copy link

coveralls commented Dec 10, 2023

Coverage Status

coverage: 94.917%. remained the same
when pulling bf06339 on 6b7562617765726c6f73:dx_check_options_for_wording
into a5fa4c9 on PHP-CS-Fixer:master.

@kubawerlos kubawerlos enabled auto-merge (squash) December 10, 2023 23:01
@keradus
Copy link
Member

keradus commented Dec 10, 2023

content of PR and text in PR opening are 2 separated things, do I understand right?

for changing options, why dropping plural?

@kubawerlos
Copy link
Contributor Author

why dropping plural?

It's not dropping, it still checks for plural, only with and exception fo having phpdocs_* in backticks, as align_multiline_comment has.

@keradus
Copy link
Member

keradus commented Dec 11, 2023

Allowed values: 'all_multiline', 'phpdocs_like' and 'phpdocs_only'

Maybe better would be to update available option to all, phpdoc_like and phpdoc_only?

I read it as you want to change the plurality (while PR is doing something else)


after peer2peer discussion, comment in opening msg is standalone idea, not blocking content of the PR

Comment on lines 503 to 507
self::assertSame(
0,
substr_count($description, 'phpdocs') - substr_count($description, '`phpdocs_'), // allow the option to have "`phpdocs_*`"
sprintf('[%s] `PHPDoc` must not be in the plural in %s.', $fixerName, $descriptionType),
);
Copy link
Member

Choose a reason for hiding this comment

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

I think right now we have only phpdocs_ (plural) as rule option, is it the case?

with that, maybe we should keep the opposite rule here, to have it plural for option?

or likely no - as we have only single rule having option like that, maybe we do not have enough options to decide if there should be a rule for it, sounds too early for me.

Original idea was to keep proper casing, which makes sense to have always the same casing for same, hm..., proper name. (polish "nazwa wlasna")

now , you suggest to unify using plural or singular, which really depends on the context and maybe should not be unified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd say they should be unified, but let's start with not allowing more plural usages.

Copy link
Member

Choose a reason for hiding this comment

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

only if whole option make sense when using singular form. not sure if that will be the case or not as we do not have many cases yet to validate that.

Comment on lines 468 to 472
'PHPDoc' => [
'option:comment_type' => [
'align_multiline_comment' => 2,
],
],
Copy link
Member

Choose a reason for hiding this comment

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

I dropped it on local machine to check how the error will look alike if someone would use phpdocs_ option in other fixer.

Outcome is confusing:

1) PhpCsFixer\Tests\Fixer\Phpdoc\AlignMultilineCommentFixerTest::testXxxFixerConfigurationDefinitions
[align_multiline_comment] `PHPDoc` must be in correct casing in option:comment_type.
Failed asserting that 1 is identical to 3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is confusing in "PHPDoc must be in correct casing in option:comment_type."? It is quite clear to me what is wrong.

Copy link
Member

Choose a reason for hiding this comment

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

it was confusing as test was complaining about plural/singular and test failure description was complaining about casing.

not the case anymore with newest state of this PR

@kubawerlos kubawerlos merged commit df13d63 into PHP-CS-Fixer:master Dec 14, 2023
25 checks passed
@kubawerlos kubawerlos deleted the dx_check_options_for_wording branch December 14, 2023 07:46
danog pushed a commit to zoonru/PHP-CS-Fixer that referenced this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants