DEV Community

Discussion on: PHP 8: before and after

Collapse
 
dakujem profile image
Andrej Rypo

Thank you for this useful post!

In php 7.x, one can use self as the return type hint to achieve most of the type safety (at least much better than no type hint)

/**
 * @return static
 */
public static function new(): self {
    return new static();
}
Enter fullscreen mode Exit fullscreen mode