Skip to content

Commit b6ddb08

Browse files
authored
Merge pull request #154 from voku/copilot/add-index-of-min-max-element
Document callable index lookup for min/max values with focused regression coverage
2 parents 38ab634 + 3982e2f commit b6ddb08

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ This reads `src/Arrayy.php` docblocks and `build/docs/base.md`, then writes `REA
7979

8080
---
8181

82+
## Findings from Task: README regeneration
83+
84+
- Rebuild the README with `php build/generate_docs.php`
85+
- That script requires both:
86+
- `vendor/autoload.php`
87+
- `build/vendor/autoload.php`
88+
- On this branch, rerunning the generator completed successfully and did not change `README.md`
89+
- `AGENTS.md` is manually maintained and should be updated separately after README regeneration when task-specific context needs to be preserved
90+
91+
---
92+
8293
## Adding New Methods
8394

8495
All public methods in `src/Arrayy.php` follow this pattern:

tests/ArrayyTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,6 +3281,27 @@ public function testFindKeyWithKeyParameter()
32813281
static::assertFalse($arrayy->findKey($closureNoMatch));
32823282
}
32833283

3284+
public function testFindKeyForMinAndMaxValues()
3285+
{
3286+
$arrayy = A::create([
3287+
3 => 10,
3288+
4 => -5,
3289+
8 => 99,
3290+
9 => -5,
3291+
10 => 99,
3292+
]);
3293+
3294+
$min = $arrayy->min();
3295+
$max = $arrayy->max();
3296+
3297+
static::assertSame(4, $arrayy->findKey(static function ($value) use ($min) {
3298+
return $value === $min;
3299+
}));
3300+
static::assertSame(8, $arrayy->findKey(static function ($value) use ($max) {
3301+
return $value === $max;
3302+
}));
3303+
}
3304+
32843305
/**
32853306
* @dataProvider firstProvider()
32863307
*

0 commit comments

Comments
 (0)