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

PHP - Improve auto-completion experience for returned objects #3542

Closed
2 of 4 tasks
Ndiritu opened this issue Oct 23, 2023 · 1 comment · Fixed by #3568
Closed
2 of 4 tasks

PHP - Improve auto-completion experience for returned objects #3542

Ndiritu opened this issue Oct 23, 2023 · 1 comment · Fixed by #3568
Assignees
Labels
enhancement New feature or request PHP WIP
Milestone

Comments

@Ndiritu
Copy link
Contributor

Ndiritu commented Oct 23, 2023

At the moment request executors: get(), post() etc return a Promise but we don't have a way to specify what object the Promise will resolve to. The developer experience is impacted when working with returned objects where IDE's do not provide autocompletion e.g.

$user = $graphServiceClient->users()->byUserId('x')->get()->wait();
// IDE's will not provide autocompletion here
$user->...

This is due to a limitation with the PHP Promises implementation. However, there's an already approved PR, pending merging to address this.

Solution:

  • Promises library gets PR merged.
  • Add return type to Promise PHPDoc for request executor methods e.g.
/**
* @return Promise<User>
* /
public function get(): Promise {}
  • Update Kiota core libs to use Promises with Generics
  • Update all Kiota samples & tutorials new changes
@Ndiritu Ndiritu added enhancement New feature or request PHP labels Oct 23, 2023
@Ndiritu Ndiritu added this to the Kiota v1.8 milestone Oct 23, 2023
@Ndiritu Ndiritu self-assigned this Oct 23, 2023
@Ndiritu Ndiritu added this to Kiota Oct 23, 2023
@github-project-automation github-project-automation bot moved this to Todo in Kiota Oct 23, 2023
@baywet
Copy link
Member

baywet commented Oct 24, 2023

Update: the PR on the dependency has been merged and released php-http/promise#27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PHP WIP
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants