Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try more strict phpstan.neon #463

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion includes/class-update-translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
$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. */

Check failure on line 111 in includes/class-update-translations.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Missing short description in doc comment
\PHPStan\dumpType( $result['data'] );

Check failure on line 112 in includes/class-update-translations.php

View workflow job for this annotation

GitHub Actions / Static Analysis (PHP 7.4)

Dumped type: WP_Error|true

Check failure on line 112 in includes/class-update-translations.php

View workflow job for this annotation

GitHub Actions / Static Analysis (PHP 8.0)

Dumped type: WP_Error|true

Check failure on line 112 in includes/class-update-translations.php

View workflow job for this annotation

GitHub Actions / Static Analysis (PHP 8.1)

Dumped type: WP_Error|true

Check failure on line 112 in includes/class-update-translations.php

View workflow job for this annotation

GitHub Actions / Static Analysis (PHP 8.2)

Dumped type: WP_Error|true

Check failure on line 112 in includes/class-update-translations.php

View workflow job for this annotation

GitHub Actions / Static Analysis (PHP 8.3)

Dumped type: WP_Error|true
if ( is_wp_error( $result['data'] ) ) {
return $result;
}
Expand Down Expand Up @@ -305,7 +307,7 @@
* @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 ) {

Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ parameters:
- assets/lib/locales/locales.php
# TODO Tell PHPStan what is inside arrays.
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
Loading