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: add types to anonymous functions #7561

Merged
merged 1 commit into from Dec 15, 2023
Merged

DX: add types to anonymous functions #7561

merged 1 commit into from Dec 15, 2023

Conversation

kubawerlos
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Dec 15, 2023

Coverage Status

coverage: 94.785%. remained the same
when pulling 420fe82 on 6b7562617765726c6f73:dx_add_types_to_anonymous_functions
into dbb7816 on PHP-CS-Fixer:master.

@kubawerlos kubawerlos enabled auto-merge (squash) December 15, 2023 15:12
@kubawerlos kubawerlos merged commit a850084 into PHP-CS-Fixer:master Dec 15, 2023
25 checks passed
@kubawerlos kubawerlos deleted the dx_add_types_to_anonymous_functions branch December 15, 2023 18:04
@@ -308,7 +308,7 @@ private function isTypeSortable(TypeAnalysis $type): bool
*/
private function collectDisjunctiveNormalFormTypes(string $type): array
{
$types = array_map(static function ($subType) {
Copy link
Member

Choose a reason for hiding this comment

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

any SCA to prevent adding another not-typed lambdas?

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've spotted these with slam/phpstan-extensions but was not able to fix all of the types (some lambdas need multiple types and with PHP 7.4 we cannot have them).

Copy link
Member

Choose a reason for hiding this comment

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

@kubawerlos
maybe for those cases we can add mixed typehint, and prevent adding any more untyped lambdas?
then, we deal with mixed afterwars

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely, as soon as we drop PHP 7.4 support.

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

4 participants