Skip to content

Commit

Permalink
feat: deprecate php 7 (#59)
Browse files Browse the repository at this point in the history
* feat!: deprecate PHP 7.4

Signed-off-by: Tom Carrio <[email protected]>

build: provide a devenv config

style: apply linting updates for providers

style: apply phpcbf fixes

build: disable root-level phpcbf commit hook until configured

style: apply linting fixes to Flagd provider

refactor: confirm to new provider interface

chore: ignore all composer.lock files

build!: target new version of open-feature/sdk

Signed-off-by: Tom Carrio <[email protected]>

* feat: deprecate php 7 with full test suite passing

Signed-off-by: Tom Carrio <[email protected]>

---------

Signed-off-by: Tom Carrio <[email protected]>
  • Loading branch information
tcarrio authored Feb 12, 2023
1 parent f5bb87b commit d028e6d
Show file tree
Hide file tree
Showing 35 changed files with 280 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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']
project-dir:
- hooks/OpenTelemetry
- hooks/DDTrace
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/captainhook.config.json
/composer.lock
composer.lock
/phpcs.xml
/phpunit.xml
/vendor/

/build/

/proto/
/proto/

/.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.33
# 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.

### Project Structure

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![a](https://img.shields.io/badge/slack-%40cncf%2Fopenfeature-brightgreen?style=flat&logo=slack)](https://cloud-native.slack.com/archives/C0344AANLA1)
[![codecov](https://codecov.io/gh/open-feature/php-sdk-contrib/branch/main/graph/badge.svg?token=3DC5XOEHMY)](https://codecov.io/gh/open-feature/php-sdk-contrib)
![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](https://img.shields.io/github/license/open-feature/php-sdk-contrib)
![Experimental](https://img.shields.io/badge/Status-Experimental-yellow)

Expand All @@ -27,9 +27,7 @@ This repository is marked as **experimental** since the repository structure its

### 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 7.4 is EOL and support will be discontinued in these libraries soon.**
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
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 hooks/DDTrace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![a](https://img.shields.io/badge/slack-%40cncf%2Fopenfeature-brightgreen?style=flat&logo=slack)](https://cloud-native.slack.com/archives/C0344AANLA1)
[![Latest Stable Version](http://poser.pugx.org/open-feature/dd-trace-hook/v)](https://packagist.org/packages/open-feature/dd-trace-hook)
[![Total Downloads](http://poser.pugx.org/open-feature/dd-trace-hook/downloads)](https://packagist.org/packages/open-feature/dd-trace-hook)
![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/dd-trace-hook/license)](https://packagist.org/packages/open-feature/dd-trace-hook)

## Overview
Expand Down Expand Up @@ -47,7 +47,7 @@ For more examples, see the [examples](./examples/).

### 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.
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
4 changes: 2 additions & 2 deletions hooks/DDTrace/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
}
],
"require": {
"php": "^7.4 || ^8",
"open-feature/sdk": "^1.2.0"
"php": "^8",
"open-feature/sdk": "^2.0"
},
"require-dev": {
"datadog/dd-trace": "^0.82.0",
Expand Down
3 changes: 0 additions & 3 deletions hooks/DDTrace/phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +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"/>
</rule>

</ruleset>
4 changes: 2 additions & 2 deletions hooks/OpenTelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![a](https://img.shields.io/badge/slack-%40cncf%2Fopenfeature-brightgreen?style=flat&logo=slack)](https://cloud-native.slack.com/archives/C0344AANLA1)
[![Latest Stable Version](http://poser.pugx.org/open-feature/otel-hook/v)](https://packagist.org/packages/open-feature/otel-hook)
[![Total Downloads](http://poser.pugx.org/open-feature/otel-hook/downloads)](https://packagist.org/packages/open-feature/otel-hook)
![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/otel-hook/license)](https://packagist.org/packages/open-feature/otel-hook)

## Overview
Expand Down Expand Up @@ -47,7 +47,7 @@ For more examples, see the [examples](./examples/).

### 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.
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
4 changes: 2 additions & 2 deletions hooks/OpenTelemetry/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
}
],
"require": {
"php": "^7.4 || ^8",
"open-feature/sdk": "^1.2.0",
"php": "^8",
"open-feature/sdk": "^2.0",
"open-telemetry/api": "^0.0.17"
},
"require-dev": {
Expand Down
3 changes: 0 additions & 3 deletions hooks/OpenTelemetry/phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +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"/>
</rule>

</ruleset>
4 changes: 1 addition & 3 deletions hooks/OpenTelemetry/src/TracerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class TracerHelper
/**
* Determines a non-null Tracer to return based on a given input, allowing
* multiple types including a PSR-11 container, Tracer, or null
*
* @param ContainerInterface|TracerInterface|null $maybeTracerOrContainer
*/
public static function determineTracer($maybeTracerOrContainer = null): TracerInterface
public static function determineTracer(ContainerInterface | TracerInterface | null $maybeTracerOrContainer = null): TracerInterface
{
if ($maybeTracerOrContainer instanceof TracerInterface) {
return $maybeTracerOrContainer;
Expand Down
4 changes: 2 additions & 2 deletions hooks/Validators/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![a](https://img.shields.io/badge/slack-%40cncf%2Fopenfeature-brightgreen?style=flat&logo=slack)](https://cloud-native.slack.com/archives/C0344AANLA1)
[![Latest Stable Version](http://poser.pugx.org/open-feature/validators-hook/v)](https://packagist.org/packages/open-feature/validators-hook)
[![Total Downloads](http://poser.pugx.org/open-feature/validators-hook/downloads)](https://packagist.org/packages/open-feature/validators-hook)
![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/validators-hook/license)](https://packagist.org/packages/open-feature/validators-hook)

## Overview
Expand Down Expand Up @@ -42,7 +42,7 @@ For more examples, see the [examples](./examples/).

### 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.
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
Loading

0 comments on commit d028e6d

Please sign in to comment.