Undefined DateTime class in PHPStorm

I want to use the DateTime class, but PHPStorm tells me that the "Undefined class DateTime" and my PHP version is 5.5.9-1 . I am using the version of PHPStorm 2016.1 and I am working with the Yii2 framework (if this gives you any useful information). So, how can I use lint with the correct PHP classes by default?

+8
php datetime yii2
source share
1 answer

You need to use backslash \DateTime or add use DateTime;

+9
source share

All Articles