update code style to WPCS v3.0

This commit is contained in:
Stefan Kalscheuer 2023-11-09 18:14:31 +01:00
parent a1a3117141
commit 61ba951f0b
Signed by: stefan
GPG Key ID: 3887EC2A53B55430
5 changed files with 12 additions and 11 deletions

View File

@ -39,7 +39,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: composer
- name: Setup Node
uses: actions/setup-node@v3

View File

@ -21,14 +21,14 @@
"composer/installers": "~1.12"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^v0.7",
"dealerdirect/phpcodesniffer-composer-installer": "^v1.0",
"matthiasmullie/minify": "^1.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpunit/phpunit": "^5|^6|^7|^8|^9",
"slowprog/composer-copy-file": "~0.3",
"squizlabs/php_codesniffer": "^3.7",
"wp-coding-standards/wpcs": "^2.3",
"yoast/phpunit-polyfills": "^1.0"
"wp-coding-standards/wpcs": "^3.0",
"yoast/phpunit-polyfills": "^2.0"
},
"scripts": {
"post-install-cmd": [

View File

@ -95,15 +95,16 @@ class Widget extends WP_Widget {
$wp_query = new WP_Query( $args );
$cnt = 0;
while ( $wp_query->have_posts() && ( $count <= 0 || ++ $cnt < $count ) ) {
while ( $wp_query->have_posts() && ( $count <= 0 || ++$cnt < $count ) ) {
$wp_query->the_post();
// @codingStandardsIgnoreLine
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo SCLiveticker::tick_html_widget(
esc_html( get_the_time( 'd.m.Y - H:i' ) ),
get_the_title(),
( '1' === $highlight && get_the_time( 'U' ) > ( time() - $highlight_time ) ),
get_the_ID()
);
// phpcs:enable
}
echo '</ul>';

View File

@ -64,11 +64,11 @@ spl_autoload_register( 'scliveticker_autoload' );
/**
* Autoloader for Liveticker classes.
*
* @param string $class Name of the class to load.
* @param string $class_name Name of the class to load.
*
* @return void
*/
function scliveticker_autoload( $class ) {
function scliveticker_autoload( $class_name ) {
$plugin_classes = array(
'SCLiveticker\\SCLiveticker',
'SCLiveticker\\Admin',
@ -76,11 +76,11 @@ function scliveticker_autoload( $class ) {
'SCLiveticker\\System',
'SCLiveticker\\Widget',
);
if ( in_array( $class, $plugin_classes, true ) ) {
if ( in_array( $class_name, $plugin_classes, true ) ) {
require_once sprintf(
'%s/includes/class-%s.php',
SCLIVETICKER_DIR,
strtolower( str_replace( '_', '-', substr( $class, 13 ) ) )
strtolower( str_replace( '_', '-', substr( $class_name, 13 ) ) )
);
}
}

View File

@ -54,7 +54,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php esc_html_e( 'all', 'stklcode-liveticker' ); ?>
</option>
<?php
for ( $i = 1; $i <= 10; $i ++ ) {
for ( $i = 1; $i <= 10; $i++ ) {
printf(
'<option value="%d"%s>%d</option>',
$i,