Skip to content

Commit c522fb8

Browse files
committed
refactor: Modernize PHP SDK with enhanced type safety and new DTO models
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
1 parent 1cb50f3 commit c522fb8

144 files changed

Lines changed: 11200 additions & 3958 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ flagship
99
/.phpunit.cache
1010
demo-test.php
1111
docker-compose.demo.yml
12+
sample.php
13+
sample.php

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
},
99
"php-cs-fixer.executablePath": "./vendor/bin/php-cs-fixer",
1010
"php-cs-fixer.onsave": true,
11+
"intelephense.environment.phpVersion": "8.1.0",
1112
}

composer.json

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
"name": "flagship-io/flagship-php-sdk",
33
"type": "library",
44
"description": "Flagship PHP SDK",
5-
"keywords": ["flagship", "sdk", "flagship-php"],
5+
"keywords": [
6+
"flagship",
7+
"sdk",
8+
"flagship-php"
9+
],
610
"homepage": "https://github.com/flagship-io/flagship-php-sdk",
711
"authors": [
812
{
@@ -18,7 +22,12 @@
1822
},
1923
"require-dev": {
2024
"squizlabs/php_codesniffer": "^3.10",
21-
"phpunit/phpunit": "^9.6"
25+
"phpunit/phpunit": "^9.6",
26+
"phpstan/phpstan": "^2.1",
27+
"phpstan/phpstan-deprecation-rules": "^2.0",
28+
"phpstan/phpstan-strict-rules": "^2.0",
29+
"phpstan/phpstan-phpunit": "^2.0",
30+
"php-mock/php-mock-phpunit": "^2.14"
2231
},
2332
"autoload": {
2433
"psr-4": {
@@ -31,8 +40,19 @@
3140
}
3241
},
3342
"scripts": {
43+
3444
"test": "phpunit",
45+
"test:all": [
46+
"@phpstan:all",
47+
"phpunit"
48+
],
3549
"check-style": "phpcs --standard=PSR12 -n src tests",
36-
"fix-style": "phpcbf --standard=phpcs.xml src tests"
50+
"fix-style": "phpcbf --standard=phpcs.xml src tests",
51+
"phpstan": "phpstan analyse --configuration=phpstan.neon --memory-limit=512M",
52+
"phpstan:future": "phpstan analyse --configuration=phpstan-future.neon --memory-limit=512M",
53+
"phpstan:all": [
54+
"@phpstan",
55+
"@phpstan:future"
56+
]
3757
}
3858
}

0 commit comments

Comments
 (0)