Skip to content

Conversation

@juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Jul 28, 2022

Some IDEs currently do not support conditional return type annotations as we use it, so this makes sure that the get/query methods still provide some useful type in those cases. The @psalm- prefixed annotations will ensure that psalm still handles the conditional.

Ref https://youtrack.jetbrains.com/issue/WI-66465/Support-parsing-of-PhpStans-conditional-return-types

With this change PHPStorm can for example properly indicate the types of:

$s1 = \OCP\Server::get(\OCP\IUserSession::class);
$s2 = \OC::$server->get(\OCP\IUserSession::class);
$s3 = \OC::$server->query(\OCP\IUserSession::class);

@juliusknorr juliusknorr added the 3. to review Waiting for reviews label Jul 28, 2022
@juliusknorr juliusknorr requested review from a team, CarlSchwan, ChristophWurst, PVince81 and icewind1991 and removed request for a team July 28, 2022 05:54
@juliusknorr juliusknorr force-pushed the enh/container-annotations branch from a48f05f to 85f7b36 Compare July 28, 2022 07:52
@juliusknorr
Copy link
Member Author

Fixed psalm errors in a fixup and updated the baseline for the ones that we cannot fix currently due to vimeo/psalm#7549. Fixup commits are kept for easier review, but will squash later on.

@juliusknorr juliusknorr force-pushed the enh/container-annotations branch from 85f7b36 to 0bf8e30 Compare October 14, 2022 05:54
@juliusknorr juliusknorr force-pushed the enh/container-annotations branch from 0bf8e30 to cea2f79 Compare October 14, 2022 08:45
@juliusknorr juliusknorr merged commit 0ac2a90 into master Oct 14, 2022
@juliusknorr juliusknorr deleted the enh/container-annotations branch October 14, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants