Skip to content

Commit cb0deb8

Browse files
LaunchDarklyReleaseBoteli-darklyLaunchDarklyCIbwoskow-ldgwhelanLD
authored
prepare 6.0.0 release (#183)
## [6.0.0] - 2023-10-23 The latest version of this SDK supports the ability to manage migrations or modernizations, using migration flags. You might use this functionality if you are optimizing queries, upgrading to new tech stacks, migrating from one database to another, or other similar technology changes. Migration flags are part of LaunchDarkly's Early Access Program. This feature is available to all LaunchDarkly customers but may undergo additional changes before it is finalized. For detailed information about this version, refer to the list below. For information on how to upgrade from the previous version, read the [migration guide](https://docs.launchdarkly.com/sdk/server-side/php/migration-5-to-6). ### Added: - A new `Migrator` type which provides an out-of-the-box configurable migration framework. - For more advanced use cases, added new `migrationVariation` and `trackMigrationOperation` methods on `LDClient`. ### Removed: - PHP 8.0 support was removed. - The legacy user format for contexts is no longer supported. To learn more, read the [Contexts documentation](https://docs.launchdarkly.com/guides/flags/intro-contexts). - Methods which originally took an `LDContext` or an `LDUser` now only accept an `LDContext`. - Previously deprecated test data flag builder methods `variationForAllUsers`, `valueForAllUsers`, and `clearUserTargets` have been removed. --------- Co-authored-by: Eli Bishop <[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]> Co-authored-by: Colin Henwood <[email protected]> Co-authored-by: Colin Henwood <[email protected]> Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: hroederld <[email protected]> Co-authored-by: Louis Chan <[email protected]> Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com> Co-authored-by: Kane Parkinson <[email protected]> Co-authored-by: Michiel Devriese <[email protected]>
1 parent fa74322 commit cb0deb8

Some content is hidden

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

47 files changed

+2460
-1063
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ workflows:
99
- test-on-linux:
1010
matrix:
1111
parameters:
12-
php-version: ["8.0", "8.1"]
12+
php-version: ["8.1", "8.2"]
1313
composer-dependencies: ["lowest", "highest"]
1414
- test-on-windows
1515

.ldrelease/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ publications:
1010

1111
branches:
1212
- name: main
13-
description: 5.x
13+
description: 6.x
14+
- name: 5.x
1415
- name: 4.x
1516

1617
jobs:
1718
- docker:
18-
image: ldcircleci/php-sdk-release:4 # Releaser's default for PHP is still php-sdk-release:3, which is PHP 7.x
19+
image: ldcircleci/php-sdk-release:5 # Releaser's default for PHP is still php-sdk-release:3, which is PHP 7.x
1920
template:
2021
name: php
2122

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
## Supported PHP versions
1414

15-
This version of the LaunchDarkly SDK is compatible with PHP 8.0 and higher.
15+
This version of the LaunchDarkly SDK is compatible with PHP 8.1 and higher.
1616

1717
## Getting started
1818

baseline.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=8.0",
17+
"php": ">=8.1",
1818
"monolog/monolog": "^2.0|^3.0",
1919
"psr/log": "^1.0|^2.0|^3.0"
2020
},
2121
"require-dev": {
22-
"friendsofphp/php-cs-fixer": "^3.12.0",
22+
"friendsofphp/php-cs-fixer": "^3.15.0",
2323
"guzzlehttp/guzzle": "^7",
2424
"kevinrob/guzzle-cache-middleware": "^4.0",
2525
"phpunit/php-code-coverage": "^9",
2626
"phpunit/phpunit": "^9",
27-
"vimeo/psalm": "^4.9"
27+
"vimeo/psalm": "^5.15"
2828
},
2929
"suggest": {
3030
"guzzlehttp/guzzle": "(^6.3 | ^7) Required when using GuzzleEventPublisher or the default FeatureRequester",

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="tests/bootstrap.php" colors="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" beStrictAboutResourceUsageDuringSmallTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" verbose="true" defaultTimeLimit="10">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" beStrictAboutResourceUsageDuringSmallTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" verbose="true" defaultTimeLimit="10">
33

44
<logging>
55
<junit outputFile="build/phpunit/junit.xml"/>

psalm.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8-
errorBaseline="baseline.xml"
98
>
109
<projectFiles>
1110
<directory name="src" />

src/LaunchDarkly/EvaluationReason.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ class EvaluationReason implements \JsonSerializable
8383
*/
8484
const EXCEPTION_ERROR = 'EXCEPTION';
8585

86+
/**
87+
* A possible value for getErrorKind(): indicates the value of the
88+
* evaluation did not match the PHP type expected.
89+
*/
90+
91+
const WRONG_TYPE_ERROR = 'WRONG_TYPE';
92+
8693
private string $_kind;
8794
private ?string $_errorKind;
8895
private ?int $_ruleIndex;

src/LaunchDarkly/Impl/Events/EventFactory.php

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ public function newEvalEvent(
5050
'default' => $default,
5151
'version' => $flag->getVersion()
5252
];
53+
5354
// the following properties are handled separately so we don't waste bandwidth on unused keys
55+
if ($flag->getExcludeFromSummaries()) {
56+
$e['excludeFromSummaries'] = true;
57+
}
58+
if ($flag->getSamplingRatio() !== 1) {
59+
$e['samplingRatio'] = $flag->getSamplingRatio();
60+
}
5461
if ($forceReasonTracking || $flag->isTrackEvents()) {
5562
$e['trackEvents'] = true;
5663
}
@@ -66,33 +73,6 @@ public function newEvalEvent(
6673
return $e;
6774
}
6875

69-
/**
70-
* @return mixed[]
71-
*/
72-
public function newDefaultEvent(FeatureFlag $flag, LDContext $context, EvaluationDetail $detail): array
73-
{
74-
$e = [
75-
'kind' => 'feature',
76-
'creationDate' => Util::currentTimeUnixMillis(),
77-
'key' => $flag->getKey(),
78-
'context' => $context,
79-
'value' => $detail->getValue(),
80-
'default' => $detail->getValue(),
81-
'version' => $flag->getVersion()
82-
];
83-
// the following properties are handled separately so we don't waste bandwidth on unused keys
84-
if ($flag->isTrackEvents()) {
85-
$e['trackEvents'] = true;
86-
}
87-
if ($flag->getDebugEventsUntilDate()) {
88-
$e['debugEventsUntilDate'] = $flag->getDebugEventsUntilDate();
89-
}
90-
if ($this->_withReasons) {
91-
$e['reason'] = $detail->getReason()->jsonSerialize();
92-
}
93-
return $e;
94-
}
95-
9676
/**
9777
* @return mixed[]
9878
*/
@@ -124,7 +104,7 @@ public function newIdentifyEvent(LDContext $context): array
124104
'context' => $context
125105
];
126106
}
127-
107+
128108
/**
129109
* @return mixed[]
130110
*/

src/LaunchDarkly/Impl/Events/EventProcessor.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace LaunchDarkly\Impl\Events;
66

7+
use LaunchDarkly\Impl\Util;
78
use LaunchDarkly\Integrations\Curl;
89
use LaunchDarkly\Subsystems\EventPublisher;
910

@@ -21,7 +22,7 @@ class EventProcessor
2122
private int $_capacity;
2223

2324
/**
24-
* @psalm-param array{capacity: int} $options
25+
* @param array<string, mixed> $options
2526
*/
2627
public function __construct(string $sdkKey, array $options)
2728
{
@@ -50,6 +51,13 @@ public function enqueue(array $event): bool
5051
return false;
5152
}
5253

54+
if (isset($event['samplingRatio'])) {
55+
$samplingRatio = $event['samplingRatio'];
56+
if (is_int($samplingRatio) && !Util::sample($samplingRatio)) {
57+
return false;
58+
}
59+
}
60+
5361
$this->_queue[] = $event;
5462

5563
return true;

0 commit comments

Comments
 (0)