Skip to content

Update \SNMP class signatures #3927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2025
Merged

Conversation

miken32
Copy link
Contributor

@miken32 miken32 commented Apr 8, 2025

Per the documentation for SNMP::get():

If objectId is a string, then SNMP::get() will return SNMP object as string. If objectId is a array, all requested SNMP objects will be returned as associative array of the SNMP object ids and their values.

I updated the return types for SNMP::get() and SNMP::getnext() to reflect this. I also updated the arguments to use their canonical (camel case) names and corrected a mistake in the ordering of two arguments to SNMP::walk().

One change I wasn't sure about: can arguments can accept complex expressions like return types do? The documentation for SNMP::set() says:

If objectId is string, both type and value must be string too. If objectId is array, value must be equal-sized array containing corresponding values, type may be either string (it's value will be used for all objectId-value pairs) or equal-sized array with per-OID value.

So I adjusted the argument types to reflect this logic but am not sure if this is ok or not.

@ondrejmirtes ondrejmirtes merged commit f61439f into phpstan:2.1.x May 16, 2025
411 of 417 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@miken32 miken32 deleted the miken32-patch-1 branch May 26, 2025 17:14
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.

2 participants