Skip to content

Commit b06c756

Browse files
MattinNaktibalda
authored andcommitted
Fixed redeclaring functions in autoload (Codeception#3575)
Fixed redeclaring functions in autoload
1 parent a9ba9d8 commit b06c756

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

autoload.php

+34-18
Original file line numberDiff line numberDiff line change
@@ -62,32 +62,48 @@ function json_last_error_msg()
6262
}
6363

6464
// function not autoloaded in PHP, thus its a good place for them
65-
function codecept_debug($data)
66-
{
67-
\Codeception\Util\Debug::debug($data);
65+
if (!function_exists('codecept_debug')) {
66+
function codecept_debug($data)
67+
{
68+
\Codeception\Util\Debug::debug($data);
69+
}
6870
}
6971

70-
function codecept_root_dir($appendPath = '')
71-
{
72-
return \Codeception\Configuration::projectDir() . $appendPath;
72+
if (!function_exists('codecept_root_dir')) {
73+
function codecept_root_dir($appendPath = '')
74+
{
75+
return \Codeception\Configuration::projectDir() . $appendPath;
76+
}
7377
}
7478

75-
function codecept_output_dir($appendPath = '')
76-
{
77-
return \Codeception\Configuration::outputDir() . $appendPath;
79+
if (!function_exists('codecept_output_dir')) {
80+
function codecept_output_dir($appendPath = '')
81+
{
82+
return \Codeception\Configuration::outputDir() . $appendPath;
83+
}
7884
}
7985

80-
function codecept_log_dir($appendPath = '')
81-
{
82-
return \Codeception\Configuration::outputDir() . $appendPath;
86+
if (!function_exists('codecept_log_dir')) {
87+
function codecept_log_dir($appendPath = '')
88+
{
89+
return \Codeception\Configuration::outputDir() . $appendPath;
90+
}
8391
}
8492

85-
function codecept_data_dir($appendPath = '')
86-
{
87-
return \Codeception\Configuration::dataDir() . $appendPath;
93+
if (!function_exists('codecept_data_dir')) {
94+
function codecept_data_dir($appendPath = '')
95+
{
96+
return \Codeception\Configuration::dataDir() . $appendPath;
97+
}
8898
}
8999

90-
function codecept_relative_path($path)
91-
{
92-
return \Codeception\Util\PathResolver::getRelativeDir($path, \Codeception\Configuration::projectDir(), DIRECTORY_SEPARATOR);
100+
if (!function_exists('codecept_relative_path')) {
101+
function codecept_relative_path($path)
102+
{
103+
return \Codeception\Util\PathResolver::getRelativeDir(
104+
$path,
105+
\Codeception\Configuration::projectDir(),
106+
DIRECTORY_SEPARATOR
107+
);
108+
}
93109
}

0 commit comments

Comments
 (0)