PHP Notice: Constant YII_DEBUG already defined in yii2/tests/bootstrap.php on line 12

Hi Everyone,

I want to contribute to Yii 2

I am following this guide yii2/git-workflow.md at master · yiisoft/yii2 · GitHub

In section ## Prepare your development environment > 3. Prepare the testing environment

when I run /path/to/yii2 $ php build/build dev/app basic git@github.com:SOHELAHMED7/yii2.git

I am getting below error

PHP Notice:  Constant YII_DEBUG already defined in /path/to/yii2/tests/bootstrap.php on line 12

PHP Fatal error:  Cannot declare class yii\BaseYii, because the name is already in use in /path/to/yii2/framework/BaseYii.php on line 60

Would like to know is there any reliable fix available for the above error?

Some time ago I followed this guide to contribute to Yii 2 and all worked very well.

Interesting. I can’t reproduce that.

I can understand that.

Any hints to solve this ? …

Got a temporary solution by commenting some lines of code. Some code is required twice. I checked build file multiple times but what is causing the issue is still not detected.

File: yii2/build/build

Before

if (!isset($vendorPath)) {
	echo "composer autoloader could not be found.\nYou should run `composer install` in repo root directory.\n";
	exit(1);
}
require __DIR__ . '/../framework/Yii.php';

After (issue fixed)

// if (!isset($vendorPath)) {
// 	echo "composer autoloader could not be found.\nYou should run `composer install` in repo root directory.\n";
// 	exit(1);
// }
// require __DIR__ . '/../framework/Yii.php';