ความคิดเห็น •

  • @vudaltsov
    @vudaltsov 3 หลายเดือนก่อน +13

    Thank you very much for reviewing my RFC!

    • @phpannotated
      @phpannotated 3 หลายเดือนก่อน +1

      Thank you for making it!

  • @syracuse4612
    @syracuse4612 3 หลายเดือนก่อน +7

    this was contributed by Valentin Udaltsov from PHPoint channel

  • @qqleq
    @qqleq 3 หลายเดือนก่อน +4

    FINALLY!

  • @JohnRoux
    @JohnRoux 3 หลายเดือนก่อน

    :D Had a good chuckle at the "it didn't get any upvotes" :D
    I'll go give you an upvote Brent! You deserve it!

  • @phpannotated
    @phpannotated 3 หลายเดือนก่อน +5

    How much of your code will you be able to refactor? 🤓

    • @kayodole9411
      @kayodole9411 3 หลายเดือนก่อน

      it can be automated with rectorPHP

  • @rhinni
    @rhinni 2 หลายเดือนก่อน

    The static constructor would especially be useful for dynamic instantiation, e.g. $className::new() vs new $className() due to IDE and static analysis support. At least right now in PHPStorm $className::make() has IDE support for me, new $className() does not

    • @phpannotated
      @phpannotated 2 หลายเดือนก่อน

      I'll check with the team if we can improve this 👍

    • @phpannotated
      @phpannotated 2 หลายเดือนก่อน +1

      I checked, apparently it works in simple cases, what was your specific use case where it didn't?

    • @rhinni
      @rhinni 2 หลายเดือนก่อน

      ​@@phpannotated I don't remember, but maybe it's mainly just being able to click on the ::make() part to go to definition, while you can't click on the braces in new $className()

  • @CottonInDerTube
    @CottonInDerTube 2 หลายเดือนก่อน +1

    new MyClass()() opens up for typo or replacement errors.
    Im not a fan of (new MyClass())->... , but also dont really like the new new MyClass()->... .
    I stick to $object = new MyClass(); $object->... .

  • @theargentum
    @theargentum 3 หลายเดือนก่อน

    Cool. Still waiting for some real improvements like damned function overloading...

    • @phpannotated
      @phpannotated 3 หลายเดือนก่อน

      Personally not a fan of the idea of function overloading, but that might change if they ever get added :)

    • @barneylaurance1865
      @barneylaurance1865 3 หลายเดือนก่อน

      Do you mean double dispatch? I don't see how you can have compile time function overloading when variables are dynamically typed.

    • @theargentum
      @theargentum 3 หลายเดือนก่อน

      @@barneylaurance1865 No, I mean function overloading. So I wont have to write ugly ifs with func_*() functions. I'm not quite sure what you mean about compile time, because php is an interpreted language (did you mean parsing?). Nevertheless in php we have precious type-hints that really work

    • @barneylaurance1865
      @barneylaurance1865 3 หลายเดือนก่อน

      @@theargentum PHP does have a compiler, its just very fast so you don't notice it running.
      I think what you're talking about is indeed double dispatch - meaning the function to call is looked up not just bye the type of the parameter on the left of the arrow as it is now but also by the type of the param(s) on the right.

  • @0zankurt
    @0zankurt 3 หลายเดือนก่อน +5

    It's just reducing the readability, I hope they don't turn this into typescript...

    • @_codito
      @_codito 3 หลายเดือนก่อน

      Yeah, because JavaScript and readability go hand in hand 😅.
      (foo[bar?'baz1':'baz2']())().buzz()

    • @phpannotated
      @phpannotated 3 หลายเดือนก่อน +6

      Oh I hope they do!! 🔥

  • @tagKnife
    @tagKnife 3 หลายเดือนก่อน +2

    I dont like it.
    It makes the scope of the class ambigious. That was the purpose of the brackets. To tell the developer "Hey this expression wont exist when the brackets are closed!"

    • @phpannotated
      @phpannotated 3 หลายเดือนก่อน +4

      Well the RFC explains how that ambiguity already exists in PHP without the RFC, so it doesn't really make a difference.