Skip to content

Commit

Permalink
Don't pass unused params to closures.
Browse files Browse the repository at this point in the history
This throws a notice in later PHPCS scans.
  • Loading branch information
boonebgorges committed Jan 3, 2024
1 parent 314068d commit 8bbde40
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
28 changes: 14 additions & 14 deletions Core/API/StatsEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by year, use XXXX year notation.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -114,7 +114,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by month, use number of month.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -127,7 +127,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by day, use number of day.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -140,7 +140,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by year, use XXXX year notation.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -153,7 +153,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by month, use number of month.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -166,7 +166,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by month, use number of month.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand Down Expand Up @@ -196,7 +196,7 @@ public function register_routes() {
// Set the argument to be required for the endpoint.
'required' => true,
'default' => 1,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -209,7 +209,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by year, use XXXX year notation.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -222,7 +222,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by month, use number of month.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -235,7 +235,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by day, use number of day.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -248,7 +248,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by year, use XXXX year notation.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -261,7 +261,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by month, use number of month.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand All @@ -274,7 +274,7 @@ public function register_routes() {
'description' => esc_html__( 'Limit query by month, use number of month.', 'pressforward' ),
// Set the argument to be required for the endpoint.
'required' => false,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand Down Expand Up @@ -304,7 +304,7 @@ public function register_routes() {
// Set the argument to be required for the endpoint.
'required' => true,
'default' => 1,
'validate_callback' => function ( $page, $request_object ) {
'validate_callback' => function ( $page ) {
if ( is_numeric( $page ) ) {
return true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions Core/Bookmarklet/NominateThisCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ protected function detect_embeds( $body ) {
$doc->loadHTML( '<?xml encoding="UTF-8">' . $body );

$embed_providers = [
'#https?://(www.)?youtube\.com/(?:v|embed)/([^/\?]+)(.*)#i' => function ( $matches, $url ) {
'#https?://(www.)?youtube\.com/(?:v|embed)/([^/\?]+)(.*)#i' => function ( $matches ) {
$retval = sprintf( 'https://youtube.com/watch?v=%s', rawurlencode( $matches[2] ) );

// If any query parameters were present, we re-add them.
Expand All @@ -658,7 +658,7 @@ protected function detect_embeds( $body ) {
if ( preg_match( $regex, $iframe_src, $matches ) ) {
$embeds[] = [
'embedSrc' => $iframe_src,
'embedUrl' => $callback( $matches, $iframe_src ),
'embedUrl' => $callback( $matches ),
];
}
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Providers/AdminAreaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function ( $container ) {
);
$container->share(
'admin.edit_post',
function ( $container ) {
function () {
return new EditPost();
}
);
Expand Down
2 changes: 1 addition & 1 deletion Core/Providers/BlocksProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BlocksProvider extends \Intraxia\Jaxion\Assets\ServiceProvider {
public function register( Container $container ) {
$container->share(
'blocks',
function ( $container ) {
function () {
return new Blocks();
}
);
Expand Down
2 changes: 1 addition & 1 deletion Core/Providers/BookmarkletProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function register( Container $container ) {

$container->share(
'bookmarklet.core',
function ( $container ) {
function () {
return new NominateThisCore();
}
);
Expand Down
2 changes: 1 addition & 1 deletion Core/Providers/ControllerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function ( $container ) {

$container->share(
'controller.loops',
function ( $container ) {
function () {
return new PF_Loops();
}
);
Expand Down
10 changes: 5 additions & 5 deletions Core/Providers/LibrariesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ class LibrariesProvider extends \Intraxia\Jaxion\Assets\ServiceProvider {
public function register( Container $container ) {
$container->define(
'library.url_resolver',
function ( $container ) {
function () {
return new URLResolver();
}
);

$container->share(
'library.htmlchecker',
function ( $container ) {
function () {
return new HTMLChecker();
}
);

$container->share(
'library.opengraph',
function ( $container ) {
function () {
return new PFOpenGraph();
}
);

$container->define(
'library.readability',
function ( $container ) {
function () {
return ( function ( $html, $url = null, $parser = 'libxml', $logger = 'pf_log' ) {
if ( ! class_exists( '\Readability' ) ) {
require_once PF_ROOT . '/Libraries/FiveFiltersReadability/Readability.php';
Expand All @@ -60,7 +60,7 @@ function ( $container ) {

$container->share(
'library.alertbox',
function ( $container ) {
function () {
return The_Alert_Box::init();
}
);
Expand Down
4 changes: 2 additions & 2 deletions Core/Providers/ModelsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class ModelsProvider extends \Intraxia\Jaxion\Assets\ServiceProvider {
public function register( Container $container ) {
$container->define(
'model.feed_item',
function ( $container ) {
return ( function ( $item_url, $item_title, $post_type = false ) {
function () {
return ( function () {
return new Feed_Item();
} );
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Providers/ModulesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function register( Container $container ) {

$container->share(
'modules',
function ( $container ) {
function () {
return new Modules();
}
);
Expand Down
2 changes: 1 addition & 1 deletion Core/Providers/UtilityProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function ( $container ) {

$container->share(
'utility.retrieval',
function ( $container ) {
function () {
return new Retrieval();
}
);
Expand Down

0 comments on commit 8bbde40

Please sign in to comment.