Skip to content

Commit

Permalink
Drop PHP 7.4 support (#77)
Browse files Browse the repository at this point in the history
* Drop support for PHP 7.4. Update dependencies for PHP >= 8.0.

* Changelogs

* Add PHP 8 attribute.

* Update rules.

* Version 2.3.0.

* Update PHP versions

* Update versions.

* Ignore PHPCS report.

* Update rules.

* Include over require.
  • Loading branch information
thefrosty authored Nov 1, 2023
1 parent a0ab12e commit c67d88c
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .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: [ '7.4', '8.0', '8.1' ]
php-versions: [ '8.0', '8.1', '8.2' ]
wp-versions: [ 'latest' ]
coverage: [ true ]
services:
Expand All @@ -40,7 +40,7 @@ jobs:
WORDPRESS_DB_USER: wp
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # No shallow clone, we need all history!

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set Release Version env
run: |
Expand All @@ -38,10 +38,10 @@ jobs:
echo "RELEASE_VERSION=${VERSION//v}" >> $GITHUB_ENV
# see https://github.com/shivammathur/setup-php
- name: Use PHP 7.4
- name: Use PHP 8.0
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tests/clover.xml
/wordpress
/vendor
composer.lock
phpcs-report.xml
9 changes: 9 additions & 0 deletions CHANGELONG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

## 2.3.0 - 2023-11-01

* Add support upto PHP 8.2.
* Drop support for PHP <= 7.4.

## 2.2.0 - 2023-07-23

* Feature/disable global emails.

## 2.1.11 - 2022-07-02

* Add encryption to login email.
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
},
"optimize-autoloader": true,
"platform": {
"php": "7.4"
"php": "8.0"
},
"preferred-install": "dist",
"sort-packages": true
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"ext-openssl": "*",
"composer/installers": "~1.0 || ~2.0",
"dwnload/wp-settings-api": "^3.6",
"dwnload/wp-settings-api": "^3.9",
"pimple/pimple": "~3.0",
"symfony/http-foundation": "^5.2 || ^6.0",
"thefrosty/wp-utilities": "^2.8"
"thefrosty/wp-utilities": "^3.2"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
Expand Down
7 changes: 6 additions & 1 deletion helpers.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace TheFrosty\WpLoginLocker\Helpers;

use JetBrains\PhpStorm\NoReturn;

/**
* Close the current session and terminate all scripts.
*/
#[NoReturn]
function terminate(): void
{
\session_write_close();
Expand Down
18 changes: 11 additions & 7 deletions phpcs-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@
<arg name="tab-width" value="4"/>
<!-- For CI, don't fail on warnings -->
<config name="ignore_warnings_on_exit" value="1"/>
<config name="minimum_supported_wp_version" value="5.5" />
<config name="minimum_supported_wp_version" value="6.2" />

<rule ref="PSR2"/>
<!-- @todo Enable Slevomat, (just need to disable some new rules)-->
<!-- <rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml">-->
<!-- </rule>-->
<rule ref="PSR12">
<exclude name="PSR12.Classes.OpeningBraceSpace.Found"/>
<exclude name="PSR12.Files.FileHeader.IncorrectOrder"/>
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
<exclude name="PSR12.Files.OpenTag.NotAlone"/>
<exclude name="PSR12.Traits.UseDeclaration.MultipleImport"/>
<exclude name="PSR12.Traits.UseDeclaration.UseAfterBrace"/>
</rule>

<!-- Loads the PHP Compatibility ruleset. -->
<rule ref="PHPCompatibility" />
<!-- Check for cross-version support for PHP 7.3 and higher. -->
<config name="testVersion" value="7.4-"/>
<!-- Check for cross-version support for PHP 8.0 and higher. -->
<config name="testVersion" value="8.0-"/>
</ruleset>
12 changes: 6 additions & 6 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.2.0
* Requires at least: 5.7
* Tested up to: 6.2.2
* Requires PHP: 7.4
* Version: 2.3.0
* Requires at least: 6.2
* Tested up to: 6.3.2
* Requires PHP: 8.0
* Plugin URI: https://github.com/thefrosty/wp-login-locker
* GitHub Plugin URI: https://github.com/thefrosty/wp-login-locker
* Primary Branch: develop
Expand All @@ -25,7 +25,7 @@
use TheFrosty\WpUtilities\WpAdmin\DisablePluginUpdateCheck;

if (\is_readable(__DIR__ . '/vendor/autoload.php')) {
require __DIR__ . '/vendor/autoload.php';
include_once __DIR__ . '/vendor/autoload.php';
}

$plugin = PluginFactory::create('login-locker');
Expand All @@ -40,7 +40,7 @@
->add(new Login\WpLogin())
->add(new Settings())
->add(new WpCore\WpSignup())
->add(new WpSettingsApi(Settings::factory('2.2.0')))
->add(new WpSettingsApi(Settings::factory('2.3.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 c67d88c

Please sign in to comment.