• Solemarc@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    Yes but no. Modern PHP lets you put types in function signatures and it will then attempt to convert your inputs to those types at runtime.

    JS/TS and Python don’t do this. They have optional type annotations that’s treated as syntactic sugar. You can use static checkers against this but if you get an error like “expected string got int” you can still run the code. It won’t behave any differently because you have annotations.