Skip to content

Commit 11dd32e

Browse files
phpstan-botclaude
andcommitted
Add named argument tests for PDOStatement::fetchAll()
The `mode:` named argument works correctly with the multi-variant overloads. Note that `column:` and `class:` cannot be used as named arguments because PDOStatement::fetchAll is an internal function with variadic `...$args` — PHP does not accept arbitrary named parameters for variadic params on internal functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0c96c32 commit 11dd32e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/PHPStan/Rules/Methods/data/bug-5509.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,10 @@ public function test(\PDOStatement $stmt): void
2525

2626
// With just mode - should not error
2727
$stmt->fetchAll(\PDO::FETCH_ASSOC);
28+
29+
// Named arguments
30+
$stmt->fetchAll(mode: \PDO::FETCH_DEFAULT);
31+
$stmt->fetchAll(mode: \PDO::FETCH_COLUMN);
32+
$stmt->fetchAll(mode: \PDO::FETCH_CLASS);
2833
}
2934
}

0 commit comments

Comments
 (0)