A custom CodeSniffer check is not executed

I have a custom sniffer in ./src/StaticFunctionSniff.php file:

<?php

declare(strict_types=1);

namespace App;

use PHP_CodeSnifferFilesFile;
use PHP_CodeSnifferSniffsSniff;

class StaticFunctionSniff implements Sniff
{
    protected $warningMessage = 'Static method cannot be intercepted and its use is discouraged.';

    protected $warningCode = 'StaticFunction';

    public function register()
    {
        return [T_STATIC];
    }

    public function process(File $phpcsFile, $stackPtr)
    {
        $posOfFunction = $phpcsFile->findNext(T_FUNCTION, $stackPtr) + 1;
        $tokens = array_slice($phpcsFile->getTokens(), $stackPtr, $posOfFunction - $stackPtr);

        $allowedTypes = [T_STATIC => true, T_WHITESPACE => true, T_FUNCTION => true];
        foreach ($tokens as $token) {
            $code = $token['code'];
            if (!array_key_exists($code, $allowedTypes)) {
                break;
            }

            if ($code === T_FUNCTION) {
                $phpcsFile->addError($this->warningMessage, $posOfFunction, $this->warningCode);
            }
        }
    }
}

I linked my rules.xml file to it:

<?xml version="1.0"?>
<ruleset name="project">
    <rule ref="PSR12" />

    <config name="installed_paths" value="vendor/slevomat/coding-standard"/>

    ...
    <rule ref="src/StaticFunctionSniff.php" />

    <file>src</file>
    <file>tests</file>
</ruleset>

As far as I see CodeSniffer doesn’t use it at all. Why does CS skip it?