chore: lint code

This commit is contained in:
Ben Goldsworthy 2021-05-02 20:12:47 +01:00
parent c25bd7d8a2
commit 8bb41c7a7a
9 changed files with 49 additions and 50 deletions

View file

@ -42,21 +42,21 @@ class Admin {
* @since 2.8.0
*/
public function __construct( /**
* The ID of this plugin.
*
* @access private
* @since 2.8.0
* @see Includes\Footnotes::$plugin_name
* @var string $plugin_name The ID of this plugin.
*/
* The ID of this plugin.
*
* @access private
* @since 2.8.0
* @see Includes\Footnotes::$plugin_name
* @var string $plugin_name The ID of this plugin.
*/
private string $plugin_name, /**
* The version of this plugin.
*
* @access private
* @since 2.8.0
* @see Includes\Footnotes::$version
* @var string $version The current version of this plugin.
*/
* The version of this plugin.
*
* @access private
* @since 2.8.0
* @see Includes\Footnotes::$version
* @var string $version The current version of this plugin.
*/
private string $version ) {
$this->load_dependencies();

View file

@ -328,7 +328,7 @@ abstract class Engine {
* @todo Review nonce verification.
*/
private function save_settings(): bool {
$l_arr_new_settings = array();
$l_arr_new_settings = array();
$l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : array_key_first( $this->a_arr_sections );
$l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ];
@ -574,13 +574,13 @@ abstract class Engine {
);
}
return sprintf(
'<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
$l_arr_data['name'],
$l_arr_data['id'],
$l_arr_data['value'],
$p_in_min,
$p_int_max
);
'<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
$l_arr_data['name'],
$l_arr_data['id'],
$l_arr_data['value'],
$p_in_min,
$p_int_max
);
}
}

View file

@ -48,19 +48,20 @@ class Init {
/**
* Initializes all WordPress hooks for the Plugin Settings.
*
*
* @since 1.5.0
* @since 2.8.0 Added `$plugin_name` parameter.
*/
public function __construct( /**
* The ID of this plugin.
*
* @access private
* @var string $plugin_name The ID of this plugin.
*
* @since 2.8.0
*/
private string $plugin_name ) {
public function __construct(
/**
* The ID of this plugin.
*
* @access private
* @var string $plugin_name The ID of this plugin.
*
* @since 2.8.0
*/
private string $plugin_name
) {
$this->load_dependencies();
$this->settings_page = new Settings( $this->plugin_name );

View file

@ -185,10 +185,10 @@ class Convert {
$p_int_index = (int) $p_int_index;
}
// Return the whole arrow array.
if ($p_int_index < 0) {
if ( $p_int_index < 0 ) {
return $l_arr_arrows;
}
if ($p_int_index > count( $l_arr_arrows )) {
if ( $p_int_index > count( $l_arr_arrows ) ) {
return $l_arr_arrows;
}
// Return a single arrow.

View file

@ -54,7 +54,7 @@ class Core {
*
* @var Loader $loader Maintains and registers all hooks for the plugin.
*/
protected ?\footnotes\includes\Loader $loader = null;
protected \footnotes\includes\Loader $loader;
/**
* The unique identifier of this plugin

View file

@ -40,7 +40,7 @@ class i18n {
load_plugin_textdomain(
'footnotes',
false,
dirname(plugin_basename( __FILE__ ), 2) . '/languages/'
dirname( plugin_basename( __FILE__ ), 2 ) . '/languages/'
);
}

View file

@ -1109,7 +1109,6 @@ class Settings {
/**
* Stores a singleton reference of this class.
*
*
* @since 1.5.0
*/
private static ?\footnotes\includes\Settings $a_obj_instance = null;
@ -1344,7 +1343,6 @@ class Settings {
/**
* Returns a singleton of this class.
*
*
* @since 1.5.0
* @todo Remove?
*/

View file

@ -81,10 +81,10 @@ class Template {
*/
public function __construct( string $p_str_file_type, string $p_str_file_name, string $p_str_extension = 'html' ) {
// No template file type and/or file name set.
if (empty( $p_str_file_type )) {
if ( empty( $p_str_file_type ) ) {
return;
}
if (empty( $p_str_file_name )) {
if ( empty( $p_str_file_name ) ) {
return;
}
$this->plugin_directory = plugin_dir_path( __DIR__ );

View file

@ -302,7 +302,7 @@ class Parser {
if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ) ) ) {
add_filter(
'the_title',
fn(string $p_str_content): string => $this->footnotes_in_title( $p_str_content ),
fn( string $p_str_content): string => $this->footnotes_in_title( $p_str_content ),
$l_int_the_title_priority
);
}
@ -311,7 +311,7 @@ class Parser {
if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ) ) ) {
add_filter(
'the_content',
fn(string $p_str_content): string => $this->footnotes_in_content( $p_str_content ),
fn( string $p_str_content): string => $this->footnotes_in_content( $p_str_content ),
$l_int_the_content_priority
);
@ -329,7 +329,7 @@ class Parser {
*/
add_filter(
'term_description',
fn(string $p_str_content): string => $this->footnotes_in_content( $p_str_content ),
fn( string $p_str_content): string => $this->footnotes_in_content( $p_str_content ),
$l_int_the_content_priority
);
@ -345,7 +345,7 @@ class Parser {
*/
add_filter(
'pum_popup_content',
fn(string $p_str_content): string => $this->footnotes_in_content( $p_str_content ),
fn( string $p_str_content): string => $this->footnotes_in_content( $p_str_content ),
$l_int_the_content_priority
);
}
@ -361,7 +361,7 @@ class Parser {
*/
add_filter(
'the_excerpt',
fn(string $p_str_excerpt): string => $this->footnotes_in_excerpt( $p_str_excerpt ),
fn( string $p_str_excerpt): string => $this->footnotes_in_excerpt( $p_str_excerpt ),
$l_int_the_excerpt_priority
);
}
@ -372,7 +372,7 @@ class Parser {
*/
add_filter(
'widget_title',
fn(string $p_str_content): string => $this->footnotes_in_widget_title( $p_str_content ),
fn( string $p_str_content): string => $this->footnotes_in_widget_title( $p_str_content ),
$l_int_widget_title_priority
);
}
@ -383,7 +383,7 @@ class Parser {
*/
add_filter(
'widget_text',
fn(string $p_str_content): string => $this->footnotes_in_widget_text( $p_str_content ),
fn( string $p_str_content): string => $this->footnotes_in_widget_text( $p_str_content ),
$l_int_widget_text_priority
);
}
@ -792,7 +792,7 @@ class Parser {
$l_str_footnote_section_shortcode = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE );
$l_int_footnote_section_shortcode_length = strlen( $l_str_footnote_section_shortcode );
if ( !str_contains( $p_str_content, (string) $l_str_footnote_section_shortcode ) ) {
if ( ! str_contains( $p_str_content, (string) $l_str_footnote_section_shortcode ) ) {
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda
// Appends the reference container if set to "post_end".
@ -1717,7 +1717,7 @@ class Parser {
// If it is not, check which option is on.
$l_str_separator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_SEPARATOR_OPTION );
$l_str_separator = match ($l_str_separator_option) {
$l_str_separator = match ($l_str_separator_option) {
'comma' => ',',
'semicolon' => ';',
'en_dash' => '&nbsp;&#x2013;',
@ -1740,7 +1740,7 @@ class Parser {
// If it is not, check which option is on.
$l_str_terminator_option = Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_BACKLINKS_TERMINATOR_OPTION );
$l_str_terminator = match ($l_str_terminator_option) {
$l_str_terminator = match ($l_str_terminator_option) {
'period' => '.',
'parenthesis' => ')',
'colon' => ':',