Repository navigation
Conversation
- Can be used to create unique context instances related with a specific Request
|
Thanks for this @mmoreram, a couple of comments:
Final thought, since this object can be passed down through layers, does it make sense to decouple it from http? Could this be somewhere else like in driftphp-core? |
|
@jcchavezs Thanks so much for this review.
About the package, yes, you might be right. Maybe a small package for that would be enough, or even using an existing one. |
|
Hi thanks for the answer.
It can be a number or an array. I think restricting to strings will cause unnecessary casting on write and read.
This is the thing, if you accept arrays you just retrieve the array and no need to iterate. In my opinion it is easier to allow arrays rather than having to iterate and consider that if one wants to update that list then there is no way to remove entries.
Totally, I meant
Long time ago I created a package for prototyping: https://github.com/jcchavezs/tracing-context-php. Many things changed both in my understanding of the problem and the use cases itself. I think we could come up with a new package and evolve it independently? |
| * | ||
| * @return string[] | ||
| */ | ||
| public function all(): array |
There was a problem hiding this comment.
@mmoreram Just a small comment. 😉
The return type here will fail when you create an object like this: $context = new Context();. For example in the constructor of the RequestWithContext class. Being created this way property $values contains null.
There was a problem hiding this comment.
Touché!
Thanks for that!
This class needs and deserves Unit Testing.
|
@jcchavezs I'm OK with everything, but with the What will you use this class for in the future? I will create a |
|
Closing this PR as is completely outdated. We can reopen it if needed. |
Request