Skip to content

Conversation

@Triplkrypl
Copy link

I found in crash way, that get_object_vars can return array with int key.

https://onlinephp.io/c/9a628

@staabm
Copy link
Contributor

staabm commented Nov 28, 2025

Can numeric keys only occur for objects without a class?

If so it might make sense to use a return type extension instead which can narrow the type depending on the context.

edit: and I think you should target PHPStan 2.1.x

@Triplkrypl
Copy link
Author

Can numeric keys only occur for objects without a class?

Not exactly classes extending \stdClass or has #[\AllowDynamicProperties] attribute.
Fore the classes is this code valid and before deprecation is code valid for every object:

$obj = new \stdClass();
$obj->{1} = 42;

If anyone want make dynamic return type detection, condition only for class is not enough.
For now in PHP 8 every object can have only numeric property, it is only deprecation error:
https://onlinephp.io/c/9704f

and I think you should target PHPStan 2.1.x

I am not sure if you support fixes for function interfaces in phpstan version 1.

@VincentLanglet
Copy link
Contributor

I am not sure if you support fixes for function interfaces in phpstan version 1.

Is there a reason you still use version 1?

@Triplkrypl
Copy link
Author

I am not sure if you support fixes for function interfaces in phpstan version 1.

Is there a reason you still use version 1?

I not use version 1 what i know and not need it, but my question is. If you make fixes of PHP function interfaces in version 1, if not i will update pull request to version 2.

@staabm
Copy link
Contributor

staabm commented Dec 10, 2025

At this point in time 1.x only sees critical fixes.

Everything else goes into 2.1.x right now

@Triplkrypl
Copy link
Author

#4629

@Triplkrypl Triplkrypl closed this Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants