Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['7.4', '8.0', '8.1', '8.2']
php-version: ['8.0', '8.1', '8.2']

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

/build/

/features/*.feature
/features/*.feature

/.devenv*
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
5 changes: 2 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# php 7.4.30
# php 8.0.24
php 8.0.24
# php 8.1.11
php 8.2.1
# php 8.2.1
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

### System Requirements

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

### Compilation target(s)

We target compatibility with PHP versions 7.4, 8.0, 8.1, and 8.2.
We target compatibility with PHP versions 8.0, 8.1, and 8.2.

### Installation and Dependencies

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![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)
[![Latest Stable Version](http://poser.pugx.org/open-feature/sdk/v)](https://packagist.org/packages/open-feature/sdk)
[![Total Downloads](http://poser.pugx.org/open-feature/sdk/downloads)](https://packagist.org/packages/open-feature/sdk)
![PHP 7.4+](https://img.shields.io/badge/php->=7.4-blue.svg)
![PHP 8.0+](https://img.shields.io/badge/php->=8.0-blue.svg)
[![License](http://poser.pugx.org/open-feature/sdk/license)](https://packagist.org/packages/open-feature/sdk)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/6853/badge)](https://bestpractices.coreinfrastructure.org/projects/6853)

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

### PHP Versioning

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.

⚠️ **PHP version 7.4 is EOL and support will shortly be dropped from this package.**
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.

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

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^7.4 || ^8",
"php": "^8",
"myclabs/php-enum": "^1.8",
"psr/log": "^1.1"
},
Expand Down
152 changes: 152 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1675875772,
"narHash": "sha256-sYXHPZ4tsjdG+UXK0mYnABhiS/RuzHiV9uGOU9YakwE=",
"owner": "cachix",
"repo": "devenv",
"rev": "eac5eb12eb42765f5f252972dc876d1f96b03dfe",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1675758091,
"narHash": "sha256-7gFSQbSVAFUHtGCNHPF7mPc5CcqDk9M2+inlVPZSneg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "747927516efcb5e31ba03b7ff32f61f6d47e7d87",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1673800717,
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1671271357,
"narHash": "sha256-xRJdLbWK4v2SewmSStYrcLa0YGJpleufl44A19XSW8k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "40f79f003b6377bd2f4ed4027dde1f8f922995dd",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1675688762,
"narHash": "sha256-oit/SxMk0B380ASuztBGQLe8TttO1GJiXF8aZY9AYEc=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "ab608394886fb04b8a5df3cb0bab2598400e3634",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}
52 changes: 52 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{ pkgs, ... }:

{

# https://devenv.sh/packages/
packages = [ pkgs.git ];

# https://devenv.sh/languages/
languages.nix.enable = true;
languages.php.enable = true;
languages.php.package = pkgs.php80;

# https://devenv.sh/basics/
env.PROJECT_NAME = "openfeature-php-sdk";

# https://devenv.sh/scripts/
scripts.hello.exec = "echo $ Started devenv shell in $PROJECT_NAME";

enterShell = ''
hello
echo
git --version
php --version
echo

# optimization step -- files and directories that match entries
# in the .gitignore will still be traversed, and the .devenv
# directory contains over 5000 files and 121MB.
if ! grep -E "excludesfile.+\.gitignore" .git/config &>/dev/null
then
git config --local core.excludesfile .gitignore
fi
'';

## https://devenv.sh/pre-commit-hooks/
pre-commit.hooks = {
# # general formatting
# prettier.enable = true;
# github actions
actionlint.enable = true;
# nix
deadnix.enable = true;
nixfmt.enable = true;
# php
phpcbf.enable = true;
# # ensure Markdown code is executable
# mdsh.enable = true;
};

# https://devenv.sh/processes/
# processes.ping.exec = "ping example.com";
}
5 changes: 5 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
pre-commit-hooks:
url: github:cachix/pre-commit-hooks.nix
4 changes: 2 additions & 2 deletions integration/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^7.4 || ^8",
"php": "^8",
"open-feature/sdk": "^1.1.1",
"open-feature/flagd-provider": "^0.3.0",
"guzzlehttp/guzzle": "^7.5",
Expand All @@ -31,7 +31,7 @@
"url": "../",
"options": {
"versions": {
"open-feature/sdk": "1.1.1"
"open-feature/sdk": "1.4.0"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion integration/test-harness
4 changes: 0 additions & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@

<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="Generic.Commenting.Todo.TaskFound"/>

<!-- Ignore this for PHP 7.4 -->
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
</rule>

</ruleset>
7 changes: 2 additions & 5 deletions src/OpenFeatureClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function getObjectDetails(string $flagKey, $defaultValue, ?EvaluationCont
private function evaluateFlag(
string $flagValueType,
string $flagKey,
$defaultValue,
bool | string | int | float | DateTime | array | null $defaultValue,
?EvaluationContextInterface $invocationContext = null,
?EvaluationOptionsInterface $options = null
): EvaluationDetailsInterface {
Expand Down Expand Up @@ -388,13 +388,10 @@ private function evaluateFlag(
return $details;
}

/**
* @param mixed $defaultValue
*/
private function createProviderEvaluation(
string $type,
string $key,
$defaultValue,
mixed $defaultValue,
Provider $provider,
EvaluationContextInterface $context
): ResolutionDetails {
Expand Down
Loading