Skip to content

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

@Ndiritu

Description

@Ndiritu

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done ✔️

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions