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

Avoid showing invalid types in the Fix Imports panel #5767

Conversation

junichi11
Copy link
Member

Ignore the following cases

  • array<int, TypeName>
  • array{'key': TypeName}

Example

<?php
namespace Test1;

class Foo {
    
}

namespace Test2;

class Test
{
    /**
     * @param array<'foo', Foo> $param
     */
    public function test1(array $param): Foo {
        return $param['foo'];
    }

    /**
     * @param array{'foo': Foo, "bar": string} $param
     */
    public function test2(array $param): Foo {
        return $param['foo'];
    }
}

Before:

nb-php-avoid-showing-invalid-type-in-fix-imports-panel-before

After:

nb-php-avoid-showing-invalid-type-in-fix-imports-panel-after

Ignore the following cases

- `array<int, TypeName>`
- `array{'key': TypeName}`
@junichi11 junichi11 added the PHP [ci] enable extra PHP tests (php/php.editor) label Apr 3, 2023
@junichi11 junichi11 added this to the NB18 milestone Apr 3, 2023
@junichi11
Copy link
Member Author

junichi11 commented Apr 3, 2023

NOTE: This is related to #4614
The following cases are not supported yet. So, let's ignore them at the moment.

  • array<int, TypeName>
  • array{'key': TypeName}

@junichi11 junichi11 requested a review from tmysik April 3, 2023 23:44
@tmysik tmysik merged commit 20ee705 into apache:master Apr 4, 2023
@junichi11 junichi11 deleted the php-avoid-showing-invalid-type-in-fix-imports-panel branch April 4, 2023 09:26
@zeleznypa
Copy link

❤️🙇‍♂️👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants