Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It indicates the namespace where Override exists, which in this case is root level. \Namespace\Class is how namespaces in PHP work. If no \ is specified, it assumes Override is in the same namespace as the class it is being used in, and it would thus fail because it isn't.


If you're using it a lot, you can add a `use` declaration up top:

    <?php
    use Override;
    
    //...
    
    #[Override]
    public function overridenParentFunction(string $stuff) //...




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: