Commit c509b86d authored by Klaus Purer's avatar Klaus Purer
Browse files

refactor(phpstan): Fix PHPStan reports for level 1 (#3104477)

parent a0659bfd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -435,6 +435,7 @@ class DocCommentSniff implements Sniff
        foreach ($tagGroups as $group) {
            $maxLength = 0;
            $paddings  = [];
            $pos       = 0;
            foreach ($group as $pos => $tag) {
                $tagLength = strlen($tokens[$tag]['content']);
                if ($tagLength > $maxLength) {
+3 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ class FunctionCommentSniff implements Sniff
        $methodName      = strtolower(ltrim($methodName, '_'));

        $return = null;
        $end    = $stackPtr;
        foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) {
            if ($tokens[$tag]['content'] === '@return') {
                if ($return !== null) {
@@ -718,6 +719,8 @@ class FunctionCommentSniff implements Sniff
                }
            }

            $suggestedName = '';
            $typeName      = '';
            if (count($typeNames) === 1) {
                $typeName      = $param['type'];
                $suggestedName = static::suggestType($typeName);
+2 −1
Original line number Diff line number Diff line
@@ -217,6 +217,7 @@ class InlineCommentSniff implements Sniff
        }//end while

        $commentText      = '';
        $lastCommentToken = $stackPtr;
        foreach ($commentTokens as $lastCommentToken) {
            $comment = rtrim($tokens[$lastCommentToken]['content']);

+5 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ class FunctionTriggerErrorSniff extends FunctionCall
            // quotes away and possibly not report a faulty message.
            $messageText = substr($tokens[$messagePosition]['content'], 1, ($tokens[$messagePosition]['length'] - 2));
        } else {
            $messageParts = [];
            // If not sprintf() then extract and store all the items except
            // whitespace, concatenation operators and comma. This will give all
            // real content such as concatenated strings and constants.
@@ -112,7 +113,10 @@ class FunctionTriggerErrorSniff extends FunctionCall
            $block         = $phpcsFile->findPrevious(T_DOC_COMMENT_OPEN_TAG, $argument['start']);
        }

        if (isset($block) === true && $tokens[$block]['level'] === $requiredLevel && isset($tokens[$block]['comment_tags']) === true) {
        if (isset($tokens[$block]['level']) === true
            && $tokens[$block]['level'] === $requiredLevel
            && isset($tokens[$block]['comment_tags']) === true
        ) {
            foreach ($tokens[$block]['comment_tags'] as $tag) {
                $strictStandard = $strictStandard || (strtolower($tokens[$tag]['content']) === '@deprecated');
            }
+2 −1
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ class ObjectOperatorIndentSniff implements Sniff

        // Check if the line before is in the same scope and go back if necessary.
        $scopeDiff   = [$previousLine => $previousLine];
        $startOfLine = $stackPtr;
        while (empty($scopeDiff) === false) {
            // Find the first non whitespace character on the previous line.
            $startOfLine      = $this->findStartOfline($phpcsFile, $previousLine);
Loading