Skip to content
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

Config v6 #44

Merged
merged 39 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e7b3690
Add VSCode devenv configuration
adams85 Jan 24, 2024
ccebd01
Run tests on PHP 8.3
adams85 Jan 25, 2024
02b415b
Update config JSON model to v6 + fix inconsistent error 1000 reportin…
adams85 Jan 25, 2024
7388f26
Refactor evaluator and evaluation logging to prepare it for the new f…
adams85 Feb 6, 2024
5439629
Implement new comparison operators
adams85 Feb 8, 2024
2067e05
Implement segment condition evaluation
adams85 Feb 8, 2024
5185ce2
Implement prerequisite flag condition evaluation
adams85 Feb 8, 2024
60f0d40
Implement SDK key format validation + fix broken tests
adams85 Feb 8, 2024
29c0525
Rename EvaluationDetails.getMatched* properties
adams85 Feb 8, 2024
3217bc0
Improve message of error 1103
adams85 Feb 8, 2024
0f102b9
Add matrix tests
adams85 Feb 8, 2024
211b085
Align config json error handling of EvaluateLogBuilder with error rep…
adams85 Feb 14, 2024
930f051
Improve naming
adams85 Feb 14, 2024
af1fab1
Add exception to the log format in DefaultLogger
adams85 Feb 15, 2024
576a5ac
Add tests for evaluation logging + minor fixes
adams85 Feb 15, 2024
afb542f
Add User Object tests
adams85 Feb 16, 2024
eecb4f3
Add tests for sdk key format validation
adams85 Feb 16, 2024
7ac31b5
Add user attribute conversion tests + re-implement Utils.numberToStri…
adams85 Feb 16, 2024
c4409bb
Add comparison attribute and comparison value trimming tests
adams85 Feb 22, 2024
fe3147c
Add special character tests
adams85 Feb 22, 2024
608a341
Add tests for EvaluationDetails.getMatchedTargetingRule/getMatchedPer…
adams85 Feb 22, 2024
7c46fbe
Add flag overrides vs. prerequisite flags, config json salt and segme…
adams85 Feb 22, 2024
f79a2ca
Add override value type mismatch tests
adams85 Feb 22, 2024
5a175b1
Finishing touches
adams85 Feb 23, 2024
b8b264d
Fix code formatting
adams85 Feb 23, 2024
0085006
Fix PHP version number
adams85 Feb 23, 2024
06a0b22
Improve naming (Preferences::REDIRECT -> REDIRECT_MODE)
adams85 Feb 26, 2024
d7eba3f
Improve naming (fixup -> inlineSaltAndSegments)
adams85 Feb 29, 2024
9c06845
Prevent invalid attribute value from potentially causing an exception
adams85 Feb 29, 2024
451bf4e
Minor code improvements (simplify logBuilder calls)
adams85 Feb 29, 2024
ee584bc
Fix formatting
adams85 Feb 29, 2024
792668a
Fix typo
adams85 Feb 29, 2024
02304b8
Fix type annotations
adams85 Feb 29, 2024
0a5b663
Improve naming (inlineSaltAndSegments -> fixupSaltAndSegments)
adams85 Feb 29, 2024
0d04d52
Correct visibility of appendTargetingRuleThenPart
adams85 Feb 29, 2024
b3116ae
Minor corrections
adams85 Feb 29, 2024
c6ac251
Correct intellisense doc
adams85 Mar 4, 2024
7d864eb
Bump version
adams85 Mar 4, 2024
3db0359
Update package version in samples
adams85 Mar 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.1', '8.2' ]
php-versions: [ '8.1', '8.2', '8.3' ]
steps:
- uses: actions/checkout@v4

Expand Down
7 changes: 5 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

$finder = PhpCsFixer\Finder::create()
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;

$config = (new PhpCsFixer\Config())
$config = (new Config())
->setRules([
'@PhpCsFixer' => true,
'@PSR2' => true,
Expand Down
21 changes: 21 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
// For intellisense and navigation in code:
"bmewburn.vscode-intelephense-client",

// For formatting and linting:
"junstyle.php-cs-fixer",
"SanderRonde.phpstan-vscode",

// For exploring and running tests:
"hbenl.vscode-test-explorer",
"recca0120.vscode-phpunit",

// For debugging:
"xdebug.php-debug" // to make this work, you need xdebug installed - see the description of the extension
],

// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// To debug tests, you need to launch this configuration first, then run the test to debug from the test explorer.
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
}
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"intelephense.environment.phpVersion": "8.1.0",
// On Linux, replace "phpdebug.bat" with "XDEBUG_MODE=debug php".
// To make debugging work, you also need xdebug.start_with_request=yes in php.ini!
"phpunit.php": "phpdebug.bat",
"phpunit.args": [
"-c",
"phpunit.xml"
],
"php-cs-fixer.executablePath": "php-cs-fixer",
"php-cs-fixer.executablePathWindows": "${workspaceFolder}/vendor/bin/php-cs-fixer.bat",
"[php]": {
"editor.defaultFormatter": "junstyle.php-cs-fixer"
},
"phpstan.configFile": "phpstan.neon"
}
4 changes: 4 additions & 0 deletions phpdebug.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
set XDEBUG_MODE=debug
php %*
2 changes: 1 addition & 1 deletion samples/consolesample/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"configcat/configcat-client": "^6",
"configcat/configcat-client": "^9",
"monolog/monolog": "^1.0"
}
}
2 changes: 1 addition & 1 deletion samples/laravel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"require": {
"php": "^7.2.5",
"configcat/configcat-client": "^6",
"configcat/configcat-client": "^9",
"fideloper/proxy": "^4.0",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0"
Expand Down
14 changes: 0 additions & 14 deletions src/Attributes/Config.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/Attributes/PercentageAttributes.php

This file was deleted.

14 changes: 0 additions & 14 deletions src/Attributes/Preferences.php

This file was deleted.

17 changes: 0 additions & 17 deletions src/Attributes/RolloutAttributes.php

This file was deleted.

17 changes: 0 additions & 17 deletions src/Attributes/SettingAttributes.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/Cache/ConfigCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace ConfigCat\Cache;

use Exception;
use InvalidArgumentException;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Throwable;

/**
* A cache API used to make custom cache implementations.
Expand All @@ -33,7 +33,7 @@

try {
$this->set($key, $value->serialize());
} catch (Exception $exception) {
} catch (Throwable $exception) {

Check warning on line 36 in src/Cache/ConfigCache.php

View check run for this annotation

Codecov / codecov/patch

src/Cache/ConfigCache.php#L36

Added line #L36 was not covered by tests
$this->logger->error('Error occurred while writing the cache.', [
'event_id' => 2201, 'exception' => $exception,
]);
Expand Down Expand Up @@ -63,7 +63,7 @@
}

return ConfigEntry::fromCached($cached);
} catch (Exception $exception) {
} catch (Throwable $exception) {

Check warning on line 66 in src/Cache/ConfigCache.php

View check run for this annotation

Codecov / codecov/patch

src/Cache/ConfigCache.php#L66

Added line #L66 was not covered by tests
$this->logger->error('Error occurred while reading the cache.', [
'event_id' => 2200, 'exception' => $exception,
]);
Expand Down
6 changes: 2 additions & 4 deletions src/Cache/ConfigEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ConfigCat\Cache;

use ConfigCat\ConfigJson\Config;
use UnexpectedValueException;

/**
Expand Down Expand Up @@ -79,10 +80,7 @@ public static function empty(): ConfigEntry

public static function fromConfigJson(string $configJson, string $etag, float $fetchTime): ConfigEntry
{
$deserialized = json_decode($configJson, true);
if (null == $deserialized) {
return self::empty();
}
$deserialized = Config::deserialize($configJson);

return new ConfigEntry($configJson, $deserialized, $etag, $fetchTime);
}
Expand Down
Loading
Loading