Skip to content

Commit 748ad67

Browse files
authored
Fix get_object_vars() return type
1 parent e0687d0 commit 748ad67

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@
27762776
'get_magic_quotes_gpc' => ['false'],
27772777
'get_magic_quotes_runtime' => ['false'],
27782778
'get_meta_tags' => ['array|false', 'filename'=>'string', 'use_include_path='=>'bool'],
2779-
'get_object_vars' => ['array<string, mixed>', 'obj'=>'object'],
2779+
'get_object_vars' => ['array<array-key, mixed>', 'obj'=>'object'],
27802780
'get_parent_class' => ['class-string|false', 'object='=>'mixed'],
27812781
'get_required_files' => ['list<string>'],
27822782
'get_resource_type' => ['string', 'res'=>'resource'],
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace GetObjectVars;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
/**
8+
* @param object{1: mixed} $object
9+
*/
10+
function getObjectVarsWithIntKeyTest(object $object): void
11+
{
12+
assertType('array<mixed>', get_object_vars($object));
13+
assertType('array<mixed>', get_object_vars(json_decode('{"1": "test"}')));
14+
}

0 commit comments

Comments
 (0)