Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
coverage: none
tools: cs2pr

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix:
# Lint against the highest/lowest supported versions of each PHP major.
# And also do a run against "nightly" (the current dev version of PHP).
php_version: ['7.4', '8.0', '8.1', '8.2']
php_version: ['8.2', '8.3', '8.4']

name: "Lint: PHP ${{ matrix.php_version }}"

Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,18 @@ jobs:
strategy:
matrix:
include:
- php_version: '7.4'
wp_version: '6.2'
multisite: false

- php_version: '8.0'
wp_version: '6.2'
- php_version: '8.2'
wp_version: '6.6'
multisite: false

- php_version: '8.1'
wp_version: 'latest'
multisite: true

- php_version: '8.2'
wp_version: '6.4'
wp_version: '6.6'
multisite: true

- php_version: '8.4'
wp_version: 'latest'
multisite: false

name: "Integration Test: PHP ${{ matrix.php_version }} | WP ${{ matrix.wp_version }}${{ matrix.multisite == true && ' (+ ms)' || '' }}"

# Allow builds to fail on as-of-yet unreleased WordPress versions.
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ phpcs.xml
.cache/phpcs.cache
phpunit.xml
.phpunit.result.cache

.php-cs-fixer.cache
16 changes: 16 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$finder = ( new PhpCsFixer\Finder() )
->in( __DIR__ )
->exclude(
[
'tests/',
'vendor/',
'node_modules/',
]
);

$config = new PhpCsFixer\Config();
$config->setUnsupportedPhpVersionAllowed( true );

return $config->setRules( [] )->setFinder( $finder );
2 changes: 1 addition & 1 deletion admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function show_forward_status( $comment_text, $comment ): string {
return $comment_text;
}

$ch_forwarded = \get_comment_meta( (int) $comment->comment_ID, 'ch_forwarded' );
$ch_forwarded = \get_comment_meta( (int) $comment->comment_ID, 'ch_forwarded', false );
if ( $ch_forwarded ) {
/* translators: %s is replaced by the name you're forwarding to. */
$pre = '<div style="background: #fff;border: 1px solid #46b450;border-left-width: 4px;box-shadow: 0 1px 1px rgba(0,0,0,.04);margin: 5px 15px 2px 0;padding: 1px 12px 1px;"><p><strong>' . \sprintf( \esc_html__( 'This comment was forwarded to %s.', 'comment-hacks' ), \esc_html( $this->options['forward_name'] ) ) . '</strong></p></div>';
Expand Down
4 changes: 2 additions & 2 deletions admin/comment-parent.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function update_comment_parent() {
return; // There might be another reason for a comment to be updated.
}

if ( \defined( 'DOING_AJAX' ) && \DOING_AJAX === true ) {
if ( \function_exists( 'wp_doing_ajax' ) && \wp_doing_ajax() ) {
\check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
}

if ( ! \defined( 'DOING_AJAX' ) || \DOING_AJAX !== true ) {
if ( ! \function_exists( 'wp_doing_ajax' ) || ! \wp_doing_ajax() ) {
\check_admin_referer( 'update-comment_' . $comment_id );
}

Expand Down
41 changes: 23 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,23 @@
"source": "https://github.com/emilia-capital/comment-hacks"
},
"require": {
"php": ">=7.4",
"php": ">=8.2",
"composer/installers": "^1.12.0"
},
"require-dev": {
"yoast/yoastcs": "^3.1",
"yoast/wp-test-utils": "^1.1.1",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.3",
"phpstan/extension-installer": "^1.3"
"wp-coding-standards/wpcs": "^3.1",
"phpcompatibility/phpcompatibility-wp": "*",
"php-parallel-lint/php-parallel-lint": "^1.3",
"yoast/wp-test-utils": "^1.2",
"phpstan/phpstan": "^2.0",
"szepeviktor/phpstan-wordpress": "^2.0",
"phpstan/extension-installer": "^1.4",
"yoast/yoastcs": "^3.0",
"friendsofphp/php-cs-fixer": "^3.75"
},
"config": {
"platform": {
"php": "7.4"
"php": "8.3"
},
"allow-plugins": {
"composer/installers": true,
Expand All @@ -51,24 +55,25 @@
]
},
"scripts": {
"lint": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude node_modules --exclude .git"
],
"config-yoastcs" : [
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set default_standard Yoast"
],
"check-cs": [
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-"
"@php ./vendor/bin/phpcs -s"
],
"fix-cs": [
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf"
"PHP_CS_FIXER_IGNORE_ENV=1",
"@php ./vendor/bin/phpcbf",
"@php ./vendor/bin/php-cs-fixer fix . --allow-risky=yes"
],
"lint": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude node_modules --exclude .git"
],
"lint-blueprint": [
"@php -r \"exit( intval( is_null( json_decode( file_get_contents( './.wordpress-org/blueprints/blueprint.json' ) ) ) ) );\""
],
"test": [
"@php ./vendor/phpunit/phpunit/phpunit"
"@php ./vendor/phpunit/phpunit/phpunit --dont-report-useless-tests"
],
"phpstan": [
"@php ./vendor/bin/phpstan analyse --memory-limit=2048M ."
"@php ./vendor/bin/phpstan analyse --memory-limit=2048M"
]
}
}
Loading