How to stop this inspection: "Member has protected access, but class has magic method __get"?
Asked Answered
C

1

7

How to stop this inspection:

"Member has protected access, but class has magic method __get"?

enter image description here

I searched everywhere but can not find the option to disable this inspection.

I really do not want the properties remain marked with a different color when they are private and there is a magic method __get in classes.

Complicate answered 24/6, 2016 at 1:18 Comment(5)
I don't know if it's the same thing, but there's Editor > Colors & Fonts > PHP > Magic Member Access.Bezoar
I've had very good results asking JetBrains tech support.Bezoar
There's no way to disable this inspection.Aerodontia
Right now I may only suggest to declare such private/protected fileds that internally accessed via __get/__set via @property tag for that class. This way you tell IDE that this is not an error and you know what you are doing (you are declaring that such internal field (field declared as private/protected) can be accessed from outside). As for actual inspection -- I do not see how it can be suppressed (as I cannot even tell what inspection it is) .. which could mean that this warning is actually provided at lower Parser/Lexer level (and such notices cannot be suppressed)Electra
@Bezoar This option does not solve.Complicate
G
10

As @LazyOne mentioned the solution is: @property string $File in php doc.

Graff answered 5/3, 2019 at 14:45 Comment(2)
Update your answer, I deleted my!Complicate
I have a similar issue but with methods instead of properties. When I try this solution I get an error in the doc block saying "Method with same name already defined in this class". And this error is underlined red so it thinks it's a more serious issue. Not sure how I can solve that.Fess

© 2022 - 2024 — McMap. All rights reserved.