Skip to content

Commit

Permalink
Set min PHP to 8.1 (#81)
Browse files Browse the repository at this point in the history
* Update dependencies for PHP ^8.1.

* Change void function to never return type.

https://php.watch/versions/8.1/never-return-type

* Update test version to PHP 8.1.

* Change publish PHP version to 8.1.

* Remove PHP 8.0, and add 8.3.

* Update void return type to never.

* Version 2.4.0; requires PHP >= 8.1.
  • Loading branch information
thefrosty authored Mar 8, 2024
1 parent 04330d1 commit bb7f2de
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: [ '8.0', '8.1', '8.2' ]
php-versions: [ '8.1', '8.2', '8.3' ]
wp-versions: [ 'latest' ]
coverage: [ true ]
services:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
echo "RELEASE_VERSION=${VERSION//v}" >> $GITHUB_ENV
# see https://github.com/shivammathur/setup-php
- name: Use PHP 8.0
- name: Use PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@
},
"optimize-autoloader": true,
"platform": {
"php": "8.0"
"php": "8.1"
},
"preferred-install": "dist",
"sort-packages": true
},
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-openssl": "*",
"composer/installers": "~1.0 || ~2.0",
"dwnload/wp-settings-api": "^3.9",
"composer/installers": "~2.0",
"dwnload/wp-settings-api": "^3.10",
"pimple/pimple": "~3.0",
"symfony/http-foundation": "^5.2 || ^6.0",
"thefrosty/wp-utilities": "^3.2"
"symfony/http-foundation": "^6.0 || ^7.0",
"thefrosty/wp-utilities": "^3.3"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"ext-simplexml": "*",
"phpunit/php-code-coverage": "^9",
"phpunit/php-code-coverage": "^10",
"phpcompatibility/php-compatibility": "*",
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^10",
"roave/security-advisories": "dev-master",
"roots/wordpress": "^6.0.0",
"roots/wordpress": "^6.4",
"slevomat/coding-standard": "~8.14",
"squizlabs/php_codesniffer": "^3.2",
"wp-phpunit/wp-phpunit": "^6.0.0",
"yoast/phpunit-polyfills": "^1.0.5 || ^2.0"
"wp-phpunit/wp-phpunit": "^6.4",
"yoast/phpunit-polyfills": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 5 additions & 5 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace TheFrosty\WpLoginLocker\Helpers;

use JetBrains\PhpStorm\NoReturn;
use function session_write_close;
use function wp_die;

/**
* Close the current session and terminate all scripts.
*/
#[NoReturn]
function terminate(): void
function terminate(): never
{
\session_write_close();
\wp_die();
session_write_close();
wp_die();
}
4 changes: 2 additions & 2 deletions phpcs-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<!-- For CI, don't fail on warnings -->
<config name="ignore_warnings_on_exit" value="1"/>
<config name="minimum_supported_wp_version" value="6.2" />
<!-- Check for cross-version support for PHP 8.0 and higher. -->
<config name="testVersion" value="8.0-"/>
<!-- Check for cross-version support for PHP 8.1 and higher. -->
<config name="testVersion" value="8.1-"/>

<rule ref="PSR12">
<exclude name="PSR12.Classes.OpeningBraceSpace.Found"/>
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</php>
<testsuites>
<testsuite name="unit">
<directory phpVersion="7.4" phpVersionOperator=">=" suffix="Test.php">./tests/unit</directory>
<directory phpVersion="8.1" phpVersionOperator=">=" suffix="Test.php">./tests/unit</directory>
</testsuite>
</testsuites>

Expand Down
2 changes: 1 addition & 1 deletion src/Login/WpLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected function lostPasswordMessage($message): string
* Render the fake login HTML and send the response to the page.
* Sets a 403 Forbidden Status code and terminates all processes.
*/
private function noAuthLoginHtml(): void
private function noAuthLoginHtml(): never
{
\ob_start();
include $this->getPlugin()->getDirectory() . 'templates/login/wp-login.php';
Expand Down
2 changes: 1 addition & 1 deletion src/WpCore/WpSignup.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function addHooks(): void
/**
* Redirect all requests to the 'wp-signup.php' page back to the network home URL.
*/
protected function redirectWpSignup(): void
protected function redirectWpSignup(): never
{
// Don't allow POST requests to the wp-signup.php page
if (!empty($this->getRequest()->request->all())) {
Expand Down
8 changes: 4 additions & 4 deletions wp-login-locker.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Description: Disable direct access to your sites /wp-login.php script, plus user notifications based on actions.
* Author: Austin Passy
* Author URI: https://github.com/thefrosty
* Version: 2.3.1
* Version: 2.4.0
* Requires at least: 6.2
* Tested up to: 6.4.1
* Requires PHP: 8.0
* Tested up to: 6.5
* Requires PHP: 8.1
* Plugin URI: https://github.com/thefrosty/wp-login-locker
* GitHub Plugin URI: https://github.com/thefrosty/wp-login-locker
* Primary Branch: develop
Expand Down Expand Up @@ -40,7 +40,7 @@
->add(new Login\WpLogin())
->add(new Settings())
->add(new WpCore\WpSignup())
->add(new WpSettingsApi(Settings::factory('2.3.1')))
->add(new WpSettingsApi(Settings::factory('2.4.0')))
->addOnHook(Login\Login::class, 'login_init', 5)
->addOnHook(Login\LastLoginColumns::class, 'admin_init', 10, true)
->addOnHook(UserProfile\LastLogin::class, 'admin_init', 10, true)
Expand Down

0 comments on commit bb7f2de

Please sign in to comment.