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
30 changes: 28 additions & 2 deletions inc/apis/trait-wp-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,16 @@ protected function get_wp_cli_label(): string {
}

/**
* Registers the routes. Should be called by the entity
* to actually enable the REST API.
* Schedules WP-CLI command registration.
*
* Called synchronously from each manager's `init()` method. The actual
* command registration — which calls `__()` for translatable shortdescs —
* is deferred to the `init` action so WordPress 6.7+ does not emit a
* `_load_textdomain_just_in_time` `_doing_it_wrong` notice. WP-CLI
* registers commands during its own bootstrap phase before `init` fires;
* hooking the registration to `init` priority 0 keeps the commands
* available for every WP-CLI invocation while satisfying WP 6.7's
* "translate after init" rule.
*
* @since 2.0.0
*/
Expand All @@ -67,6 +75,24 @@ public function enable_wp_cli(): void {
return;
}

add_action('init', [$this, 'register_wp_cli_commands'], 0);
}

/**
* Registers the WP-CLI commands for this entity.
*
* Hooked to `init` priority 0 by `enable_wp_cli()` so translations are
* loaded before any `__()` call runs (see `enable_wp_cli()` docblock).
*
* @since 2.10.2
* @return void
*/
public function register_wp_cli_commands(): void {

if ( ! defined('WP_CLI')) {
return;
}

$wp_cli_root = 'wu';

static $root_registered = false;
Expand Down
25 changes: 20 additions & 5 deletions inc/integrations/providers/wpengine/class-wpengine-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,38 @@ class WPEngine_Integration extends Integration {
/**
* Constructor.
*
* Note: Translation calls (`__()`, `_e()`, etc.) are intentionally absent
* from this constructor because integration providers are instantiated on
* `plugins_loaded` priority 9 by the Integration_Registry — before the
* WordPress `init` action fires. WordPress 6.7+ emits a `_doing_it_wrong`
* notice for any translation triggered before `init`. The translatable
* description is returned lazily by `get_description()` so it only runs
* when the wizard or admin UI requests it (always after `init`).
*
* @since 2.5.0
*/
public function __construct() {

parent::__construct('wpengine', 'WP Engine');

$description = __('WP Engine drives your business forward faster with the first and only WordPress Digital Experience Platform. We offer the best WordPress hosting and developer experience on a proven, reliable architecture that delivers unparalleled speed, scalability, and security for your sites.', 'ultimate-multisite');

$description .= '<br><br><b>' . __('We recommend to enter in contact with WP Engine support to ask for a Wildcard domain if you are using a subdomain install.', 'ultimate-multisite') . '</b>';

$this->set_description($description);
$this->set_logo(function_exists('wu_get_asset') ? wu_get_asset('wpengine.svg', 'img/hosts') : '');
$this->set_tutorial_link('https://ultimatemultisite.com/docs/user-guide/host-integrations/wp-engine');
$this->set_constants([['WPE_API', 'WPE_APIKEY']]);
$this->set_supports(['no-instructions', 'no-config']);
}

/**
* {@inheritdoc}
*/
public function get_description(): string {

$description = __('WP Engine drives your business forward faster with the first and only WordPress Digital Experience Platform. We offer the best WordPress hosting and developer experience on a proven, reliable architecture that delivers unparalleled speed, scalability, and security for your sites.', 'ultimate-multisite');

$description .= '<br><br><b>' . __('We recommend to enter in contact with WP Engine support to ask for a Wildcard domain if you are using a subdomain install.', 'ultimate-multisite') . '</b>';

return $description;
}
Comment on lines +49 to +59
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Remove PHP return type declaration from public method.

The : string return type on line 52 violates the coding guideline for this directory. As per coding guidelines, public methods in inc/integrations/ must not use PHP return type declarations because external addons may extend these classes, and PHP will fatal if child classes don't match the parent's return type signature.

🔧 Proposed fix
 	/**
 	 * {`@inheritdoc`}
+	 *
+	 * `@return` string
 	 */
-	public function get_description(): string {
+	public function get_description() {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* {@inheritdoc}
*/
public function get_description(): string {
$description = __('WP Engine drives your business forward faster with the first and only WordPress Digital Experience Platform. We offer the best WordPress hosting and developer experience on a proven, reliable architecture that delivers unparalleled speed, scalability, and security for your sites.', 'ultimate-multisite');
$description .= '<br><br><b>' . __('We recommend to enter in contact with WP Engine support to ask for a Wildcard domain if you are using a subdomain install.', 'ultimate-multisite') . '</b>';
return $description;
}
/**
* {`@inheritdoc`}
*
* `@return` string
*/
public function get_description() {
$description = __('WP Engine drives your business forward faster with the first and only WordPress Digital Experience Platform. We offer the best WordPress hosting and developer experience on a proven, reliable architecture that delivers unparalleled speed, scalability, and security for your sites.', 'ultimate-multisite');
$description .= '<br><br><b>' . __('We recommend to enter in contact with WP Engine support to ask for a Wildcard domain if you are using a subdomain install.', 'ultimate-multisite') . '</b>';
return $description;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@inc/integrations/providers/wpengine/class-wpengine-integration.php` around
lines 49 - 59, The public method get_description in
class-wpengine-integration.php should not declare a PHP return type; remove the
": string" return type from the get_description method signature so the method
matches the coding guideline for inc/integrations/ and remains extensible by
addons that may override it.


/**
* {@inheritdoc}
*/
Expand Down
Loading