Skip to content
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

Set AllowDynamicProperties on TypedElement and UnaddressableTypedElement #4804

Closed
wants to merge 1 commit into from

Conversation

Krinkle
Copy link

@Krinkle Krinkle commented Sep 23, 2023

Fixes #4776.

@Daimona
Copy link
Member

Daimona commented Oct 4, 2023

This won't work in PHP 8.0 and 8.1, which are recent enough to support attributes, but old enough that they don't have the AllowDynamicProperties attribute. Easiest thing would be to create a stub for the AllowDynamicProperties attribute class that would only be loaded in those PHP versions. I believe .phan/stubs would be the right place for it, but I'm not familiar with the configuration used for phan's own tests.

@Daimona
Copy link
Member

Daimona commented Oct 16, 2023

Also, just because I had second thoughts: the AllowDynamicProperties class shim does not need to be exported for use outside of phan's CI. PHP does not require that the classes used in attributes actually exist, and therefore the attribute itself is a no-op in PHP < 8.2.

Aaaand also, .phan/stubs seems to be the correct location for this. You can copy the stub from MediaWiki's phan config, just make sure to move the documentation to an actual class doc comment or phan will complain.

@rlerdorf
Copy link
Collaborator

Merged manually with some tweaks

@rlerdorf rlerdorf closed this Oct 16, 2023
@Krinkle Krinkle deleted the plugin-dynamic-prop branch October 16, 2023 18:34
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.

PHP 8.2 support for plugins adding dynamic properties to phan classes
3 participants