Skip to content

Refactor to remove deprecated logs #88

Closed
Heihokon wants to merge 1 commit intomainfrom
fix-deprecated-log
Closed

Refactor to remove deprecated logs #88
Heihokon wants to merge 1 commit intomainfrom
fix-deprecated-log

Conversation

@Heihokon
Copy link
Collaborator

  • Added a new Types trait for centralized type definitions to enhance PHPStan-level type safety.
  • Updated ContainerInterface to specify argument and return types more accurately.
  • Refactored DefaultStrategy to utilize new CampaignDTO and VariationDTO models for better structure and clarity.
  • Enhanced StrategyAbstract with new methods for building and merging campaign caches.
  • Improved Visitor and VisitorBuilder interfaces with more precise type hints and return types.
  • Updated VisitorDelegate and VisitorFlagInterface to handle nullable FlagDTO types.
  • General code cleanup and type hinting improvements across various visitor-related classes.

feat: Refactor ModificationsDTO to use array for value and add new TargetingDTO, TargetingGroupDTO, and TargetingsDTO models

  • Updated ModificationsDTO to change value type from mixed to array.
  • Introduced TargetingDTO and TargetingGroupDTO for better targeting management.
  • Added TargetingsDTO to encapsulate targeting logic with operators.
  • Created TroubleshootingDTO for handling troubleshooting data.
  • Enhanced Types.php with new type definitions for targeting and troubleshooting.
  • Updated VariationDTO and VariationGroupDTO to integrate new targeting models.
  • Added utility methods in Helper trait for array operations.
  • Improved logging and HTTP client interfaces for better type safety.
  • Refined visitor strategies to handle context updates and troubleshooting more effectively.

feat: Implement ContainerException and enhance ContainerInterface

  • Added ContainerException class for handling container-related errors.
  • Updated ContainerInterface with methods for binding, resolving, and managing instances.
  • Enhanced FlagshipLogManager to accept mixed log levels.
  • Refactored HttpClient for improved error handling and type safety.
  • Updated MurmurHash class for better clarity and functionality.
  • Modified DefaultStrategy to include flag key in activation hits.
  • Adjusted Curl.php to return CurlHandle type for curl_init function.

fix: Update analyze command in composer.json and refactor return types in DecisionManagerAbstract and LogTrait

fix: Update phpstan configuration, refactor array_find method, and enhance type definitions in various classes

fix: Downgrade PHP version in settings, update phpstan commands, and add future configuration

fix: Update composer.json and composer.lock to include new PHPStan rules, adjust phpstan.neon configuration, and improve null checks in various classes

Refactor tests for improved readability and maintainability

  • Updated UsageHitTest to change the order of method calls for better clarity.
  • Removed unused Round trait file from tests.
  • Cleaned up DefaultStrategyTest by standardizing array formatting and removing unnecessary require statements.
  • Enhanced consistency in array structures across multiple test cases.
  • Improved formatting and alignment of assertions for better readability.

Refactor tests for FlagshipLogManager, HttpClient, and DefaultStrategy

  • Updated FlagshipLogManagerTest to improve logging tests, including checks for various log levels and context handling.
  • Enhanced HttpClientTest with comprehensive tests for constructor behavior, cURL initialization, option setting, and HTTP request methods (GET/POST).
  • Simplified DefaultStrategyTest by removing unnecessary comments and improving readability, while ensuring the functionality of visitor context updates and flag activation tests.

fix: Update DefaultStrategyTest to use FlagshipLogManager and improve logging mock setup

Refactor Visitor Strategy Tests for Improved Readability and Consistency

  • Updated test classes to extend BaseTestCase for consistent setup.
  • Replaced direct assertions on visitorCache with VisitorCacheDTO comparisons for better clarity.
  • Refactored context assertions to improve readability and maintainability.
  • Enhanced mock setups for log managers and HTTP clients to streamline test configurations.
  • Consolidated repeated code patterns across tests to reduce redundancy.
  • Ensured consistent formatting and alignment of array structures in test data.

Add unit tests for various DTO classes and exception handling

  • Created TargetingDTOTest to validate the functionality of TargetingDTO.
  • Implemented TargetingGroupDTOTest for testing TargetingGroupDTO behavior.
  • Added TargetingsDTOTest to ensure proper handling of targeting data.
  • Developed TroubleshootingDTOTest to verify the correctness of TroubleshootingDTO.
  • Created TroubleshootingDataTest to test the functionality of TroubleshootingData.
  • Added VariationDTOTest to validate VariationDTO behavior.
  • Implemented VariationGroupDTOTest for testing VariationGroupDTO.
  • Created VisitorCacheDTOTest to ensure VisitorCacheDTO works as expected.
  • Added VisitorCacheDataDTOTest to validate VisitorCacheDataDTO functionality.
  • Implemented ContainerExceptionTest to verify exception handling in the container.

fix: Update SegmentTest to include additional context keys for improved test coverage

fix: Update LogTrait and tests to improve logging behavior and handle deprecated methods

New Features:
- Introduced comprehensive DTO models for campaigns, variations, targeting, and troubleshooting
- Added Types trait for centralized type definitions with PHPStan-level type safety
- Implemented ContainerException for better error handling
- Enhanced visitor strategies with context updates and troubleshooting support

Improvements:
- Removed deprecated FlagshipLogManager8 class
- Updated ModificationsDTO value type from mixed to array for consistency
- Refactored ContainerInterface with improved type specifications
- Updated HttpClient with better error handling and type safety
- Enhanced MurmurHash, Curl, and logging interfaces for clarity
- Added utility methods in Helper trait for array operations
- Improved flag activation with flag key inclusion in hits
- Updated return types across DecisionManagerAbstract and various interfaces

Testing:
- Refactored test suite to use BaseTestCase for consistency
- Added comprehensive unit tests for new DTO classes
- Enhanced test coverage for FlagshipLogManager, HttpClient, and strategy classes
- Improved test readability with standardized formatting and assertions

Configuration:
- Updated PHPStan configuration with new rules and future compatibility
- Enhanced composer.json with additional static analysis tools
- Refined phpstan.neon and added phpstan-future.neon
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant