Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,16 @@ public function testBug9240(): void
$this->analyse([__DIR__ . '/data/bug-9240.php'], []);
}

public function testBug14758(): void
{
$this->analyse([__DIR__ . '/data/bug-14758.php'], [
[
'Offset decimal-int-string does not exist on array<string, string>.',
11,
],
]);
}

#[RequiresPhp('>= 8.4.0')]
public function testArrayFindKeyExisting(): void
{
Expand Down
23 changes: 23 additions & 0 deletions tests/PHPStan/Rules/Arrays/data/bug-14758.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Bug14758;

/**
* @param string $s
* @param array<string, string> $arr
*/
function doBarBug14758(string $s, $arr) {
if (ctype_digit($s)) {
var_dump($arr[$s]);
}
}

/**
* @param string $s
* @param array<int, string> $arr
*/
function doBarBug14758IntKeyed(string $s, $arr) {
if (ctype_digit($s)) {
var_dump($arr[$s]);
}
}
Loading