refactor: replace magic numbers with named constants (#88)#142
Merged
Conversation
- Add DEFAULT_MAX_BUFFER_SIZE, SCHEMA_BUFFER_SIZE, PATH_BUFFER_SIZE, MAX_STRING_BUFFER_SIZE, BYTES_PER_MB constants to ZVec class - Add DEFAULT_HNSW_M and DEFAULT_HNSW_EF_CONSTRUCTION constants - Replace all magic number literals in ZVec.php with constant references - Update ZVecIndexParams.php to use ZVec::DEFAULT_HNSW_M and ZVec::DEFAULT_HNSW_EF_CONSTRUCTION - Add test_magic_number_constants.phpt verifying all constants and that magic numbers are eliminated from source Fixes #88
5f75d83 to
5a0d7db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces all magic number literals throughout the PHP codebase with named constants for improved readability and maintainability.
Changes
New Constants in class
Files Modified
Tests
Verification
All 128 tests pass (125 passed, 2 expected failures, 1 skipped).
C++ Layer
The switch statements already use proper C++ enum values (, , etc.) — no changes needed there.