diff --git a/includes/class-site-health-test-wordpress-translations-locale.php b/includes/class-site-health-test-wordpress-translations-locale.php index c1c1c59..8453346 100644 --- a/includes/class-site-health-test-wordpress-translations-locale.php +++ b/includes/class-site-health-test-wordpress-translations-locale.php @@ -98,7 +98,7 @@ public function run_test() { $formatted_name = Options_General::locale_name_format( $locale ); // Check if Language Packs exist for the Locale and if the Language Pack major version is the same as the WordPress installed major version. - if ( $locale->has_translations() && isset( $locale_translations_version ) && $translation_project_version === $locale_translations_version ) { + if ( $locale->has_translations() && $translation_project_version === $locale_translations_version ) { $this->test_status = self::TRANSLATION_TOOLS_SITE_HEALTH_STATUS_GOOD; $this->test_label = sprintf( diff --git a/includes/class-update-translations.php b/includes/class-update-translations.php index 8d23789..41935f3 100644 --- a/includes/class-update-translations.php +++ b/includes/class-update-translations.php @@ -108,6 +108,8 @@ public function update_translation( $type, $project, $wp_locale, $generate_po_mo $generate_po = $this->generate_po( $destination, $project, $locale, $download['data'] ); array_push( $result['log'], $generate_po['log'] ); $result['data'] = $generate_po['data']; + /** @var array{log: array, data: true|WP_Error} $result Results. */ + \PHPStan\dumpType( $result['data'] ); if ( is_wp_error( $result['data'] ) ) { return $result; } @@ -305,7 +307,7 @@ public function download_translations( $type, $project, $locale ) { * @param Locale $locale Locale object. * @param array $response HTTP response. * - * @return array|WP_Error Array on success, WP_Error on failure. + * @return array{log:string, data:true}|array{data:WP_Error} Array on success, WP_Error on failure. */ public function generate_po( $destination, $project, $locale, $response ) { diff --git a/phpstan.neon b/phpstan.neon index 1293f5a..e134a4f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -15,4 +15,3 @@ parameters: - assets/lib/locales/locales.php # TODO Tell PHPStan what is inside arrays. checkMissingIterableValueType: false - treatPhpDocTypesAsCertain: false