temporalio / temporalio/sdk-php

[Feature Request] Rename Instance / ActivityInstance / WorkflowInstance to wrappers

Open
#820 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
421
Forks
64
Avg merge
1d 1h
Merged PRs (30d)
11

Description

Is your feature request related to a problem? Please describe.

In InvokeActivity::handle

$context = $context->withInstance($instance->getContext())

This is confusing.

ActivityProtoType::getInstance and ActivityProtoType::withInstance are very confusing because the word "instance" means a different thing in these methods.

Describe the solution you'd like
  1. Rename Instance to InstanceWrapper, same for ActivityInstance and WorkflowInstance.
  2. Rename ActivityInstance::$context to ActivityInstanceWrapper::$instance, same for WorkflowInstance.

and change the relevant getters as well. The code above would change to

$context = $context->withInstance($instanceWrapper->getInstance())

That's much more intuitive, isn't it?

ActivityPrototype::getInstance becomes getInstanceWrapper, which, again, I believe to be much more clear.

Additional context

I could submit a PR if this suggestion is something you like.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at InvokeActivity::handle and inspect ActivityProtoType::getInstance, ActivityProtoType::withInstance, ActivityInstance, and WorkflowInstance to map the current instance and context terminology. Done means the requested wrapper names, fields, and relevant getters are updated consistently without changing behavior across their uses.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.