What's the meaning of @var in php comments

后端 未结 6 1565
Happy的楠姐
Happy的楠姐 2021-02-18 20:01

I see this (@var) in php comments a lot and have no clue what it means. Please tell.

// example.php (taken from yii framework application code)



        
6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-18 20:47

    It is in an inline type hint.

    e.g.

    /* @var bool */
    $switch
    

    In this case it means $this is of type CategoriesController and $data is of type Categories

    Often used by IDEs for type hinting.

提交回复
热议问题