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

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

View file

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

View file

@ -54,7 +54,7 @@ class Core {
* *
* @var Loader $loader Maintains and registers all hooks for the plugin. * @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 * The unique identifier of this plugin

View file

@ -40,7 +40,7 @@ class i18n {
load_plugin_textdomain( load_plugin_textdomain(
'footnotes', 'footnotes',
false, 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. * Stores a singleton reference of this class.
* *
*
* @since 1.5.0 * @since 1.5.0
*/ */
private static ?\footnotes\includes\Settings $a_obj_instance = null; private static ?\footnotes\includes\Settings $a_obj_instance = null;
@ -1344,7 +1343,6 @@ class Settings {
/** /**
* Returns a singleton of this class. * Returns a singleton of this class.
* *
*
* @since 1.5.0 * @since 1.5.0
* @todo Remove? * @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' ) { 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. // No template file type and/or file name set.
if (empty( $p_str_file_type )) { if ( empty( $p_str_file_type ) ) {
return; return;
} }
if (empty( $p_str_file_name )) { if ( empty( $p_str_file_name ) ) {
return; return;
} }
$this->plugin_directory = plugin_dir_path( __DIR__ ); $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 ) ) ) { if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ) ) ) {
add_filter( add_filter(
'the_title', '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 $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 ) ) ) { if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( \footnotes\includes\Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ) ) ) {
add_filter( add_filter(
'the_content', '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 $l_int_the_content_priority
); );
@ -329,7 +329,7 @@ class Parser {
*/ */
add_filter( add_filter(
'term_description', '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 $l_int_the_content_priority
); );
@ -345,7 +345,7 @@ class Parser {
*/ */
add_filter( add_filter(
'pum_popup_content', '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 $l_int_the_content_priority
); );
} }
@ -361,7 +361,7 @@ class Parser {
*/ */
add_filter( add_filter(
'the_excerpt', '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 $l_int_the_excerpt_priority
); );
} }
@ -372,7 +372,7 @@ class Parser {
*/ */
add_filter( add_filter(
'widget_title', '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 $l_int_widget_title_priority
); );
} }
@ -383,7 +383,7 @@ class Parser {
*/ */
add_filter( add_filter(
'widget_text', '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 $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_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 ); $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 // phpcs:disable WordPress.PHP.YodaConditions.NotYoda
// Appends the reference container if set to "post_end". // Appends the reference container if set to "post_end".