-
Notifications
You must be signed in to change notification settings - Fork 5
feat: autoload files #43
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
Conversation
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.
Pull Request Overview
This pull request refactors the codebase to use Composer's autoload mechanism for files containing global functions and constants, replacing manual require_once statements throughout the codebase. This modernizes the project structure and aligns with PHP best practices.
- Removed all manual
require_oncestatements from source and test files - Added a
filesautoload configuration incomposer.jsonto automatically load utility files containing global functions and constants - Updated 13 files across test and source directories
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| composer.json | Added files autoload configuration to automatically load utility files with global functions and constants |
| src/Assignment/Assignment.php | Removed redundant require_once statements for Util.php and AssignmentService.php |
| src/Assignment/AssignmentService.php | Removed redundant require_once statement for Util.php |
| src/Assignment/DefaultAssignmentFilter.php | Removed redundant require_once statement for AssignmentService.php |
| src/AmplitudeCookie.php | Removed redundant require_once statement for Util.php |
| src/EvaluationCore/EvaluationEngine.php | Removed redundant require_once statement for Util.php |
| src/Flag/FlagConfigFetcher.php | Removed redundant require_once statement for Version.php |
| src/Flag/FlagConfigService.php | Removed redundant require_once statement for Util.php |
| src/Local/LocalEvaluationClient.php | Removed redundant require_once statement for EvaluationCore/Util.php |
| src/Remote/RemoteEvaluationClient.php | Removed redundant require_once statement for Version.php |
| tests/Assignment/AssignmentFilterTest.php | Removed redundant require_once statement for Util.php |
| tests/EvaluationCore/EvaluateIntegrationTest.php | Removed redundant require_once statement for Flag/Util.php |
| tests/EvaluationCore/SelectTest.php | Removed redundant require_once statement for EvaluationCore/Util.php |
| tests/EvaluationCore/TopologicalSortTest.php | Removed redundant require_once statement for EvaluationCore/Util.php |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Ok so after doing a bunch of reading, this looks good after addressing the copilot suggestions. The three constants identified can live in either relevant classes or separate files where appropriate. |
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.
Pull Request Overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
src/Assignment/Assignment.php:78
- The constant
FLAG_TYPE_MUTUAL_EXCLUSION_GROUPis defined insrc/Assignment/AssignmentConstants.phpwithin the same namespace but is not explicitly imported. While it works due to Composer's file autoloading, adduse const AmplitudeExperiment\Assignment\FLAG_TYPE_MUTUAL_EXCLUSION_GROUP;at the top of the file for better clarity and maintainability.
if ($flagType == FLAG_TYPE_MUTUAL_EXCLUSION_GROUP) {
src/Assignment/Assignment.php:93
- The constant
DAY_MILLISis defined insrc/Assignment/AssignmentConstants.phpwithin the same namespace but is not explicitly imported. While it works due to Composer's file autoloading, adduse const AmplitudeExperiment\Assignment\DAY_MILLIS;at the top of the file for better clarity and maintainability.
floor($this->timestamp / DAY_MILLIS);
src/Http/GuzzleHttpClient.php:30
- The constant
GUZZLE_DEFAULTSis defined insrc/Http/GuzzleConstants.phpwithin the same namespace but is not explicitly imported. While it works due to Composer's file autoloading, adduse const AmplitudeExperiment\Http\GUZZLE_DEFAULTS;at the top of the file for better clarity and maintainability.
$this->config = array_merge(GUZZLE_DEFAULTS, $config);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kyeh-amp
left a comment
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.
thanks for addressing that 👍
# [1.3.0](1.2.5...1.3.0) (2025-10-30) ### Features * autoload files ([#43](#43)) ([261c313](261c313))
|
🎉 This PR is included in version 1.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Auto load files.
Possible fix for #40.