Skip to content

Commit 0a9b5b5

Browse files
authored
feat: deprecate php 7 (#77)
<!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> - deprecates support for PHP 7.4 - includes optional [devenv](https://devenv.sh) config ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> Fixes #45 ### Notes <!-- any additional notes for this PR --> ### Follow-up Tasks Update all providers and hooks in sdk-contrib ### How to test Once the flagd provider is updated we should be able to validate these with integration tests again Signed-off-by: Tom Carrio <[email protected]>
1 parent 29f219f commit 0a9b5b5

Some content is hidden

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

44 files changed

+305
-111
lines changed

.github/workflows/pullrequest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
operating-system: [ubuntu-latest]
23-
php-version: ['7.4', '8.0', '8.1', '8.2']
23+
php-version: ['8.0', '8.1', '8.2']
2424

2525
steps:
2626
- uses: actions/checkout@v3

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66

77
/build/
88

9-
/features/*.feature
9+
/features/*.feature
10+
11+
/.devenv*

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/nix/store/6v3blbcxh5aqc5k2qzf5cqyxnp8yinlp-pre-commit-config.json

.tool-versions

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# php 7.4.30
2-
# php 8.0.24
1+
php 8.0.24
32
# php 8.1.11
4-
php 8.2.1
3+
# php 8.2.1

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
### System Requirements
66

7-
PHP 8+ is recommended. PHP 7.4 is EOL and support will be removed in an upcoming release.
7+
PHP 8+ is required.
88

99
### Compilation target(s)
1010

11-
We target compatibility with PHP versions 7.4, 8.0, 8.1, and 8.2.
11+
We target compatibility with PHP versions 8.0, 8.1, and 8.2.
1212

1313
### Installation and Dependencies
1414

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Specification](https://img.shields.io/static/v1?label=Specification&message=v0.5.1&color=yellow)](https://github.com/open-feature/spec/tree/v0.5.1)
66
[![Latest Stable Version](http://poser.pugx.org/open-feature/sdk/v)](https://packagist.org/packages/open-feature/sdk)
77
[![Total Downloads](http://poser.pugx.org/open-feature/sdk/downloads)](https://packagist.org/packages/open-feature/sdk)
8-
![PHP 7.4+](https://img.shields.io/badge/php->=7.4-blue.svg)
8+
![PHP 8.0+](https://img.shields.io/badge/php->=8.0-blue.svg)
99
[![License](http://poser.pugx.org/open-feature/sdk/license)](https://packagist.org/packages/open-feature/sdk)
1010
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/6853/badge)](https://bestpractices.coreinfrastructure.org/projects/6853)
1111

@@ -106,9 +106,7 @@ The OpenFeature project maintains the [open-feature/php-sdk-contrib](https://git
106106

107107
### PHP Versioning
108108

109-
This library targets PHP version 7.4 and newer. As long as you have any compatible version of PHP on your system you should be able to utilize the OpenFeature SDK.
110-
111-
⚠️ **PHP version 7.4 is EOL and support will shortly be dropped from this package.**
109+
This library targets PHP version 8.0 and newer. As long as you have any compatible version of PHP on your system you should be able to utilize the OpenFeature SDK.
112110

113111
This package also has a `.tool-versions` file for use with PHP version managers like `asdf`.
114112

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.4 || ^8",
18+
"php": "^8",
1919
"myclabs/php-enum": "^1.8",
2020
"psr/log": "^1.1"
2121
},

devenv.lock

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
{
2+
"nodes": {
3+
"devenv": {
4+
"locked": {
5+
"dir": "src/modules",
6+
"lastModified": 1675875772,
7+
"narHash": "sha256-sYXHPZ4tsjdG+UXK0mYnABhiS/RuzHiV9uGOU9YakwE=",
8+
"owner": "cachix",
9+
"repo": "devenv",
10+
"rev": "eac5eb12eb42765f5f252972dc876d1f96b03dfe",
11+
"type": "github"
12+
},
13+
"original": {
14+
"dir": "src/modules",
15+
"owner": "cachix",
16+
"repo": "devenv",
17+
"type": "github"
18+
}
19+
},
20+
"flake-compat": {
21+
"flake": false,
22+
"locked": {
23+
"lastModified": 1673956053,
24+
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
25+
"owner": "edolstra",
26+
"repo": "flake-compat",
27+
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
28+
"type": "github"
29+
},
30+
"original": {
31+
"owner": "edolstra",
32+
"repo": "flake-compat",
33+
"type": "github"
34+
}
35+
},
36+
"flake-utils": {
37+
"locked": {
38+
"lastModified": 1667395993,
39+
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
40+
"owner": "numtide",
41+
"repo": "flake-utils",
42+
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
43+
"type": "github"
44+
},
45+
"original": {
46+
"owner": "numtide",
47+
"repo": "flake-utils",
48+
"type": "github"
49+
}
50+
},
51+
"gitignore": {
52+
"inputs": {
53+
"nixpkgs": [
54+
"pre-commit-hooks",
55+
"nixpkgs"
56+
]
57+
},
58+
"locked": {
59+
"lastModified": 1660459072,
60+
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
61+
"owner": "hercules-ci",
62+
"repo": "gitignore.nix",
63+
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
64+
"type": "github"
65+
},
66+
"original": {
67+
"owner": "hercules-ci",
68+
"repo": "gitignore.nix",
69+
"type": "github"
70+
}
71+
},
72+
"nixpkgs": {
73+
"locked": {
74+
"lastModified": 1675758091,
75+
"narHash": "sha256-7gFSQbSVAFUHtGCNHPF7mPc5CcqDk9M2+inlVPZSneg=",
76+
"owner": "NixOS",
77+
"repo": "nixpkgs",
78+
"rev": "747927516efcb5e31ba03b7ff32f61f6d47e7d87",
79+
"type": "github"
80+
},
81+
"original": {
82+
"owner": "NixOS",
83+
"ref": "nixpkgs-unstable",
84+
"repo": "nixpkgs",
85+
"type": "github"
86+
}
87+
},
88+
"nixpkgs-stable": {
89+
"locked": {
90+
"lastModified": 1673800717,
91+
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
92+
"owner": "NixOS",
93+
"repo": "nixpkgs",
94+
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
95+
"type": "github"
96+
},
97+
"original": {
98+
"owner": "NixOS",
99+
"ref": "nixos-22.11",
100+
"repo": "nixpkgs",
101+
"type": "github"
102+
}
103+
},
104+
"nixpkgs_2": {
105+
"locked": {
106+
"lastModified": 1671271357,
107+
"narHash": "sha256-xRJdLbWK4v2SewmSStYrcLa0YGJpleufl44A19XSW8k=",
108+
"owner": "NixOS",
109+
"repo": "nixpkgs",
110+
"rev": "40f79f003b6377bd2f4ed4027dde1f8f922995dd",
111+
"type": "github"
112+
},
113+
"original": {
114+
"owner": "NixOS",
115+
"ref": "nixos-unstable",
116+
"repo": "nixpkgs",
117+
"type": "github"
118+
}
119+
},
120+
"pre-commit-hooks": {
121+
"inputs": {
122+
"flake-compat": "flake-compat",
123+
"flake-utils": "flake-utils",
124+
"gitignore": "gitignore",
125+
"nixpkgs": "nixpkgs_2",
126+
"nixpkgs-stable": "nixpkgs-stable"
127+
},
128+
"locked": {
129+
"lastModified": 1675688762,
130+
"narHash": "sha256-oit/SxMk0B380ASuztBGQLe8TttO1GJiXF8aZY9AYEc=",
131+
"owner": "cachix",
132+
"repo": "pre-commit-hooks.nix",
133+
"rev": "ab608394886fb04b8a5df3cb0bab2598400e3634",
134+
"type": "github"
135+
},
136+
"original": {
137+
"owner": "cachix",
138+
"repo": "pre-commit-hooks.nix",
139+
"type": "github"
140+
}
141+
},
142+
"root": {
143+
"inputs": {
144+
"devenv": "devenv",
145+
"nixpkgs": "nixpkgs",
146+
"pre-commit-hooks": "pre-commit-hooks"
147+
}
148+
}
149+
},
150+
"root": "root",
151+
"version": 7
152+
}

devenv.nix

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{ pkgs, ... }:
2+
3+
{
4+
5+
# https://devenv.sh/packages/
6+
packages = [ pkgs.git ];
7+
8+
# https://devenv.sh/languages/
9+
languages.nix.enable = true;
10+
languages.php.enable = true;
11+
languages.php.package = pkgs.php80;
12+
13+
# https://devenv.sh/basics/
14+
env.PROJECT_NAME = "openfeature-php-sdk";
15+
16+
# https://devenv.sh/scripts/
17+
scripts.hello.exec = "echo $ Started devenv shell in $PROJECT_NAME";
18+
19+
enterShell = ''
20+
hello
21+
echo
22+
git --version
23+
php --version
24+
echo
25+
26+
# optimization step -- files and directories that match entries
27+
# in the .gitignore will still be traversed, and the .devenv
28+
# directory contains over 5000 files and 121MB.
29+
if ! grep -E "excludesfile.+\.gitignore" .git/config &>/dev/null
30+
then
31+
git config --local core.excludesfile .gitignore
32+
fi
33+
'';
34+
35+
## https://devenv.sh/pre-commit-hooks/
36+
pre-commit.hooks = {
37+
# # general formatting
38+
# prettier.enable = true;
39+
# github actions
40+
actionlint.enable = true;
41+
# nix
42+
deadnix.enable = true;
43+
nixfmt.enable = true;
44+
# php
45+
phpcbf.enable = true;
46+
# # ensure Markdown code is executable
47+
# mdsh.enable = true;
48+
};
49+
50+
# https://devenv.sh/processes/
51+
# processes.ping.exec = "ping example.com";
52+
}

devenv.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
inputs:
2+
nixpkgs:
3+
url: github:NixOS/nixpkgs/nixpkgs-unstable
4+
pre-commit-hooks:
5+
url: github:cachix/pre-commit-hooks.nix

integration/composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.4 || ^8",
18+
"php": "^8",
1919
"open-feature/sdk": "^1.1.1",
2020
"open-feature/flagd-provider": "^0.3.0",
2121
"guzzlehttp/guzzle": "^7.5",
@@ -31,7 +31,7 @@
3131
"url": "../",
3232
"options": {
3333
"versions": {
34-
"open-feature/sdk": "1.1.1"
34+
"open-feature/sdk": "1.4.0"
3535
}
3636
}
3737
}

integration/test-harness

phpcs.xml.dist

-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020

2121
<exclude name="Generic.Files.LineLength.TooLong"/>
2222
<exclude name="Generic.Commenting.Todo.TaskFound"/>
23-
24-
<!-- Ignore this for PHP 7.4 -->
25-
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
26-
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
2723
</rule>
2824

2925
</ruleset>

src/OpenFeatureClient.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public function getObjectDetails(string $flagKey, $defaultValue, ?EvaluationCont
292292
private function evaluateFlag(
293293
string $flagValueType,
294294
string $flagKey,
295-
$defaultValue,
295+
bool | string | int | float | DateTime | array | null $defaultValue,
296296
?EvaluationContextInterface $invocationContext = null,
297297
?EvaluationOptionsInterface $options = null
298298
): EvaluationDetailsInterface {
@@ -388,13 +388,10 @@ private function evaluateFlag(
388388
return $details;
389389
}
390390

391-
/**
392-
* @param mixed $defaultValue
393-
*/
394391
private function createProviderEvaluation(
395392
string $type,
396393
string $key,
397-
$defaultValue,
394+
mixed $defaultValue,
398395
Provider $provider,
399396
EvaluationContextInterface $context
400397
): ResolutionDetails {

0 commit comments

Comments
 (0)