klesun / deep-assoc-completion

A phpstorm plugin for associative array key typing and completion
Other
266 stars 17 forks source link

Completion from phpdoc `@method` stopped working because phpstorm now supports it #134

Closed klesun closed 4 years ago

klesun commented 4 years ago

Hence the syntax tree structure got changed:

Error in provide_psalmMagicDoc #0  Result does not have expected keys: author, unpopularSong
Error in providePropDocComment #3  Result does not have expected keys: status, affected_rows

image

bravoman commented 4 years ago

Ok, so this is the issue and not my database connection or something like that...

I use this type of "hack" everywhere and it seems to be broken (likely because of this issue 😉 ) image

Glad to see you picked it up already.

klesun commented 4 years ago

yeah, sorry about that, will fix as soon as I get a bit of free time

bravoman commented 4 years ago

You saved me lots of time and possible bugs already, I'll manage until then :D

On 14 Jan 2020, at 15:51, Artur Klesun notifications@github.com wrote:

yeah, sorry about that, will fix as soon as I get a bit of free time

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/klesun/deep-assoc-completion/issues/134?email_source=notifications&email_token=AANGKCXG23W7ZDME2QZNYXLQ5XGOTA5CNFSM4KC6R26KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI44ABY#issuecomment-574210055, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANGKCXLVFC6VGDU2PCINNDQ5XGOTANCNFSM4KC6R26A.

bravoman commented 4 years ago

Seems that the following is not working for me anymore as well:

/**
 * Dockblock
 * @return array [ ['bar' => 'foo'] ] 
 */
public function foo() {
     return $this->bar('foo');
}

Not sure if it's related.

klesun commented 4 years ago

Fix for the @method issue released in 2020.01.15.001

image

@bravoman, could you, please, give a bit more context to the @return array [] use case? Should the completion be provided in the $this->bar('') string argument? What is the implementation of the $this->bar then? Did you mean something like this, per chance? image Or like this? image

bravoman commented 4 years ago

The first one.

klesun commented 4 years ago

Does it work now? (the fix supposedly should not have affected the @return tag, but still...)

klesun commented 4 years ago

If it still does not work, could you, please file a separate issue with minimal reproducible case and your phpstorm version?

klesun commented 4 years ago

Btw, as a side note, relating your "hack" for db table completion, you may find this helpful - you can type @method array getById(int $id) = Magic::dbRow('my_table') instead of @method array getById(int $id) = (new \PDO())->query('SELECT * FROM my_table')->fetch(\PDO::FETCH_ASSOC)

bravoman commented 4 years ago

Does it work now? (the fix supposedly should not have affected the @return tag, but still...)

Works! But it turns out I had an error in my docblock code. Forgot the @ before return 😬 🤦‍♂

You can close this issue.

Btw, as a side note, relating your "hack" for db table completion, you may find this helpful - you can type @method array getById(int $id) = Magic::dbRow('my_table') instead of @method array getById(int $id) = (new \PDO())->query('SELECT * FROM my_table')->fetch(\PDO::FETCH_ASSOC)

That's awesome! Seems like something for the Readme.md so everyone can use this 👍