It is generally recommended to explicitly declare the visibility for methods.
Adding explicit visibility (private, protected, or public) is generally
recommend to communicate to other developers how, and from where this method
is intended to be used.
Loading history...
6
$declaringClass = $prop->getDeclaringClass();
7
$propname = $prop->getName();
8
$classFile = new \SplFileObject($declaringClass->getFileName());
9
foreach ($classFile as $line => $content) {
10
if (preg_match(
11
'/
12
(private|protected|public|var|static) # match visibility or var
It seems like $content can also be of type array; however, parameter $subject of preg_match() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.