Skip to content

Commit

Permalink
Better detection of OO methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-vlasenko authored and Anton Vlasenko committed Mar 27, 2024
1 parent fb928b6 commit 632b68b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ protected function process_function_token( File $phpcsFile, $stackPtr ) {
}
}

$class_token = $phpcsFile->getCondition( $stackPtr, T_CLASS, false );
$is_class_method = false !== $class_token;
$class_token = $phpcsFile->getCondition( $stackPtr, T_CLASS, false );
$is_oo_method = Scopes::isOOMethod( $phpcsFile, $stackPtr );

$function_name = $phpcsFile->getDeclarationName( $stackPtr );

if ( $is_class_method ) {
if ( $is_oo_method ) {
$scopeModifier = $phpcsFile->getMethodProperties($stackPtr)['scope'];
if (($scopeModifier === 'protected'
&& $this->minimumVisibility === 'public')
Expand All @@ -268,7 +268,7 @@ protected function process_function_token( File $phpcsFile, $stackPtr ) {
$missing_since_tag_error_message = sprintf(
'@since tag is missing for the "%s()" %s.',
$function_name,
$is_class_method ? 'method' : 'function'
$is_oo_method ? 'method' : 'function'
);

// All these tokens could be present before the docblock.
Expand Down Expand Up @@ -324,7 +324,7 @@ protected function process_function_token( File $phpcsFile, $stackPtr ) {
'InvalidSinceTagVersionValue',
array(
$function_name,
$is_class_method ? 'method' : 'function',
$is_oo_method ? 'method' : 'function',
$version_value,
)
);
Expand Down

0 comments on commit 632b68b

Please sign in to comment.