Is type hint of push method inappropriate? It seems to conflict with handleMessage
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.1k
- Forks
- 285
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
I learned that type of $job in yii\queue\Queue::push($job) can be mixed except JobInterface instance. That meaings I can pass any type of parameter like string,array or object to this method.
In order to coverting $job to $message, I have to set yii\queue\Queue::$strictJobType to false for avoiding throwing exceptions.
The problem is coming, Why can't I handle receiving message in yii\queue\Queue::handleMessage, this method require message deserialized to be instance of JobInterface. Is this not against push method that allow passing type of non-JobInterface?
Do I need to implement class extend yii\queue\cli\Queue and override handleMessage? No need to do this, I‘m not going to develop new driver. I just use yii-queue according to the type hint of push mehod.
| Q | A |
|---|---|
| yii2-queue version | 2.1.0 |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing yii\queue\Queue::push($job), the strictJobType setting, and yii\queue\Queue::handleMessage, then inspect how the queue driver serializes and deserializes jobs. Determine whether the type contract is inconsistent and identify the expected behavior; done means the contract is corrected or clearly documented with coverage for the reported input types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100