Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Bump PHP to 8.1+ #25

Merged
merged 5 commits into from
Jan 17, 2025
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
37 changes: 10 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,15 @@ jobs:
- 6379:6379

strategy:
fail-fast: false
matrix:
include:
# 7.x configurations
- php-version: 7.3
use-lowest-dependencies: true
shared-test-version: 4.x-dev
- php-version: 7.3
use-lowest-dependencies: false
shared-test-version: 4.x-dev

- php-version: 7.4
use-lowest-dependencies: true
shared-test-version: 4.x-dev
- php-version: 7.4
use-lowest-dependencies: false
shared-test-version: 4.x-dev

# 8.0 configurations
- php-version: 8.0
use-lowest-dependencies: true
shared-test-version: 4.x-dev
- php-version: 8.0
use-lowest-dependencies: false
shared-test-version: 5.x-dev

# 8.1 configurations
- php-version: 8.1
use-lowest-dependencies: true
shared-test-version: 4.x-dev
- php-version: 8.1
use-lowest-dependencies: false
shared-test-version: 5.x-dev
- php-version: 8.1
use-lowest-dependencies: false
use-lowest-dependencies: true
shared-test-version: dev-main

# 8.2 configurations
Expand All @@ -64,6 +39,14 @@ jobs:
use-lowest-dependencies: false
shared-test-version: dev-main

# 8.3 configurations
- php-version: 8.3
use-lowest-dependencies: false
shared-test-version: 5.x-dev
- php-version: 8.3
use-lowest-dependencies: false
shared-test-version: dev-main

steps:
- uses: actions/checkout@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ docs/build
docs/.phpdoc
phpunit/
.phpunit.result.cache
.php-cs-fixer.cache
15 changes: 15 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$finder = PhpCsFixer\Finder::create()->in(__DIR__);

$config = new PhpCsFixer\Config();
return $config
->setFinder($finder)
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'blank_line_after_opening_tag' => true,
'ordered_imports' => true,
'no_unused_imports' => true,
'array_syntax' => ['syntax' => 'short'],
]);
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.PHONY: help
help: #! Show this help message
@echo 'Usage: make [target] ... '
@echo ''
@echo 'Targets:'
@grep -h -F '#!' $(MAKEFILE_LIST) | grep -v grep | sed 's/:.*#!/:/' | column -t -s":"

.PHONY: test
test: #! Run unit tests
php -d xdebug.mode=coverage vendor/bin/phpunit

.PHONY: coverage
coverage: #! Run unit tests with test coverage
php -d xdebug.mode=coverage vendor/bin/phpunit

.PHONY: lint
lint: #! Run quality control tools (e.g. psalm)
./vendor/bin/psalm --no-cache
composer cs-check
16 changes: 12 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
}
],
"require": {
"php": ">=7.3",
"predis/predis": ">=1.0.0 <3.0.0",
"launchdarkly/server-sdk": ">=4.0.0 <7.0.0"
"php": ">=8.1",
"predis/predis": ">=2.3.0 <3.0.0",
"launchdarkly/server-sdk": ">=6.3.0 <7.0.0"
},
"require-dev": {
"phpunit/phpunit": "^9"
"friendsofphp/php-cs-fixer": "^3.68",
"phpunit/php-code-coverage": "^9",
"phpunit/phpunit": "^9",
"vimeo/psalm": "^5.26"
},
"autoload": {
"psr-4": {
Expand All @@ -39,5 +42,10 @@
},
"config": {
"sort-packages": true
},
"scripts": {
"cs-check": "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose --config=.php-cs-fixer.php",
"cs-fix": "vendor/bin/php-cs-fixer fix --diff --verbose --config=.php-cs-fixer.php"
}

}
15 changes: 15 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
13 changes: 5 additions & 8 deletions src/LaunchDarkly/Impl/Integrations/RedisFeatureRequester.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<?php

namespace LaunchDarkly\Impl\Integrations;

use LaunchDarkly\Impl\Integrations\FeatureRequesterBase;
use Predis\ClientInterface;
use Predis\Client;
use Predis\ClientInterface;

class RedisFeatureRequester extends FeatureRequesterBase
{
/** @var ClientInterface */
var $_connection;
/** @var array */
var $_redisOptions;
/** @var string */
var $_prefix;
public ?ClientInterface $_connection = null;
public ?array $_redisOptions = null;
public ?string $_prefix;

const DEFAULT_PREFIX = 'launchdarkly';

Expand Down
1 change: 1 addition & 0 deletions src/LaunchDarkly/Integrations/Redis.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace LaunchDarkly\Integrations;

use \LaunchDarkly\Impl\Integrations\RedisFeatureRequester;
Expand Down
2 changes: 1 addition & 1 deletion tests/RedisFeatureRequesterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RedisFeatureRequesterTest extends DatabaseFeatureRequesterTestBase

public static function setUpBeforeClass(): void
{
self::$predisClient = new Client(array());
self::$predisClient = new Client([]);
}

protected function clearExistingData($prefix): void
Expand Down
2 changes: 1 addition & 1 deletion tests/RedisFeatureRequesterWithPredisOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RedisFeatureRequesterWithPredisOptionsTest extends DatabaseFeatureRequeste

public static function setUpBeforeClass(): void
{
self::$predisClient = new Client(array());
self::$predisClient = new Client([]);
}

protected function clearExistingData($prefix): void
Expand Down
Loading