Skip to content

[PropertyAccess] Improve PropertyAccessor::setValue param docs #60374

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 1 commit into from
May 9, 2025

Conversation

Qronicle
Copy link

@Qronicle Qronicle commented May 7, 2025

Q A
Branch? 7.2
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

This pull request was made to help static code analyzers understand that when calling PropertyAccessor::setValue, this will not change the type of the passed $objectOrArray.
At the moment static analysis will point out that the value of $objectOrArray can be any object or an array after calling the setValue method, which is of course not the case.

The solution comes directly from this closed PHPStan issue: phpstan/phpstan#12399
(Other tools like Psalm also support @param-out)

Added param-out for the $objectOrArray argument so static code analysis
does not assume the passed object can change type or become an array
@fabpot
Copy link
Member

fabpot commented May 9, 2025

Thank you @Qronicle.

@fabpot fabpot merged commit 31f0dd5 into symfony:7.2 May 9, 2025
7 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants