code: protected function applyFix(\SplFileInfo $file, Tokens $tokens)
      {
          $analyzer = new TokensAnalyzer($tokens);
  
          for ($index = $tokens->count() - 4; $index > 0; --$index) {
              if (!$tokens[$index]->isGivenKind(T_FUNCTION) || !$analyzer->isLambda($index)) {
                  continue;
              }
  
              $prev = $tokens->getPrevMeaningfulToken($index);
              if ($tokens[$prev]->isGivenKind(T_STATIC)) {
                  continue; // lambda is already 'static'
              }
  
              // figure out where the lambda starts ...
              $lambdaOpenIndex = $tokens->getNextTokenOfKind($index, ['{']);
  
              // ... and where it ends
              $lambdaEndIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $lambdaOpenIndex);
  
              if ($this->hasPossibleReferenceToThis($tokens, $lambdaOpenIndex, $lambdaEndIndex)) {
                  continue;
              }
  
              // make the lambda static
              $tokens->insertAt(
                  $index,
                  [
                      new Token([T_STATIC, 'static']),
                      new Token([T_WHITESPACE, ' ']),
                  ]
              );
  
              $index -= 4; // fixed after a lambda, closes candidate is at least 4 tokens before that
          }
      }
docs: {@inheritdoc}