Skip to content

Getting function attributes from $scope #12510

Closed Answered by ondrejmirtes
spaze asked this question in Support
Discussion options

You must be logged in to vote

Wouldn't it be nice 🎵 to have easy access to attributes ON EVERYTHING!? Well, I just spent a few hours today on that 😊 phpstan/phpstan-src@a387fa3

You can now call ->getAttributes() on any thinkable reflection object, including $scope->getFunction() and you'll get a new PHPStan's AttributeReflection class: https://apiref.phpstan.org/2.1.x/PHPStan.Reflection.AttributeReflection.html

I'm going to release it in a few days, but you can already require "phpstan/phpstan": "^2.1.3" (alongside minimum-stability: dev and prefer-stable: true) and take advantage of it!

I welcome any feedback about it.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by spaze
Comment options

You must be logged in to vote
1 reply
@ondrejmirtes
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants