Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions _inc/lib/debugger/class-jetpack-cxn-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@

use Automattic\Jetpack\Connection\Client;
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Status;
use Automattic\Jetpack\Connection\Utils as Connection_Utils;
use Automattic\Jetpack\Sync\Modules;
use Automattic\Jetpack\Sync\Settings as Sync_Settings;
use Automattic\Jetpack\Sync\Health as Sync_Health;
use Automattic\Jetpack\Sync\Modules;
use Automattic\Jetpack\Sync\Sender as Sync_Sender;
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Sync\Settings as Sync_Settings;

/**
* Class Jetpack_Cxn_Tests contains all of the actual tests.
Expand Down
6 changes: 3 additions & 3 deletions _inc/lib/debugger/class-jetpack-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* @package jetpack
*/

use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Constants;
use Automattic\Jetpack\Sync\Modules;
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Sync\Functions;
use Automattic\Jetpack\Sync\Modules;
use Automattic\Jetpack\Sync\Sender;
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Connection\Manager as Connection_Manager;

/**
* Class Jetpack_Debug_Data
Expand Down
2 changes: 1 addition & 1 deletion _inc/lib/debugger/class-jetpack-debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @package jetpack
*/

use Automattic\Jetpack\Status;
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Status;

/**
* Class Jetpack_Debugger
Expand Down
2 changes: 1 addition & 1 deletion _inc/lib/debugger/debug-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function jetpack_debugger_site_status_tests( $core_tests ) {
* @type string $test Unique test identifier.
* }
*/
'test' => function() use ( $test, $cxn_tests ) {
'test' => function () use ( $test, $cxn_tests ) {
$results = $cxn_tests->run_test( $test['name'] );
if ( is_wp_error( $results ) ) {
return;
Expand Down
1 change: 0 additions & 1 deletion packages/abtest/src/class-abtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace Automattic\Jetpack;

use Automattic\Jetpack\Connection\Client;
use Automattic\Jetpack\Error;

/**
* This class provides an interface to the WP.com A/B tests.
Expand Down
7 changes: 3 additions & 4 deletions packages/abtest/tests/php/test-abtest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Tests the AB Test package.
*
Expand All @@ -7,10 +7,9 @@

namespace Automattic\Jetpack;

use Automattic\Jetpack\Abtest;
use PHPUnit\Framework\TestCase;
use phpmock\Mock;
use phpmock\MockBuilder;
use PHPUnit\Framework\TestCase;

/**
* Class Test_Abtest
Expand All @@ -30,7 +29,7 @@ public function setUp() {
$builder->setNamespace( __NAMESPACE__ )
->setName( 'is_wp_error' )
->setFunction(
function( $object ) {
function ( $object ) {
return is_a( $object, __NAMESPACE__ . '\\Error' );
}
);
Expand Down
2 changes: 1 addition & 1 deletion packages/assets/src/class-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function enqueue_async_script( $handle, $min_path, $non_min_path,
public static function add_resource_hint( $urls, $type = 'dns-prefetch' ) {
add_filter(
'wp_resource_hints',
function( $hints, $resource_type ) use ( $urls, $type ) {
function ( $hints, $resource_type ) use ( $urls, $type ) {
if ( $resource_type === $type ) {
// Type casting to array required since the function accepts a single string.
foreach ( (array) $urls as $url ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/assets/tests/php/test-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

namespace Automattic\Jetpack;

use PHPUnit\Framework\TestCase;
use Automattic\Jetpack\Constants as Jetpack_Constants;
use Brain\Monkey;
use Brain\Monkey\Filters;
use PHPUnit\Framework\TestCase;

/**
* Retrieves a URL within the plugins or mu-plugins directory.
Expand Down
2 changes: 0 additions & 2 deletions packages/autoloader/src/AutoloadProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace Automattic\Jetpack\Autoloader;

use Composer\Util\Filesystem;

/**
* Class AutoloadProcessor.
*/
Expand Down
5 changes: 2 additions & 3 deletions packages/autoloader/src/CustomAutoloaderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
namespace Automattic\Jetpack\Autoloader;

use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use Composer\Plugin\PluginInterface;
use Composer\EventDispatcher\EventSubscriberInterface;

/**
* Class CustomAutoloaderPlugin.
Expand Down Expand Up @@ -81,7 +81,6 @@ public function uninstall( Composer $composer, IOInterface $io ) {
*/
}


/**
* Tell composer to listen for events and do something with them.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/autoloader/src/autoload.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* HEADER */ // phpcs:ignore

require_once trailingslashit( dirname( __FILE__ ) ) . 'jetpack-autoloader/autoload_functions.php';
require_once trailingslashit( __DIR__ ) . 'jetpack-autoloader/autoload_functions.php';

set_up_autoloader();
2 changes: 1 addition & 1 deletion packages/autoloader/src/class-plugins-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private function get_plugins_activating_via_request() {
* @return string The path of the current plugin.
*/
public function get_current_plugin_path() {
$vendor_path = str_replace( '\\', '/', dirname( dirname( __FILE__ ) ) );
$vendor_path = str_replace( '\\', '/', dirname( __DIR__ ) );
// Path to the plugin's folder (the parent of the vendor/jetpack-autoloader folder).
return substr( $vendor_path, 0, strrpos( $vendor_path, '/' ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @package automattic/jetpack-autoloader
*/

use PHPUnit\Framework\TestCase;
use Automattic\Jetpack\Autoloader\AutoloadProcessor;
use PHPUnit\Framework\TestCase;

/**
* Test suite class for the Autoload processor.
Expand Down
2 changes: 1 addition & 1 deletion packages/autoloader/tests/php/tests/test_Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @package automattic/jetpack-autoloader
*/

use PHPUnit\Framework\TestCase;
use Jetpack\AutoloaderTestData\Plugin\Test;
use PHPUnit\Framework\TestCase;

/**
* Test suite class for the Autoloader.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @package automattic/jetpack-autoloader
*/

use PHPUnit\Framework\TestCase;
use Automattic\Jetpack\Autoloader\ManifestGenerator;
use PHPUnit\Framework\TestCase;

/**
* Test suite class for the manifest generator
Expand Down
4 changes: 2 additions & 2 deletions packages/autoloader/tests/php/tests/test_version_loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* @package automattic/jetpack-autoloader
*/

use PHPUnit\Framework\TestCase;
use \Jetpack\AutoloaderTestData\Plugin\Test;
use \Jetpack\AutoloaderTestData\Plugin\Psr4\Test as Psr4Test;
use \Jetpack\AutoloaderTestData\Plugin\Test;
use PHPUnit\Framework\TestCase;

/**
* Test suite class for the Autoloader part that handles file loading.
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/src/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function jetpack_register_block( $slug, $args = array() ) {

add_action(
'jetpack_register_gutenberg_extensions',
function() use ( $feature_name, $method_name ) {
function () use ( $feature_name, $method_name ) {
call_user_func( array( 'Jetpack_Gutenberg', $method_name ), $feature_name );
}
);
Expand Down
1 change: 0 additions & 1 deletion packages/blocks/tests/php/test-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Automattic\Jetpack;

use Automattic\Jetpack\Blocks;
use PHPUnit\Framework\TestCase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;

/**
* Sniffer that looks for JETPACK_MASTER_USER constant usage
Expand All @@ -19,7 +18,6 @@ public function register() {
return array( T_STRING );
}


/**
* Processes the tokens that this sniff is interested in.
*
Expand Down
1 change: 0 additions & 1 deletion packages/compat/legacy/class-jetpack-sync-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public static function is_network_setting( $setting ) {
return Settings::is_network_setting( $setting );
}


/**
* Return blocklisted post types SQL.
*
Expand Down
4 changes: 2 additions & 2 deletions packages/config/src/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* must require the corresponding packages to use these features.
*/
use Automattic\Jetpack\Connection\Manager;
use Automattic\Jetpack\JITMS\JITM as JITMS_JITM;
use Automattic\Jetpack\JITM as JITM;
use Automattic\Jetpack\Connection\Plugin;
use Automattic\Jetpack\JITM as JITM;
use Automattic\Jetpack\JITMS\JITM as JITMS_JITM;
use Automattic\Jetpack\Sync\Main as Sync_Main;

/**
Expand Down
1 change: 0 additions & 1 deletion packages/connection/legacy/class-jetpack-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Connection\Utils as Connection_Utils;
use Automattic\Jetpack\Roles;
use Automattic\Jetpack\Sync\Modules;
use Automattic\Jetpack\Sync\Functions;
use Automattic\Jetpack\Sync\Sender;

Expand Down
2 changes: 1 addition & 1 deletion packages/connection/src/class-error-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ private function garbage_collector( $errors ) {
// Clear empty error codes.
$errors = array_filter(
$errors,
function( $user_errors ) {
function ( $user_errors ) {
return ! empty( $user_errors );
}
);
Expand Down
4 changes: 2 additions & 2 deletions packages/connection/src/class-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
namespace Automattic\Jetpack\Connection;

use Automattic\Jetpack\Constants;
use Automattic\Jetpack\Heartbeat;
use Automattic\Jetpack\Roles;
use Automattic\Jetpack\Status;
use Automattic\Jetpack\Tracking;
use Jetpack_Options;
use WP_Error;
use WP_User;
use Automattic\Jetpack\Heartbeat;

/**
* The Jetpack Connection Manager class that is used as a single gateway between WordPress.com
Expand Down Expand Up @@ -1624,7 +1624,7 @@ public function verify_secrets( $action, $secret_1, $user_id ) {
*/
do_action( 'jetpack_verify_secrets_begin', $action, $user );

$return_error = function( \WP_Error $error ) use ( $action, $user ) {
$return_error = function ( \WP_Error $error ) use ( $action, $user ) {
/**
* Verifying of the previously generated secret has failed.
*
Expand Down
3 changes: 1 addition & 2 deletions packages/connection/src/class-rest-connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public static function connection_status( $rest_response = true ) {
}
}


/**
* Get plugins connected to the Jetpack.
*
Expand All @@ -193,7 +192,7 @@ public function get_connection_plugins() {

array_walk(
$plugins,
function( &$data, $slug ) {
function ( &$data, $slug ) {
$data['slug'] = $slug;
}
);
Expand Down
10 changes: 5 additions & 5 deletions packages/connection/tests/php/test-rest-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use Automattic\Jetpack\Constants;
use phpmock\MockBuilder;
use PHPUnit\Framework\TestCase;
use Requests_Utility_CaseInsensitiveDictionary;
use WorDBless\Options as WorDBless_Options;
use WP_REST_Request;
use WP_REST_Server;
use Requests_Utility_CaseInsensitiveDictionary;
use WP_User;

/**
Expand Down Expand Up @@ -111,12 +111,12 @@ public function test_remote_authorize() {
);

// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$options_filter = function( $value ) use ( $secrets ) {
$options_filter = function ( $value ) use ( $secrets ) {
return $secrets;
};
add_filter( 'pre_option_' . Manager::SECRETS_OPTION_NAME, $options_filter );

$user_caps_filter = function( $allcaps, $caps, $args, $user ) {
$user_caps_filter = function ( $allcaps, $caps, $args, $user ) {
if ( $user instanceof WP_User && self::USER_ID === $user->ID ) {
$allcaps['manage_options'] = true;
$allcaps['administrator'] = true;
Expand Down Expand Up @@ -154,7 +154,7 @@ public function test_connection() {
$builder->setNamespace( 'Automattic\Jetpack' )
->setName( 'apply_filters' )
->setFunction(
function( $hook, $value ) {
function ( $hook, $value ) {
return 'jetpack_offline_mode' === $hook ? true : $value;
}
);
Expand Down Expand Up @@ -192,7 +192,7 @@ public function test_connection_plugins() {

array_walk(
$plugins,
function( $plugin ) {
function ( $plugin ) {
( new Connection_Plugin( $plugin['slug'] ) )->add( $plugin['name'] );
}
);
Expand Down
Loading