kkspy: It's just shorthand for "whatever the name of the class you're defining the method in is".

Alphos

ooooh, new syntax !

jkoudys

LawnGnome, that's mostly what I want.. any child class will be an instance of the parent by definition, though it'll miss cases like static functions that return `self`, when I really wanted them to return `static`

kkspy

LawnGnome: get_called_class() or __CLASS__ ?

LawnGnome

kkspy: __CLASS__

hassoon

__NOPE__

jkoudys

I think that's a really readable syntax if you're building a class with methods intended for function chaining

kkspy

LawnGnome: that's a pity, get_called_class() behaviour (static) would look much more reasonable there.

jkoudys

since it's immediately obvious that anything : self is chainable

LawnGnome

jkoudys: Yeah, that would be an obvious addition down the track. Bear in mind that some of the possibilities for return types haven't been implemented in 7.0 at some point I assume some concept of covariance will be added, so I would suspect it'll get revisited then.

jkoudys

LawnGnome, covariance would be nice. I like anything that replaces excessive PHPDoc patterns that everyone was doing the same way

LawnGnome, though for me, nullable return types should be the main thing to push for

ecart

how do I make such a number : 12312312312stay like this:123123123-12123.123.123-12this

jkoudys

we can sorta nullable our type hints, but a lack of it on return types really limits a lot of very useful patterns. e.g. a `isUserActive(): boolean` method is nice since that's a clear true/false, but `getActiveUser(): ?User` would also be wonderful, since then it would return a user if they're active, or a null if they're notworks marvellously in hack

kkspy

LawnGnome: get_called_class(), not __CLASS__ actually :)

ecart

how do I make such a number : 12312312312 stay like this: 123.123.123-12?

kkspy

Essentially 'self' checks it like: if ($return instanceof $this)

jkoudys

kkspy, did you check the actual opcodes to figure that out?

kkspy

jkoudys: nope, why?

jkoudys

kkspy, well you could compare and see if the return-type hint is actually executing get_called_class() underneathI've been pretty surprised about what I've seen around instanceof behaviour