The inability to "lock" variables to certain types in PHP.

  • 0
    Isn't that a dynamic typing?
  • 9
    My mans complaining about data types in a loosely typed language :D

    At least you can set expected parameter and return types in newer PHP versions now
  • 4
    ...what did you expect?
  • 5
    As far as I'm aware this is possible in PHP 8
  • 2
    @linuxxx Nice.

    I'm pretty stoked for PHP 8 : >

    It adds so much new features, tho I am mostly stoked about the JIT.

    I've already ran some near-realworld tests (realworld app, simulated load) with my site's codebase a month or 2 ago and it has shown me quite significant increase in capability, the main issue at that point became the database :^)
  • 0
    @linuxxx wait, there's php 8?
  • 2
    @iiii Coming soon, yes!
  • 0
    Type hints and annotations will go a long way especially if you use a decent IDE like PHPStorm.
  • 0
    @hjk101 I use VSCode tho.

    Cus I don't like that I need to pay a fairly hefty (for my standards) fee for it...
  • 0
    I think they have the annotation parsing in intellisense too.

    It's worth the price (it's reasonable) in my opinion, though I get it from the office. When an early access comes out you can get it for free though.
  • 1
    @hjk101 Yea, Intellisense works quite alright for annotation parsing.

    I mean, difference between you and me is that you probably get a decent pay :p

    I'm currently unemployed so buying things to "improve development" is kinda a no-go unless it has a decent ROI (which is nothing atm cus I don't really get paid for anything)
  • 0

    Strict typing isn't new. Exists since PHP 7.

    PHP 8s most awaited feature is WeakRefMap.
  • 0
    @IntrusionCM well... yes but also no...

    I can pass types in a function and what the function returns but I can't say:


    int $myVar = 1;

    $myVar = 'yes' // Exception here

Add Comment