Function username (): string, what does this mean?

Today, I took a look at a piece of code of the thinksns+ project. I don"t understand what string means after the method name. I haven"t seen it before. Can anyone explain it?

  protected function username(): string
        {
            return username(
                request()->input("login")
            );
        }
Php
Mar.10,2021

returns a string

New features of php7

clipboard.png


this is a new feature in php 7, specifying the function return value type

Menu