Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 870a523

Browse files
committedAug 2, 2024·
Minor improvement
1 parent 06c82ac commit 870a523

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5211,7 +5211,7 @@ Map::from( [['p' => 30], ['p' => 50], ['p' => 10]] )->sum( 'p' );
52115211
Map::from( [['i' => ['p' => 30]], ['i' => ['p' => 50]]] )->sum( 'i/p' );
52125212
// 80
52135213

5214-
Map::from( [30, 50, 10] )->sum( fn( $val, $key ) => $val < 50 ? $val : 0 );
5214+
Map::from( [30, 50, 10] )->sum( fn( $val, $key ) => $val < 50 );
52155215
// 40
52165216
```
52175217

‎tests/MapTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,8 +3122,8 @@ public function testSum()
31223122

31233123
public function testSumClosure()
31243124
{
3125-
$this->assertSame( 40.0, Map::from( [30, 50, 10] )->sum( function( $val ) { return $val < 50 ? $val : 0; } ) );
3126-
$this->assertSame( 60.0, Map::from( [30, 50, 10] )->sum( function( $val, $key ) { return $key > 0 ? $val : 0; } ) );
3125+
$this->assertSame( 40.0, Map::from( [30, 50, 10] )->sum( function( $val ) { return $val < 50; } ) );
3126+
$this->assertSame( 60.0, Map::from( [30, 50, 10] )->sum( function( $val, $key ) { return $key > 0; } ) );
31273127
}
31283128

31293129

0 commit comments

Comments
 (0)
Please sign in to comment.