Skip to content

Commit c181fea

Browse files
Code Quality: Remove redundant array_values() call on IPTC keywords.
When IPTC keywords parsing was added to `wp_read_image_metadata()`, `array_values()` was called on `$iptc['2#025']`. In PHP, `iptcparse()` returns tag arrays as zero-indexed sequential lists, so calling `array_values()` on this list has no effect and surfaces an `arrayValues.list` error in PHPStan. This was the sole error suppressed in the `arrayValues.list` PHPStan baseline, so that baseline file is deleted along with its entry in `phpstan.neon.dist`. Developed in WordPress#13978. Follow-up to r34374. Props huzaifaalmesbah. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@64230 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 36e7c85 commit c181fea

3 files changed

Lines changed: 1 addition & 27 deletions

File tree

‎phpstan.neon.dist‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ includes:
2424
# phpstan:baselines start
2525
- tests/phpstan/baselines/argument.type.neon
2626
- tests/phpstan/baselines/argument.unresolvableType.neon
27-
- tests/phpstan/baselines/arrayValues.list.neon
2827
- tests/phpstan/baselines/assign.propertyType.neon
2928
- tests/phpstan/baselines/binaryOp.invalid.neon
3029
- tests/phpstan/baselines/booleanAnd.alwaysFalse.neon

‎src/wp-admin/includes/image.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ function wp_read_image_metadata( $file ) {
922922
}
923923

924924
if ( ! empty( $iptc['2#025'][0] ) ) { // Keywords array.
925-
$meta['keywords'] = array_values( $iptc['2#025'] );
925+
$meta['keywords'] = $iptc['2#025'];
926926
}
927927
}
928928
}

‎tests/phpstan/baselines/arrayValues.list.neon‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)