Skip to content

Commit

Permalink
Merge pull request #1163 from alleyinteractive/feature/issue-1162/sup…
Browse files Browse the repository at this point in the history
…port-php-8-3

Issue-1162: Support PHP 8.3
  • Loading branch information
renatonascalves authored Sep 12, 2024
2 parents 29fd125 + f07dd54 commit 2e8f03f
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 52 deletions.
1 change: 1 addition & 0 deletions .deployignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ vendor
.eslintrc.json
.gitignore
.nvmrc
.phpunit-watcher.yml
.phpcs.xml
.phpcs-cache.json
.phpunit.result.cache
Expand Down
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ vendor
.gitignore
.nvmrc
.phpcs.xml
.phpunit-watcher.yml
.phpcs-cache.json
.phpunit.result.cache
babel.config.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
phpcs:
strategy:
matrix:
php: [ 8.2 ]
php: [ '8.3' ]
if: github.event.pull_request.draft == false
uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ jobs:
strategy:
matrix:
multisite: [true, false]
php: ['8.2', '8.1', '8.0']
php: ['8.3', '8.2', '8.1', '8.0']
wordpress: ["latest"]
include:
- php: '8.0'
wordpress: '6.3'
multisite: false
if: github.event.pull_request.draft == false
uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main
with:
Expand Down
56 changes: 28 additions & 28 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,36 @@
<!-- Include Alley Rules -->
<rule ref="Alley-Interactive" />

<!-- Check for cross-version support for PHP 7.4 and higher. -->
<!--
Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
-->
<arg value="ps" />

<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache" value=".phpcs-cache.json" />

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./" />

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20" />

<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1" />

<!-- Check for cross-version support for PHP 8.0 and higher. -->
<config name="testVersion" value="8.0-"/>

<!-- The version set here matches the minimum version tested. -->
<config name="minimum_wp_version" value="6.3" />

<!-- Exclude a few directories and autogenerated files. -->
<exclude-pattern>build/</exclude-pattern>
<exclude-pattern>node_modules/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>

<!-- Set the text domain for i18n. -->
<rule ref="WordPress.WP.I18n">
<properties>
Expand Down Expand Up @@ -43,31 +70,4 @@
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>tests/</exclude-pattern>
</rule>

<!--
Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
-->
<arg value="ps" />

<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache" value=".phpcs-cache.json" />

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./" />

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20" />

<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1" />

<!-- Exclude a few directories and autogenerated files. -->
<exclude-pattern>build/</exclude-pattern>
<exclude-pattern>node_modules/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>

<!-- The version set here matches the minimum version in readme.txt. -->
<config name="minimum_wp_version" value="6.3" />
</ruleset>
6 changes: 6 additions & 0 deletions .phpunit-watcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
watch:
directories:
- tests
- admin
- includes
fileMask: '*.php'
10 changes: 3 additions & 7 deletions apple-news.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ function apple_news_date( $format, $timestamp = null, $timezone = null ) {
*/
function apple_news_activate_wp_plugin() {
// Check for PHP version.
if ( version_compare( PHP_VERSION, '5.3.6' ) < 0 ) {
if ( version_compare( PHP_VERSION, '8.0.0' ) < 0 ) {
deactivate_plugins( basename( __FILE__ ) );
wp_die( esc_html__( 'This plugin requires at least PHP 5.3.6', 'apple-news' ) );
wp_die( esc_html__( 'This plugin requires at least PHP 8.0.0', 'apple-news' ) );
}
}

Expand Down Expand Up @@ -194,9 +194,5 @@ function apple_news_is_classic_editor_plugin_active() {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}

if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
return true;
}

return false;
return is_plugin_active( 'classic-editor/classic-editor.php' );
}
30 changes: 15 additions & 15 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<php>
<const name="APPLE_NEWS_UNIT_TESTS" value="1" />
</php>
<testsuites>
<testsuite name="Unit Tests">
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true">
<php>
<const name="APPLE_NEWS_UNIT_TESTS" value="1" />
</php>
<testsuites>
<testsuite name="Unit Tests">
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 2e8f03f

Please sign in to comment.