-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace global 'version' variable with Configuration::VERSION class constant #32
base: main
Are you sure you want to change the base?
Conversation
This pull request addresses the issue of using a global variable for the Brevo PHP package version, which can cause conflicts and is deprecated in recent PHP versions. Changes made
Details of the changesclass Configuration
{
/**
* Version of the package
*/
const VERSION = "2.0.0";
// ...
public function __construct()
{
$this->tempFolderPath = sys_get_temp_dir();
$this->userAgent = 'brevo_clientAPI/v' . self::VERSION . '/php';
}
} Benefits of this change
Related issue: #31 Please review this change and let me know if any further modifications are needed. |
lib/Configuration.php
Outdated
@@ -120,7 +124,7 @@ class Configuration | |||
public function __construct() | |||
{ | |||
$this->tempFolderPath = sys_get_temp_dir(); | |||
$this->userAgent = 'brevo_clientAPI/v' . $GLOBALS['version'] . '/php'; | |||
$this->userAgent = 'brevo_clientAPI/v' . self::VERSION . '/php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is the only place where the VERSION constant is used, isn't it better to just write down the full string?
$this->userAgent = 'brevo_clientAPI/v' . self::VERSION . '/php'; | |
$this->userAgent = 'brevo_clientAPI/v2.0.0/php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will apply your suggestion
…the Configuration class
Quality Gate passedIssues Measures |
Rename global 'version' variable to 'version-brevo'
This pull request addresses a potential naming conflict by renaming the global 'version' variable to 'version-brevo' in the Brevo PHP package.
Changes:
This change aims to prevent conflicts with other packages or user code that might use a similar global variable name.
Related issue: #31