Using Generics with PHP

Поделиться
HTML-код
  • Опубликовано: 1 янв 2025

Комментарии • 48

  • @AngelGMaxwell
    @AngelGMaxwell 4 месяца назад +7

    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!

  • @bulent2435
    @bulent2435 4 месяца назад +2

    Amazing episode. I'll do watch again. Thanks.

  • @isururanawaka5839
    @isururanawaka5839 Месяц назад

    Nice explanation. Thank you.

  • @sinaahmadpour3180
    @sinaahmadpour3180 4 месяца назад

    25 minutes of precious content ❤

  • @khessamahmed7117
    @khessamahmed7117 3 месяца назад +1

    after that amazing course of laravel we want another course about vuejs3 in laravel and livewire pls and thank you Laracasts for everything ♥

  • @abdallakaram5376
    @abdallakaram5376 4 месяца назад +2

    Amazing teacher 👏

  • @ahajri89
    @ahajri89 3 месяца назад

    Wow the way you explain things is quite good big like for you 👍

  • @SowrenSen
    @SowrenSen 4 месяца назад

    Great video. Liked your way of explaining. 👌

  • @TheArmanist
    @TheArmanist 3 месяца назад

    Awesome explanation, thank you

  • @worldofwarplanesgameplay
    @worldofwarplanesgameplay 4 месяца назад +1

    This was really good. Thank you!

  • @arifulhasan634
    @arifulhasan634 Месяц назад

    Impressive 👍

  • @mamdouhzaq
    @mamdouhzaq 4 месяца назад

    Thank you for the lesson sir!

  • @cykonetic
    @cykonetic 4 месяца назад +1

    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?

  • @shirumi2331
    @shirumi2331 3 месяца назад +3

    Let's trade with C#. They give us generics and we give them traits. It's a win-win.

    • @md.redwanhossain6288
      @md.redwanhossain6288 3 месяца назад

      C# doesn't need traits. It has everything a language can imagine..

    • @ZephniStrife
      @ZephniStrife 3 месяца назад +2

      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#?

    • @md.redwanhossain6288
      @md.redwanhossain6288 3 месяца назад

      @@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.

  • @GREAT_SEAEMPEROR
    @GREAT_SEAEMPEROR 4 месяца назад +1

    0:16 greatseaemperor voice reveal!!!!

  • @udayworldwide
    @udayworldwide 3 месяца назад

    that may be added in next version, I hope

  • @dotancohen
    @dotancohen 3 месяца назад +1

    11:40 I think that you meant to say that the factory should not be making Expensive Violins?

  • @elderyglebbeats1438
    @elderyglebbeats1438 3 месяца назад

    What's the diffrence between @implements and @template-implements? I don't understand.

  • @firdavs.ibodullayev
    @firdavs.ibodullayev 3 месяца назад +1

    What is the name of tool, which helps to support generics? PSALM?

  • @ishortsclips
    @ishortsclips 4 месяца назад

    I don’t get it 100% but I love to learn it ❤

  • @AMoktar
    @AMoktar 4 месяца назад

    Thanks ❤

  • @obadaalzidi6452
    @obadaalzidi6452 3 месяца назад

    Thanks for the great video.
    Don't you think that testing such a code would be a nightmare?

  • @JohanJohansson-q6w
    @JohanJohansson-q6w 3 месяца назад

    Nice video! Which theme in PhpStorm are you using? It looks so clean and nice for the eye

    • @jamiebradley2505
      @jamiebradley2505 2 месяца назад

      I think it's called Carbon. I just installed it today and thought it looked familiar!

  • @gryg666
    @gryg666 3 месяца назад

    Why can't you just set the returned type of make function to IGuitar as this is expected?

  • @SXsoft99
    @SXsoft99 4 месяца назад

    you have comments that act like generics
    also for type hinting you should sometimes use "“declare(strict_types=1);”"

  • @houseandhobby6971
    @houseandhobby6971 4 месяца назад +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."

  • @AdnanErlansyah-nx7xp
    @AdnanErlansyah-nx7xp 3 месяца назад

    If we use generic, wouldn't be performance issue?

  • @dumitrualin5156
    @dumitrualin5156 3 месяца назад +1

    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.

  • @moofymoo
    @moofymoo 4 месяца назад +12

    imho not worth it, just use strongly typed language if you really want this type of coding.

    • @ZAcharyIndy
      @ZAcharyIndy 3 месяца назад +3

      Generics will be there in PHP

  • @Quicknuggets
    @Quicknuggets 3 месяца назад +2

    That sucks..

  • @zombiesbyte331
    @zombiesbyte331 3 месяца назад

    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.

  • @romrommi
    @romrommi 3 месяца назад +1

    ah hell nah petir grifin a program?

  • @silasmurithi4706
    @silasmurithi4706 4 месяца назад +2

    First to comment

  • @umardev500
    @umardev500 2 месяца назад

    Why this obsolete language still exist haha

    • @hentype
      @hentype Месяц назад

      PHP is so successful all your inferior languages can't kill it in the last 3 decades. Keep trying, though.

  • @deepakplay
    @deepakplay 3 месяца назад +2

    PHP is a joke

  • @donhunt3649
    @donhunt3649 4 месяца назад +3

    Hope PHP can support generics in future...