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

fix: PhpdocToParamTypeFixerTest - support for arrow functions #7647

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

keradus
Copy link
Member

@keradus keradus commented Dec 31, 2023

No description provided.

@keradus keradus marked this pull request as ready for review January 2, 2024 23:35
@keradus keradus enabled auto-merge (squash) January 2, 2024 23:36
@coveralls
Copy link

Coverage Status

coverage: 94.769%. remained the same
when pulling 930319f on keradus:phpdoc_to_param-_fn
into 29d5159 on PHP-CS-Fixer:master.

Copy link
Member

@julienfalque julienfalque left a comment

Choose a reason for hiding this comment

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

Maybe we can add similar cases to no_superfluous_phpdoc_tags?

@keradus keradus merged commit b0339c6 into PHP-CS-Fixer:master Jan 3, 2024
25 checks passed
@keradus keradus deleted the phpdoc_to_param-_fn branch January 3, 2024 09:27
@keradus
Copy link
Member Author

keradus commented Jan 3, 2024

good idea, I park it here: #7666

Comment on lines +482 to +505
yield 'support for arrow function' => [
'<?php
Utils::stableSort(
$elements,
/**
* @param int $a
*
* @return array
*/
static fn(int $a) => [$a],
fn($a, $b) => 1,
);',
'<?php
Utils::stableSort(
$elements,
/**
* @param int $a
*
* @return array
*/
static fn($a) => [$a],
fn($a, $b) => 1,
);',
];
Copy link
Member

Choose a reason for hiding this comment

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

IMHO it should be:

Suggested change
yield 'support for arrow function' => [
'<?php
Utils::stableSort(
$elements,
/**
* @param int $a
*
* @return array
*/
static fn(int $a) => [$a],
fn($a, $b) => 1,
);',
'<?php
Utils::stableSort(
$elements,
/**
* @param int $a
*
* @return array
*/
static fn($a) => [$a],
fn($a, $b) => 1,
);',
];
yield 'arrow function' => [
'<?php /** @param int $a */ fn(int $a) => 1;',
'<?php /** @param int $a */ fn($a) => 1;',
];
yield 'support for arrow function' => [
'<?php
Utils::stableSort(
$elements,
/**
* @param int $a
*/
static fn(int $a) => [$a],
fn($a, $b) => 1,
);',
'<?php
Utils::stableSort(
$elements,
/**
* @param int $a
*/
static fn($a) => [$a],
fn($a, $b) => 1,
);',
];
  • basic arrow function test case
  • complex arrow function test case
  • @return annotations are superfluous here, since this fixer handles only @param

But I was too late 😅.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants