| @@ -34,9 +34,9 @@ | ||
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Rule options. |
| 37 | 37 | * |
| 38 | - * @var array | |
| 38 | + * @var array<string,mixed> | |
| 39 | 39 | */ |
| 40 | 40 | public $options; |
| 41 | 41 | |
| 42 | 42 | /** |
| @@ -50,9 +50,9 @@ | ||
| 50 | 50 | * Rule extras. |
| 51 | 51 | * |
| 52 | 52 | * Such as post type or taxnomy like meta. |
| 53 | 53 | * |
| 54 | - * @var array | |
| 54 | + * @var array<string,mixed> | |
| 55 | 55 | */ |
| 56 | 56 | public $extras = []; |
| 57 | 57 | |
| 58 | 58 | /** |
| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Rule definition. |
| 67 | 67 | * |
| 68 | - * @var array | |
| 68 | + * @var array<string,mixed>|null | |
| 69 | 69 | */ |
| 70 | 70 | public $definition; |
| 71 | 71 | |
| 72 | 72 | /** |
| @@ -78,9 +78,9 @@ | ||
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Build a rule. |
| 81 | 81 | * |
| 82 | - * @param array $rule Rule data. | |
| 82 | + * @param array{id:string,name:string,notOperand:bool,options:array<string,mixed>,extras:array<string,mixed>} $rule Rule data. | |
| 83 | 83 | */ |
| 84 | 84 | public function __construct( $rule ) { |
| 85 | 85 | $rule = wp_parse_args( $rule, [ |
| 86 | 86 | 'id' => '', |
| @@ -99,9 +99,9 @@ | ||
| 99 | 99 | $this->definition = plugin( 'rules' )->get_rule( $name ); |
| 100 | 100 | |
| 101 | 101 | if ( ! $this->definition ) { |
| 102 | 102 | /* translators: 1. Rule name. */ |
| 103 | - plugin( 'logging' )->log( 'ERROR: ' . sprintf( __( 'Rule `%s` not found.', 'content-control' ), $name ) ); | |
| 103 | + plugin( 'logging' )->log_unique( 'ERROR: ' . sprintf( __( 'Rule `%s` not found.', 'content-control' ), $name ) ); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $extras = isset( $this->definition['extras'] ) ? $this->definition['extras'] : []; |
| 107 | 107 | |
| @@ -115,10 +115,10 @@ | ||
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * Parse rule options based on rule definitions. |
| 118 | 118 | * |
| 119 | - * @param array $options Array of rule opions. | |
| 120 | - * @return array | |
| 119 | + * @param array<string,mixed> $options Array of rule opions. | |
| 120 | + * @return array<string,mixed> | |
| 121 | 121 | */ |
| 122 | 122 | public function parse_options( $options = [] ) { |
| 123 | 123 | return $options; |
| 124 | 124 | } |
| @@ -147,15 +147,15 @@ | ||
| 147 | 147 | $callback = isset( $this->definition['callback'] ) ? $this->definition['callback'] : null; |
| 148 | 148 | |
| 149 | 149 | if ( ! $callback ) { |
| 150 | 150 | /* translators: 1. Rule name. */ |
| 151 | - plugin( 'logging' )->log( 'ERROR: ' . esc_html( sprintf( __( 'Rule `%s` has no callback.', 'content-control' ), $this->name ) ) ); | |
| 151 | + plugin( 'logging' )->log_unique( 'ERROR: ' . esc_html( sprintf( __( 'Rule `%s` has no callback.', 'content-control' ), $this->name ) ) ); | |
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if ( ! is_callable( $callback ) ) { |
| 156 | 156 | /* translators: 1. Rule name. 2. Callback name. */ |
| 157 | - plugin( 'logging' )->log( 'ERROR: ' . esc_html( sprintf( __( 'Rule `%1$s` callback is not callable (%2$s).', 'content-control' ), $this->name, $callback ) ) ); | |
| 157 | + plugin( 'logging' )->log_unique( 'ERROR: ' . esc_html( sprintf( __( 'Rule `%1$s` callback is not callable (%2$s).', 'content-control' ), $this->name, $callback ) ) ); | |
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Set global current rule so it can be easily accessed. |
| @@ -210,9 +210,9 @@ | ||
| 210 | 210 | * Return the rule check as an array of information. |
| 211 | 211 | * |
| 212 | 212 | * Useful for debugging. |
| 213 | 213 | * |
| 214 | - * @return array|null | |
| 214 | + * @return array<string,mixed>|null | |
| 215 | 215 | */ |
| 216 | 216 | public function get_check_info() { |
| 217 | 217 | if ( $this->is_js_rule() ) { |
| 218 | 218 | return null; |