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

[Downgrade 8.0] Union Type downgrade on anonymous functions #5989

Closed
leoloso opened this issue Mar 25, 2021 · 4 comments
Closed

[Downgrade 8.0] Union Type downgrade on anonymous functions #5989

leoloso opened this issue Mar 25, 2021 · 4 comments
Labels

Comments

@leoloso
Copy link
Contributor

leoloso commented Mar 25, 2021

Feature Request

DowngradeUnionTypeDeclarationRector is currently not handling anonymous functions, so it must be completed.

I can work on it.

Diff

$ids = array_map(
-    function (int | string $id) {
+    function ($id) {
        return 'v' . $id;
    },
    $ids
);
leoloso added a commit to GatoGraphQL/GatoGraphQL that referenced this issue Mar 25, 2021
@TomasVotruba
Copy link
Member

Go for it 👍

@leoloso
Copy link
Contributor Author

leoloso commented Apr 24, 2021

@TomasVotruba I offered to do it 1 month ago, when I had a window of time. Now I'm pretty busy. So please wait some 45 days, when I finish my deadline.

Otherwise, your team can also do it (this one will take you guys like 3 min to do).

Same with #5961.

Also, I just found out that the mixed type in anonymous functions is also not being downgraded:

$foo = array_filter(
  $list,
  // This needs be removed for PHP 7.1, currently it is not
  function (mixed $fieldArgValue) {
    return is_null($fieldArgValue);
  }
);

And maybe there are other things in anonymous functions that need be downgraded?

@TomasVotruba
Copy link
Member

For a bugfix just send PR next time, no need to create issues that stale ;)

@TomasVotruba
Copy link
Member

Closing as we don't use union types in downgraded Rector yet. Feel free to contribute 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants