@@ -994,10 +994,13 @@ private static function migrate_install_plan_to_plan_id( FS_Storage $storage, $b
994994 $module_type = $storage->get_module_type();
995995 $module_slug = $storage->get_module_slug();
996996
997+ /**
998+ * @var FS_Site[] $installs
999+ */
9971000 $installs = self::get_all_sites( $module_type, $blog_id );
9981001 $install = isset( $installs[ $module_slug ] ) ? $installs[ $module_slug ] : null;
9991002
1000- if ( ! is_object ( $install ) ) {
1003+ if ( is_null ( $install ) ) {
10011004 return;
10021005 }
10031006
@@ -1865,7 +1868,6 @@ private function unregister_uninstall_hook() {
18651868 */
18661869 private function clear_module_main_file_cache( $store_prev_path = true ) {
18671870 if ( ! isset( $this->_storage->plugin_main_file ) ||
1868- ! is_object( $this->_storage->plugin_main_file ) ||
18691871 empty( $this->_storage->plugin_main_file->path )
18701872 ) {
18711873 return;
@@ -1882,6 +1884,9 @@ private function clear_module_main_file_cache( $store_prev_path = true ) {
18821884 */
18831885 unset( $this->_storage->plugin_main_file->path );
18841886 } else {
1887+ /**
1888+ * @var stdClass $plugin_main_file
1889+ */
18851890 $plugin_main_file = clone $this->_storage->plugin_main_file;
18861891
18871892 // Store cached path (2nd layer cache).
@@ -17130,12 +17135,14 @@ function opt_in(
1713017135 * @link https://themes.trac.wordpress.org/ticket/46134#comment:9
1713117136 * @link https://themes.trac.wordpress.org/ticket/46134#comment:12
1713217137 * @link https://themes.trac.wordpress.org/ticket/46134#comment:14
17138+ *
17139+ * @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
1713317140 */
1713417141 $decoded = is_string( $response['body'] ) ?
1713517142 json_decode( $response['body'] ) :
1713617143 null;
1713717144
17138- if ( empty( $decoded ) && ! is_object( $decoded ) ) {
17145+ if ( ! is_object( $decoded ) ) {
1713917146 return false;
1714017147 }
1714117148
@@ -19595,9 +19602,9 @@ private function _store_site( $store = true, $network_level_or_blog_id = null, F
1959519602 $site = $this->_site;
1959619603 }
1959719604
19598- if ( ! is_object( $site ) || empty( $site->id ) ) {
19605+ // @phpstan-ignore-next-line Variable $site in isset() always exists and is not nullable
19606+ if ( !isset( $site ) || !is_object( $site ) || empty( $site->id ) ) {
1959919607 $this->_logger->error( "Empty install ID, can't store site." );
19600-
1960119608 return;
1960219609 }
1960319610
@@ -20044,7 +20051,11 @@ private function _handle_account_user_sync() {
2004420051
2004520052 $api = $this->get_api_user_scope();
2004620053
20047- // Get user's information.
20054+ /**
20055+ * Get user's information.
20056+ *
20057+ * @var FS_User $user
20058+ */
2004820059 $user = $api->get( '/', true );
2004920060
2005020061 if ( isset( $user->id ) ) {
@@ -20973,7 +20984,7 @@ private function _sync_plugin_license(
2097320984
2097420985 // Find the current context install.
2097520986 $site = null;
20976- if ( is_array( $result ) ) {
20987+ if ( is_object( $result ) && is_array( $result->installs ) ) {
2097720988 foreach ( $result->installs as $install ) {
2097820989 if ( $install->id == $this->_site->id ) {
2097920990 $site = new FS_Site( $install );
@@ -22382,7 +22393,7 @@ private function init_change_owner( $candidate_email, $transfer_type ) {
2238222393 /**
2238322394 * Retrieves all module sites.
2238422395 *
22385- * @return array $all_sites Get all module sites.
22396+ * @return array $all_sites
2238622397 */
2238722398 public static function get_all_modules_sites() {
2238822399 $all_sites = [];
@@ -22525,8 +22536,8 @@ private function complete_change_owner() {
2252522536 * @author Leo Fajardo (@leorw)
2252622537 * @since 2.3.2
2252722538 *
22528- * @param number $user_id
22529- * @param string[]| int[] $install_ids_by_slug_map
22539+ * @param number $user_id
22540+ * @param array< string, int> $install_ids_by_slug_map
2253022541 *
2253122542 */
2253222543 private function complete_ownership_change_by_license( $user_id, $install_ids_by_slug_map ) {
0 commit comments