I'm always confused with all those packages for data mapping. Especially when working with Symfony, why not use the Symfony Serializer for that? Can anyone tell me what they do better? 🙂
While I am completely on board with Brent's idea of knowing what your code does via return types (and doc blocks for those pesky, but sometimes necessary arrays >.
Well, when controller files get generated with return types, it's immediately clear to the programmer what they can return from those methods. So for me it's not about whether you call those methods or not, it's about what to return from them when implementing them :)
@@phpannotated if I remember correctly the stubs used a Response object as the return type. This can be confusing for beginners as they probably try to return a view()
From personal experience, trying not to break backwards compatibility is very limiting to a framework and frustrating for framework developers. I think you should definitely make upgrading as easy as possible, but if you make your breaking changes compile-time visible then go for it. As for generics, I want them, but also I want non-runtime array interfaces, badly.
45:30 Here, me. I dont want generics. public function setUserCollection(UserCollection $collection){} vs public function setCollection(Collection $collection){} I prefer "UserCollection".
@@ddruganov yep, PXP is a nice prototype, we'll see where it goes. I'd say for generics specifically, PHPDoc+PhpStorm+Psalm/PHPStan is already good enough, though.
I love these "podcast style videos" talking about the latest hot topics on PHP. Keep it up! 🚀
Thanks for having me! 🙏🏻😊
I'm always confused with all those packages for data mapping. Especially when working with Symfony, why not use the Symfony Serializer for that? Can anyone tell me what they do better? 🙂
While I am completely on board with Brent's idea of knowing what your code does via return types (and doc blocks for those pesky, but sometimes necessary arrays >.
Well, when controller files get generated with return types, it's immediately clear to the programmer what they can return from those methods. So for me it's not about whether you call those methods or not, it's about what to return from them when implementing them :)
@@phpannotated This is true, but do we actually want the generators to account for every possible usecase?
@@phpannotated if I remember correctly the stubs used a Response object as the return type. This can be confusing for beginners as they probably try to return a view()
From personal experience, trying not to break backwards compatibility is very limiting to a framework and frustrating for framework developers. I think you should definitely make upgrading as easy as possible, but if you make your breaking changes compile-time visible then go for it.
As for generics, I want them, but also I want non-runtime array interfaces, badly.
45:30 Here, me. I dont want generics.
public function setUserCollection(UserCollection $collection){}
vs
public function setCollection(Collection $collection){}
I prefer "UserCollection".
theres PXP, a php superset that supports generics
Yeah, Brent and I discussed it in the previous edition of PHP Annotated. PXP is a cool project indeed.
@@romanpronskiy stuff becomes cool when the tooling is good enough; so far its just a nice prototype
@@ddruganov yep, PXP is a nice prototype, we'll see where it goes. I'd say for generics specifically, PHPDoc+PhpStorm+Psalm/PHPStan is already good enough, though.
@@romanpronskiy yeah true, im using the same toolchain