Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to test a RestrictedClassNameUsageExtension? #13441

Unanswered
ruudk asked this question in Support
Discussion options

I'm working on a Restricted Usage Extension for class names, methods and properties and wonder what the best way would be to test them.

I've read but it does not explicitly answer it for this type of extension: https://phpstan.org/developing-extensions/testing

Since it's about errors, I kind of feel this should be a Rule test case... not the TypeInferenceTestCase.

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Yeah, sure. Find an existing rule that asks about this and write a new RuleTestCase and return the existing rule by doing self::getContainer()->getByType().

I'm on a phone, you should be able to find it by checking where are the extensions of this type gathered and called.

You must be logged in to vote
1 reply
Comment options

And register the extensions in a .neon file you'll return from getAdditionalConfigFiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /