style(phpcs): autofix WordPress-Core violations via phpcbf
Run phpcbf --standard=WordPress-Core across includes/, prautoblogger.php, and uninstall.php. Fixed 1,362 formatting violations in 75 files: - Short array syntax: [] → array() - Line breaking for long function calls - Consistent indentation - Function call parameter alignment No logic changes; purely mechanical formatting.
This commit is contained in:
@@ -26,19 +26,19 @@ class PRAutoBlogger_Logger {
|
||||
public const LEVEL_INFO = 2;
|
||||
public const LEVEL_DEBUG = 3;
|
||||
|
||||
private const LEVEL_MAP = [
|
||||
private const LEVEL_MAP = array(
|
||||
'error' => self::LEVEL_ERROR,
|
||||
'warning' => self::LEVEL_WARNING,
|
||||
'info' => self::LEVEL_INFO,
|
||||
'debug' => self::LEVEL_DEBUG,
|
||||
];
|
||||
);
|
||||
|
||||
private const LEVEL_LABELS = [
|
||||
private const LEVEL_LABELS = array(
|
||||
self::LEVEL_ERROR => 'error',
|
||||
self::LEVEL_WARNING => 'warning',
|
||||
self::LEVEL_INFO => 'info',
|
||||
self::LEVEL_DEBUG => 'debug',
|
||||
];
|
||||
);
|
||||
|
||||
/** Singleton instance. */
|
||||
private static ?self $instance = null;
|
||||
@@ -66,7 +66,7 @@ class PRAutoBlogger_Logger {
|
||||
* @param string $context Origin class or pipeline stage.
|
||||
* @param array<string, mixed> $meta Optional structured data.
|
||||
*/
|
||||
public function error( string $message, string $context = '', array $meta = [] ): void {
|
||||
public function error( string $message, string $context = '', array $meta = array() ): void {
|
||||
$this->log( self::LEVEL_ERROR, $message, $context, $meta );
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class PRAutoBlogger_Logger {
|
||||
* @param string $context
|
||||
* @param array<string, mixed> $meta
|
||||
*/
|
||||
public function warning( string $message, string $context = '', array $meta = [] ): void {
|
||||
public function warning( string $message, string $context = '', array $meta = array() ): void {
|
||||
$this->log( self::LEVEL_WARNING, $message, $context, $meta );
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class PRAutoBlogger_Logger {
|
||||
* @param string $context
|
||||
* @param array<string, mixed> $meta
|
||||
*/
|
||||
public function info( string $message, string $context = '', array $meta = [] ): void {
|
||||
public function info( string $message, string $context = '', array $meta = array() ): void {
|
||||
$this->log( self::LEVEL_INFO, $message, $context, $meta );
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class PRAutoBlogger_Logger {
|
||||
* @param string $context
|
||||
* @param array<string, mixed> $meta
|
||||
*/
|
||||
public function debug( string $message, string $context = '', array $meta = [] ): void {
|
||||
public function debug( string $message, string $context = '', array $meta = array() ): void {
|
||||
$this->log( self::LEVEL_DEBUG, $message, $context, $meta );
|
||||
}
|
||||
|
||||
@@ -134,13 +134,16 @@ class PRAutoBlogger_Logger {
|
||||
$table = $wpdb->prefix . 'prautoblogger_event_log';
|
||||
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$wpdb->insert( $table, [
|
||||
'level' => $label,
|
||||
'context' => substr( $context, 0, 100 ),
|
||||
'message' => substr( $message, 0, 2000 ),
|
||||
'meta_json' => ! empty( $meta ) ? wp_json_encode( $meta ) : null,
|
||||
'created_at' => current_time( 'mysql' ),
|
||||
] );
|
||||
$wpdb->insert(
|
||||
$table,
|
||||
array(
|
||||
'level' => $label,
|
||||
'context' => substr( $context, 0, 100 ),
|
||||
'message' => substr( $message, 0, 2000 ),
|
||||
'meta_json' => ! empty( $meta ) ? wp_json_encode( $meta ) : null,
|
||||
'created_at' => current_time( 'mysql' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,8 +164,8 @@ class PRAutoBlogger_Logger {
|
||||
): array {
|
||||
global $wpdb;
|
||||
$table = $wpdb->prefix . 'prautoblogger_event_log';
|
||||
$where = [];
|
||||
$params = [];
|
||||
$where = array();
|
||||
$params = array();
|
||||
|
||||
if ( 'all' !== $level_filter && isset( self::LEVEL_MAP[ $level_filter ] ) ) {
|
||||
$where[] = 'level = %s';
|
||||
@@ -201,7 +204,10 @@ class PRAutoBlogger_Logger {
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
return [ 'rows' => $rows ?: [], 'total' => $total ];
|
||||
return array(
|
||||
'rows' => $rows ?: array(),
|
||||
'total' => $total,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user