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

Support for PHP 8 #539

Closed
wants to merge 3 commits into from
Closed
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
5 changes: 1 addition & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -14,11 +14,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['8.0', '8.1', '8.2', '8.3']
experimental: [false]
include:
- php-versions: '8.0'
experimental: true


steps:
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -10,18 +10,18 @@
"type": "wordpress-plugin",
"require": {
"cloudflare/cf-ip-rewrite": "^1.0.0",
"symfony/polyfill-intl-idn": "*",
"psr/log": "^1.0"
"symfony/polyfill-intl-idn": "^1.22",
"psr/log": "^3.0"
},
"require-dev": {
"symfony/yaml": "~2.6",
"johnkary/phpunit-speedtrap": "*",
"php-mock/php-mock-phpunit": "*",
"phpunit/phpunit": "*",
"squizlabs/php_codesniffer": "*",
"phpcompatibility/php-compatibility": "*",
"dealerdirect/phpcodesniffer-composer-installer": "*",
"phpdocumentor/reflection-docblock": "*"
"symfony/yaml": "^5.3",
"johnkary/phpunit-speedtrap": "^3.0",
"php-mock/php-mock-phpunit": "^2.5",
"phpunit/phpunit": "^9.3",
"squizlabs/php_codesniffer": "^3.6",
"phpcompatibility/php-compatibility": "^9.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"phpdocumentor/reflection-docblock": "^5.2"
},
"scripts": {
"format": "php vendor/bin/phpcs -d date.timezone=UTC --standard=phpcs.xml",
@@ -35,7 +35,7 @@
"version": "4.12.6",
"config": {
"platform": {
"php": "7.2"
"php": "8.0"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
1,047 changes: 778 additions & 269 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ Tags: cloudflare, seo, ssl, ddos, speed, security, cdn, performance, free
Requires at least: 3.4
Tested up to: 6.2
Stable tag: 4.12.6
Requires PHP: 7.2
Requires PHP: 8.0
License: BSD-3-Clause

All of Cloudflare’s performance and security benefits in a simple one-click install.
@@ -49,7 +49,7 @@ Cloudflare’s WAF is available on all our [paid plans](https://www.cloudflare.c

= Prerequisite =

Make sure your PHP version is 7.2 or higher.
Make sure your PHP version is 8.0 or higher.

= Speed Up Your WordPress Site with Cloudflare APO =

13 changes: 7 additions & 6 deletions src/Integration/DefaultLogger.php
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
use Psr\Log\AbstractLogger;
use Psr\Log\LogLevel;
use Psr\Log\LoggerInterface;
use Stringable;

class DefaultLogger extends AbstractLogger implements LoggerInterface
{
@@ -24,25 +25,25 @@ public function __construct($debug = false)
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param Stringable|string $message
* @param array $context
*/
public function log($level, $message, array $context = array())
public function log($level, Stringable|string $message, array $context = []): void
{
return error_log(self::PREFIX.' '.strtoupper($level).': '.$message.' '.
error_log(self::PREFIX.' '.strtoupper($level).': '.$message.' '.
(!empty($context) ? print_r($context, true) : ''));
}

/**
* Detailed debug information.
*
* @param string $message
* @param Stringable|string $message
* @param array $context
*/
public function debug($message, array $context = array())
public function debug(Stringable|string $message, array $context = []): void
{
if ($this->debug) {
return $this->log(LogLevel::DEBUG, $message, $context);
$this->log(LogLevel::DEBUG, $message, $context);
}
}
}