I am currently dealing with a third-party library that defines a global username/password constants in a global namespace. I do not want to modify the library source code at the same time I need to connect with different credentials (i.e. more than one set). Therefore, editing the library source code is not the solution. To be honest even without this requirement this is not a good practice to modify the 3rd-party libraries source code as it may lead to unexpected results when updating.
define('OSRS_USERNAME', $credentials[self::USERNAMETAG]);
define('OSRS_KEY', $credentials[self::PASSWORDTAG]);
$host = isset($credentials['testmode']) ? self::TESTHOST : self::LIVEHOST;
define('OSRS_HOST', $host);
define('OSRS_SSL_PORT', self::PORT);
//only now we can require the openSRS loader as it otherwise would define other values as contants for username & password
//@ is here to supress warnings about redefining the credentials constants in the 3rd party config file
//this is safe as just including the file shoould not throw if the script does not have any syntax errors
@require_once('OpenSRS/openSRS_loader.php');
This, however, still outputs the warning in CLI
Is there any way to suppress those warnings?