$pathParts = pathinfo($phpcsFile->getFilename());

        // Search for an info file.
        $dir = $pathParts['dirname'];

This assumes that the $phpcsFile object has a filename to work with. This is not necessarily the case if you're running a string through a pipe to the phpcs command, or calling the PHPCS code directly with a string.

Comments

joachim created an issue.