Skip to content

Commit cc30e68

Browse files
LaunchDarklyReleaseBoteli-darklyhroederldLaunchDarklyCIbwoskow-ld
authored
prepare 4.2.1 release (#159)
* add new version of allFlags() that captures more metadata * linter * missing array key guard * missing array key guards * use the standard method for specifying custom JSON serialization * indents * add ability to filter for client-side flags only * fix test to fill in all required flag fields * implement evaluation with explanations * add another evaluation test * linter * fix test method * fix for ch22995 - include prereq value in event even if prereq is off * cache flag data in allFlags * rm unused imports * add option to reduce front-end metadata for untracked flags * add ability to load flags from a file * linter * data completeness * more data fixes * more data fixes * more data fixes * readme link * rm unused parameters * fix incorrect doc comment * add DynamoDB integration * fix test config * fix string check * readme * fix test data * factor out base class, implement caching, make configuration simpler * fix comment * rm unused const * can't scope constants * linter * add Consul integration * typo * regenerate lockfile using PHP 5.5 * we need at least version 2.1 of the Consul package * update lockfile * rm comment * remove lockfile * add delay for creating test table * move feature requester code into Integrations namespace * linter * misc test fixes * fix apc/apcu calls * fix comment * fix deprecated caching store classes * better caching abstraction * typo * linter * fix namespaces * fix tests * doc fixes * move a bunch more stuff * misc cleanup * add test for not having any flags * restore documentation for deprecated properties * version 3.5.0 * revert accidental commit * add experimentation event overrides for rules and fallthrough * linter * misc fixes * misc test fixes * Hr/ch34492/waitonconsul (#39) * add step to wait on Consul * coerce user attributes to strings when necessary, don't send events without valid users * explanatory comments * add release script (version update only) * use newer readme footer format * support metric value in track() * linter * update method description * add param to skip db tests, update docs for new repo name * wrong method name * add tests for rollout calculations, + misc test cleanup * misc doc fixes * misc doc fixes * update package name (#45) * add test for cached get all * typo * revert bugfix to test the test * reinstate bugfix * mix fixes, rename file * fix filename * misc cleanup * linter * misc fixes * test state cleanup * linter + fix filename in instructions * misc CI fixes, don't try to install phpredis in 5.6 * don't let user fall outside of last bucket in rollout * PHP 5.5 requires even null properties to be defined * minor cleanup * more accurate changelog text regarding phpredis * Add circle jobs for newer PHP versions. * Revert "Add circle jobs for newer PHP versions." This reverts commit 8939cb2. * implement doc generation with phpDocumentor 3 (prerelease), clean up doc tags (#50) * Add CI jobs for PHP 7.3 + 7.4 (#51) * ensure events aren't sent if send_events is false * clarify test with comment * make prefix concatenation in DynamoDB consistent with other SDKs * fix test * fix PHP 5.5 CI build by pinning Composer version (#54) * Updating warning log in Identify to not say Track was called (#56) * Removed the guides link * add alias functionality and some related tests * Revert "add alias functionality and some related tests" This reverts commit 2bf1cba. * add alias events support (#57) * add alias function to LDClient * add `contextKind` to events that require the new field * add tests for alias and contextKind * merge exp-alloc * drop support for EOL php versions and update deps (#60) * fix test class * remove database integrations from SDK (#63) * add type hints to FeatureRequesterBase methods * fix PHPRedis logic for prefix & custom client, add unit tests (#64) * add psalm lints and php hints (#62) * remove deprecated members (#65) * change default base URL to sdk.launchdarkly.com * move non-public classes into Impl namespace (#66) * add CI job for PHP 8.0 (#69) * use phpDocumentor 3 + misc doc comment cleanup (#68) * Updates docs URLs * pin Psalm to 4.9.2 to prevent a spurious linting error (#71) * use Releaser v2 config + add badge links in readme (#72) * use Releaser v2 config + add badge links in readme * fix badge URL * use Releaser PHP project template (#73) * use Releaser PHP project template * exclude implementation classes from docs * remove obsolete line that's no longer used because $seed is computed elsewhere * remove obsolete VERSION file * Fix test confirming send_events = false is honored (#78) * Minor cleanup and consistency changes (#79) * Add integration test for curl event publisher (#77) * Curl honor connect_timeout (#81) * Set required connect_timeout option in test (#82) * Add Windows support for "Curl" publisher (#80) * Add cs-check to build process (#83) * Don't treat numeric strings as numbers (#84) * Decrease psalm error level (#85) * added TestData, FlagBuilder; added TestDataTest; started implementing FlagBuilder methods * made props protected, made basic build method, made variations method with tests * continued implementing test data and tests for test data * implemented varationForAllUsers, valueForAllUsers, and variationForUsers along with corresponding tests * reorganized functions, added needed classes and functions, left some bodys blank to complete later, implemeted others, organized tests, added missing assertions * broken - transitioning build to return a FeatureFlag, finished implementing some methods * reverted build to return array, implemented getFeature and getAllFeatures methods in FeatureRequester interface for TestData * fixed build, implemented FeatureRequester, added simple test case * Event attribute filtering is overly aggressively (#86) If you try to create a custom attribute with a value of 0, our event serialization code would filter that out because `0 != null` is false. However, it is reasonable to expect that a user might want to provide the value of 0 as a custom value. The code has been updated to only exclude explicitly null values. * Account for traffic allocation on all flags (#87) * finished FlagRuleBuilder implementation; fixed psalm errors; improved comment blocks to adhere better to phpdoc; fixed formatting errors in both TestData and TestDataTest * fixed php-cs-fixer warnings in TestDataTest.php * Apply suggestions from code review Co-authored-by: Matthew M. Keeler <[email protected]> * replace use of array_push with append operator; standardized capitalization of booleans including in code blogs; other formatting adjustments * remove array_splice() implementation of existing user key removal due to breakage in unit tests * converted variationForUser to use array_splice but fixed issue caused by pass by reference instead of pass by value * fixed missing indexes required to decode FlagBuilder into a FeatureFlag using the decode() method * split off TestData\FlagBuilder and TestData\FlagRuleBuilder from TestData; add test coverage for TestData class * additional cleanup; added missing type hint; minor refactoring * remove special handling of singleton arrays in FlagBuilder::variations() * run php-cs-fixer on TestData-related files * started writing repetitive tests using the phpunit @dataProvider feature * swapped positions of expected and actual in dataProvider-driven test * fix typos in code in comment blocks * Apply whitespace fixes from code review Co-authored-by: Matthew M. Keeler <[email protected]> * split unwieldy tests in TestDataTest into separate tests; address TODO item * added annotations to dataProvider-driven tests * changed _isBooleanFlag() implementation to use strict equality * Add unit test to verify `in` operator in TestData (#89) * Add support for psr/log 2 and 3 (#91) * Adds link to Relay Proxy docs * master -> main * Add support for Guzzle 6.3 (#93) Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: hroederld <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: elliot <[email protected]> Co-authored-by: Elliot Haisley <[email protected]> Co-authored-by: Harpo Roeder <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Ember Stevens <[email protected]> Co-authored-by: ember-stevens <[email protected]> Co-authored-by: Matthew M. Keeler <[email protected]> Co-authored-by: charukiewicz <[email protected]> Co-authored-by: Joey Malinowski <[email protected]> Co-authored-by: Christian Charukiewicz <[email protected]> Co-authored-by: Matthew M. Keeler <[email protected]>
1 parent 8c8a079 commit cc30e68

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

.circleci/config.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ orbs:
66
workflows:
77
workflow:
88
jobs:
9-
- test-with-preinstalled-php:
10-
name: PHP 7.3
11-
docker-image: cimg/php:7.3
12-
- test-with-preinstalled-php:
13-
name: PHP 7.4
14-
docker-image: cimg/php:7.4
15-
- test-with-preinstalled-php:
16-
name: PHP 8.0
17-
docker-image: cimg/php:8.0
9+
- test-on-linux:
10+
matrix:
11+
parameters:
12+
php-version: ["7.3", "7.4", "8.0"]
13+
composer-dependencies: ["lowest", "highest"]
1814
- test-on-windows
1915

2016
jobs:
@@ -48,38 +44,50 @@ jobs:
4844
name: run tests
4945
command: .\vendor\bin\phpunit
5046

51-
test-with-preinstalled-php:
47+
test-on-linux:
5248
parameters:
53-
docker-image:
49+
php-version:
50+
type: string
51+
composer-dependencies:
5452
type: string
5553

5654
environment:
5755
LD_INCLUDE_INTEGRATION_TESTS: 1
5856

5957
docker:
60-
- image: <<parameters.docker-image>>
58+
- image: cimg/php:<<parameters.php-version>>
6159
- image: wiremock/wiremock
6260

6361
steps:
6462
- setup_remote_docker
6563
- checkout
64+
6665
- run:
6766
name: validate composer.json
6867
command: composer validate
6968
- run:
7069
name: install dependencies
7170
command: composer install --no-progress
71+
- when:
72+
condition:
73+
equal: [ <<parameters.composer-dependencies>>, "lowest" ]
74+
steps:
75+
- run:
76+
name: downgrade to lowest versions
77+
command: composer update --prefer-lowest --prefer-stable
78+
7279
- run:
7380
name: psalm linting
7481
command: ./vendor/bin/psalm --no-cache
7582
- run:
7683
name: php-cs-fixer check
7784
command: composer cs-check
7885
- run:
79-
name: run tests with highest compatible dependency versions
86+
name: run tests
8087
command: php -d xdebug.mode=coverage vendor/bin/phpunit
8188
enviroment:
8289
XDEBUG_MODE: coverage
90+
8391
- store_test_results:
8492
path: build/phpunit
8593
- store_artifacts:

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
**Requirements**
22

33
- [ ] I have added test coverage for new or changed functionality
4-
- [ ] I have followed the repository's [pull request submission guidelines](../blob/master/CONTRIBUTING.md#submitting-pull-requests)
4+
- [ ] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
55
- [ ] I have validated my changes against all supported platform versions
66

77
**Related issues**

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"psr/log": "^1.0|^2.0|^3.0"
2020
},
2121
"require-dev": {
22-
"friendsofphp/php-cs-fixer": ">=2.2.19 <3.0",
23-
"guzzlehttp/guzzle": "^7",
22+
"friendsofphp/php-cs-fixer": ">=2.18.0 <3.0",
23+
"guzzlehttp/guzzle": "^6.3 | ^7",
2424
"kevinrob/guzzle-cache-middleware": "^3",
2525
"phpunit/php-code-coverage": "^9",
2626
"phpunit/phpunit": "^9",
27-
"vimeo/psalm": "^4.0"
27+
"vimeo/psalm": "^4.4"
2828
},
2929
"suggest": {
30-
"guzzlehttp/guzzle": "(^7) Required when using GuzzleEventPublisher or the default FeatureRequester",
30+
"guzzlehttp/guzzle": "(^6.3 | ^7) Required when using GuzzleEventPublisher or the default FeatureRequester",
3131
"kevinrob/guzzle-cache-middleware": "(^3) Recommended for performance when using the default FeatureRequester"
3232
},
3333
"autoload": {
@@ -44,7 +44,7 @@
4444
"sort-packages": true
4545
},
4646
"scripts": {
47-
"cs-check": "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose",
48-
"cs-fix": "vendor/bin/php-cs-fixer fix --diff --verbose"
47+
"cs-check": "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose --config=.php-cs-fixer.php",
48+
"cs-fix": "vendor/bin/php-cs-fixer fix --diff --verbose --config=.php-cs-fixer.php"
4949
}
5050
}

src/LaunchDarkly/Impl/Integrations/GuzzleFeatureRequester.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function getFeature(string $key): ?FeatureFlag
7575
$body = $response->getBody();
7676
return FeatureFlag::decode(json_decode($body->getContents(), true));
7777
} catch (BadResponseException $e) {
78+
/** @psalm-suppress PossiblyNullReference (resolved in guzzle 7) */
7879
$code = $e->getResponse()->getStatusCode();
7980
if ($code == 404) {
8081
$this->_logger->warning("GuzzleFeatureRequester::get returned 404. Feature flag does not exist for key: " . $key);
@@ -98,6 +99,7 @@ public function getSegment(string $key): ?Segment
9899
$body = $response->getBody();
99100
return Segment::decode(json_decode($body->getContents(), true));
100101
} catch (BadResponseException $e) {
102+
/** @psalm-suppress PossiblyNullReference (resolved in guzzle 7) */
101103
$code = $e->getResponse()->getStatusCode();
102104
if ($code == 404) {
103105
$this->_logger->warning("GuzzleFeatureRequester::get returned 404. Segment does not exist for key: " . $key);
@@ -120,6 +122,7 @@ public function getAllFeatures(): ?array
120122
$body = $response->getBody();
121123
return array_map(FeatureFlag::getDecoder(), json_decode($body->getContents(), true));
122124
} catch (BadResponseException $e) {
125+
/** @psalm-suppress PossiblyNullReference (resolved in guzzle 7) */
123126
$this->handleUnexpectedStatus($e->getResponse()->getStatusCode(), "GuzzleFeatureRequester::getAll");
124127
return null;
125128
}

src/LaunchDarkly/LDClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class LDClient
5959
* @param string $sdkKey The SDK key for your account
6060
* @param array $options Client configuration settings
6161
* - `base_uri`: Base URI of the LaunchDarkly service. Change this if you are connecting to a Relay Proxy instance instead of
62-
* directly to LaunchDarkly.
62+
* directly to LaunchDarkly. To learn more, read [The Relay Proxy](https://docs.launchdarkly.com/home/relay-proxy).
6363
* - `events_uri`: Base URI for sending events to LaunchDarkly. Change this if you are forwarding events through a Relay Proxy instance.
6464
* - `timeout`: The maximum length of an HTTP request in seconds. Defaults to 3.
6565
* - `connect_timeout`: The maximum number of seconds to wait while trying to connect to a server. Defaults to 3.

0 commit comments

Comments
 (0)