@@ -987,10 +987,13 @@ private static function migrate_install_plan_to_plan_id( FS_Storage $storage, $b
987987 $module_type = $storage->get_module_type();
988988 $module_slug = $storage->get_module_slug();
989989
990+ /**
991+ * @var FS_Site[] $installs
992+ */
990993 $installs = self::get_all_sites( $module_type, $blog_id );
991994 $install = isset( $installs[ $module_slug ] ) ? $installs[ $module_slug ] : null;
992995
993- if ( ! is_object ( $install ) ) {
996+ if ( is_null ( $install ) ) {
994997 return;
995998 }
996999
@@ -1872,7 +1875,6 @@ private function unregister_uninstall_hook() {
18721875 */
18731876 private function clear_module_main_file_cache( $store_prev_path = true ) {
18741877 if ( ! isset( $this->_storage->plugin_main_file ) ||
1875- ! is_object( $this->_storage->plugin_main_file ) ||
18761878 empty( $this->_storage->plugin_main_file->path )
18771879 ) {
18781880 return;
@@ -1889,6 +1891,9 @@ private function clear_module_main_file_cache( $store_prev_path = true ) {
18891891 */
18901892 unset( $this->_storage->plugin_main_file->path );
18911893 } else {
1894+ /**
1895+ * @var stdClass $plugin_main_file
1896+ */
18921897 $plugin_main_file = clone $this->_storage->plugin_main_file;
18931898
18941899 // Store cached path (2nd layer cache).
@@ -17141,12 +17146,14 @@ function opt_in(
1714117146 * @link https://themes.trac.wordpress.org/ticket/46134#comment:9
1714217147 * @link https://themes.trac.wordpress.org/ticket/46134#comment:12
1714317148 * @link https://themes.trac.wordpress.org/ticket/46134#comment:14
17149+ *
17150+ * @var stdClass $decoded The decoded object is expected to be UserPlugin entity, but since we do not have this Entity in the SDK, we made this a StdClass
1714417151 */
1714517152 $decoded = is_string( $response['body'] ) ?
1714617153 json_decode( $response['body'] ) :
1714717154 null;
1714817155
17149- if ( empty( $decoded ) && ! is_object( $decoded ) ) {
17156+ if ( ! is_object( $decoded ) ) {
1715017157 return false;
1715117158 }
1715217159
@@ -19634,9 +19641,9 @@ private function _store_site( $store = true, $network_level_or_blog_id = null, F
1963419641 $site = $this->_site;
1963519642 }
1963619643
19637- if ( ! is_object( $site ) || empty( $site->id ) ) {
19644+ // @phpstan-ignore-next-line Variable $site in isset() always exists and is not nullable
19645+ if ( !isset( $site ) || !is_object( $site ) || empty( $site->id ) ) {
1963819646 $this->_logger->error( "Empty install ID, can't store site." );
19639-
1964019647 return;
1964119648 }
1964219649
@@ -20083,7 +20090,11 @@ private function _handle_account_user_sync() {
2008320090
2008420091 $api = $this->get_api_user_scope();
2008520092
20086- // Get user's information.
20093+ /**
20094+ * Get user's information.
20095+ *
20096+ * @var FS_User $user
20097+ */
2008720098 $user = $api->get( '/', true );
2008820099
2008920100 if ( isset( $user->id ) ) {
@@ -21012,7 +21023,7 @@ private function _sync_plugin_license(
2101221023
2101321024 // Find the current context install.
2101421025 $site = null;
21015- if ( is_array( $result ) ) {
21026+ if ( is_object( $result ) && is_array( $result->installs ) ) {
2101621027 foreach ( $result->installs as $install ) {
2101721028 if ( $install->id == $this->_site->id ) {
2101821029 $site = new FS_Site( $install );
@@ -22442,7 +22453,7 @@ private function init_change_owner( $candidate_email, $transfer_type ) {
2244222453 /**
2244322454 * Retrieves all module sites.
2244422455 *
22445- * @return array $all_sites Get all module sites.
22456+ * @return array $all_sites
2244622457 */
2244722458 public static function get_all_modules_sites() {
2244822459 $all_sites = [];
@@ -22585,8 +22596,8 @@ private function complete_change_owner() {
2258522596 * @author Leo Fajardo (@leorw)
2258622597 * @since 2.3.2
2258722598 *
22588- * @param number $user_id
22589- * @param string[]| int[] $install_ids_by_slug_map
22599+ * @param number $user_id
22600+ * @param array< string, int> $install_ids_by_slug_map
2259022601 *
2259122602 */
2259222603 private function complete_ownership_change_by_license( $user_id, $install_ids_by_slug_map ) {
0 commit comments