typically when I use a collection, the modifiers are wrapped by getters/setters of an entity or similar object. I use those to validate what goes into the collection with the added benefit of application specific exception handling. I appreciate your demonstration as a theory, I, personally don't have much practical use for it. When not use attributes instead of annotations?
C# is my favourite language but damn I love PHP traits, it's basically allowing multiple partial inheritance on a single object, there are ways around this in C# but I can't think of anything as simple as a trait that exists in it to achieve the same thing. @md could you let me know what offers a similar functionality in C#?
@@ZephniStrife usually inheritance is highly discouraged in C# and composition is preferable. However, you can use extension method to extend any class on the fly. Dotnet 10 core will have a new feature called extension that can add property to a class which is even more powerful that extension method.
That was purely academic. When the rubber meets the road where real work gets done, strictly known incoming types are what good functions want and require. If you want to re-write array-functionality using classes....use your generalized collection add/remove methods in a parent class and extend it with child classes that do specialized type-work. Or, check out traits for shared/common behaviors. But in the end...you either want to add numbers, transform strings--work with actual known types. Arrays are the built-in solution to generic collections. True, there's no way to array_sum strings or to substring ints. I want my bugs to be found quickly and explode before i try to deploy. Wanting generics is like saying, "show me breakages from unanticipated behaviors...after i deploy...just for the academic exercise of it."
From what I see PHP is going to C#, very many things added in PHP in latest version, is making PHP very closer to Java or C#, strong types, generics, returning function and so on. I think is a good point also in adding this features. Possible in a few years we will have only a single language, which will have everything that is needed for a server side language to be common.
Not a fan of this at all. If your data is coming from an external source then what use is it. That is what validation is for as well as the way you control the data coming into your classes and methods.
Sir, I must say, you have a good touch and tempo for teaching (also kudos to the video editor!).
I would 100% listen to any more videos and podcast!
Amazing episode. I'll do watch again. Thanks.
Nice explanation. Thank you.
25 minutes of precious content ❤
after that amazing course of laravel we want another course about vuejs3 in laravel and livewire pls and thank you Laracasts for everything ♥
Amazing teacher 👏
Wow the way you explain things is quite good big like for you 👍
Great video. Liked your way of explaining. 👌
Awesome explanation, thank you
This was really good. Thank you!
Impressive 👍
Thank you for the lesson sir!
typically when I use a collection, the modifiers are wrapped by getters/setters of an entity or similar object. I use those to validate what goes into the collection with the added benefit of application specific exception handling. I appreciate your demonstration as a theory, I, personally don't have much practical use for it. When not use attributes instead of annotations?
Let's trade with C#. They give us generics and we give them traits. It's a win-win.
C# doesn't need traits. It has everything a language can imagine..
C# is my favourite language but damn I love PHP traits, it's basically allowing multiple partial inheritance on a single object, there are ways around this in C# but I can't think of anything as simple as a trait that exists in it to achieve the same thing. @md could you let me know what offers a similar functionality in C#?
@@ZephniStrife usually inheritance is highly discouraged in C# and composition is preferable. However, you can use extension method to extend any class on the fly. Dotnet 10 core will have a new feature called extension that can add property to a class which is even more powerful that extension method.
0:16 greatseaemperor voice reveal!!!!
that may be added in next version, I hope
11:40 I think that you meant to say that the factory should not be making Expensive Violins?
What's the diffrence between @implements and @template-implements? I don't understand.
What is the name of tool, which helps to support generics? PSALM?
I don’t get it 100% but I love to learn it ❤
Thanks ❤
Thanks for the great video.
Don't you think that testing such a code would be a nightmare?
Nice video! Which theme in PhpStorm are you using? It looks so clean and nice for the eye
I think it's called Carbon. I just installed it today and thought it looked familiar!
Why can't you just set the returned type of make function to IGuitar as this is expected?
you have comments that act like generics
also for type hinting you should sometimes use "“declare(strict_types=1);”"
That was purely academic. When the rubber meets the road where real work gets done, strictly known incoming types are what good functions want and require. If you want to re-write array-functionality using classes....use your generalized collection add/remove methods in a parent class and extend it with child classes that do specialized type-work. Or, check out traits for shared/common behaviors. But in the end...you either want to add numbers, transform strings--work with actual known types. Arrays are the built-in solution to generic collections. True, there's no way to array_sum strings or to substring ints. I want my bugs to be found quickly and explode before i try to deploy. Wanting generics is like saying, "show me breakages from unanticipated behaviors...after i deploy...just for the academic exercise of it."
If we use generic, wouldn't be performance issue?
From what I see PHP is going to C#, very many things added in PHP in latest version, is making PHP very closer to Java or C#, strong types, generics, returning function and so on. I think is a good point also in adding this features. Possible in a few years we will have only a single language, which will have everything that is needed for a server side language to be common.
imho not worth it, just use strongly typed language if you really want this type of coding.
Generics will be there in PHP
That sucks..
Not a fan of this at all. If your data is coming from an external source then what use is it. That is what validation is for as well as the way you control the data coming into your classes and methods.
ah hell nah petir grifin a program?
First to comment
2nd
@@ryanm.122 😀
Frosty P1ss
Why this obsolete language still exist haha
PHP is so successful all your inferior languages can't kill it in the last 3 decades. Keep trying, though.
PHP is a joke
Hope PHP can support generics in future...