← All changes
|
modules/tiled-gallery/math/class-constrained-array-rounding.php
+4
-10
12.2.3
→
16.3-a.1
View file →
| @@ -68,9 +68,9 @@ | ||
| 68 | 68 | * @param array $bound_array_int - the array we're adjusting. |
| 69 | 69 | * @param int $adjustment - how much we're adjusting the array. |
| 70 | 70 | */ |
| 71 | 71 | private static function adjust_constrained_array( &$bound_array_int, $adjustment ) { |
| 72 | - usort( $bound_array_int, array( 'self', 'cmp_desc_fraction' ) ); | |
| 72 | + usort( $bound_array_int, array( self::class, 'cmp_desc_fraction' ) ); | |
| 73 | 73 | |
| 74 | 74 | $start = 0; |
| 75 | 75 | $end = $adjustment - 1; |
| 76 | 76 | $length = count( $bound_array_int ); |
| @@ -78,9 +78,9 @@ | ||
| 78 | 78 | for ( $i = $start; $i <= $end; $i++ ) { |
| 79 | 79 | ++$bound_array_int[ $i % $length ]['floor']; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - usort( $bound_array_int, array( 'self', 'cmp_asc_index' ) ); | |
| 82 | + usort( $bound_array_int, array( self::class, 'cmp_asc_index' ) ); | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Compare fraction values of two arrays. |
| @@ -90,12 +90,9 @@ | ||
| 90 | 90 | * |
| 91 | 91 | * @return int |
| 92 | 92 | */ |
| 93 | 93 | private static function cmp_desc_fraction( $a, $b ) { |
| 94 | - if ( $a['fraction'] === $b['fraction'] ) { | |
| 95 | - return 0; | |
| 96 | - } | |
| 97 | - return $a['fraction'] > $b['fraction'] ? -1 : 1; | |
| 94 | + return $b['fraction'] <=> $a['fraction']; | |
| 98 | 95 | } |
| 99 | 96 | |
| 100 | 97 | /** |
| 101 | 98 | * Compare index values of two arrays. |
| @@ -105,10 +102,7 @@ | ||
| 105 | 102 | * |
| 106 | 103 | * @return int |
| 107 | 104 | */ |
| 108 | 105 | private static function cmp_asc_index( $a, $b ) { |
| 109 | - if ( $a['index'] === $b['index'] ) { | |
| 110 | - return 0; | |
| 111 | - } | |
| 112 | - return $a['index'] < $b['index'] ? -1 : 1; | |
| 106 | + return $a['index'] <=> $b['index']; | |
| 113 | 107 | } |
| 114 | 108 | } |