DD COMING TO PHP 9??

Поділитися
Вставка
  • Опубліковано 19 гру 2024

КОМЕНТАРІ • 15

  • @JonnyJKF
    @JonnyJKF 3 години тому

    We've had var_dump and print_r for decades now. Time to add something more like dd() and dump() that also works really easily out of the box to send the dump to a separate panel or file to make it super easy when debugging APIs.

  • @getupkid84
    @getupkid84 5 годин тому +2

    Given that a function in a php class is called a "method", it kinda makes sense to remove the word "function" from the definition given that the parentheses infer that it is a "method"

    • @CottidaeSEA
      @CottidaeSEA 2 години тому

      It works in Java and C# to name a few. I don't see why it wouldn't work in PHP. The function keyword is redundant in a class.

  • @linaori
    @linaori 2 години тому

    Arrow functions for methods: yes
    omitting the function keys: hell yes
    Multiline short closers: no, makes the difference between the 2 too subtle
    Expression as default value: no, inject your dependencies.
    dd() in core php: no. While really nice to always have available, it does _so much more_ than just dumping some data. Making it look pretty is just a bonus. The real strength lies within the frequency it gets updated and adjusted, and the amount of extra information it displays. It would simply not be a good fit in the core. Just write your own dd() if you don't want to install the Symfony dependency.

  • @sonoftroy8572
    @sonoftroy8572 6 годин тому +3

    Native dd(); would be a quality of life addition. Yes for me.

  • @MarcPalau
    @MarcPalau 7 годин тому +3

    For the short
    public function xxx(): type => 'something';
    proposal I would preffer to maintain PHP naming and more familiar structure and propose something more like
    public function xxxx(): type return 'something';
    more like a
    if(bool) return;
    style.

    • @CottidaeSEA
      @CottidaeSEA 2 години тому

      I agree. It's less code and the scoping is single line, so it shouldn't be a problem.

  • @ward7576
    @ward7576 6 годин тому +1

    Inline expressions in promoted properties would be a game changer, imho, otherwise you have to somewhat repeat the process in the constructor body, making the promoted property kind of a chore. I simply don't understand how out of all of those features you want that the least lmao.
    "Looks crazy"... new getters/setters look crazy dawg. "Too much logic in constructor" -> there will be too much logic if you do it the conventional way in the constructor body.

  • @melekRebai
    @melekRebai 3 години тому +1

    But I like my function keyword, I think Nuno wants to rewrite PHP to js 😂

  • @shocchosolutions6275
    @shocchosolutions6275 7 годин тому +2

    Default x debug or another thing in php

  • @dartharc4n1ne5
    @dartharc4n1ne5 2 хвилини тому

    I dont like those changes. Make a pretty and readable language just shittier, for no discernible benefit. dd also feels outside the scope of a build in language command.

  • @danielhaven
    @danielhaven 6 годин тому +8

    Diddy is not coming to PHP.