Closed jrfnl closed 3 months ago
Rebased without changes. Setting to draft as this PR depends on https://github.com/PHPCSStandards/PHPCSUtils/pull/550, which has to be merged first.
Rebased without changes after the merge of PR #550.
Rebased without changes. Marking as ready as https://github.com/PHPCSStandards/PHPCSUtils/pull/550 has been merged now. Merging once the build passes.
Note: I've looked the sniff over to check if any of the new exceptions from PR #598 should be implemented and concluded that things should be fine as-is. In all methods, it is either handled gracefully already or a param will be passed to a PHP native function, which may throw a type error. I think that should be sufficient.
... with some utility functions for handling file paths.
The class initially contains the following utility methods:
getName(File $phpcsFile): string
- Retrieve the normalized file name for the current file.isStdin(File $phpcsFile): bool
- Check whether the current file under scan comes from STDIN.normalizeAbsolutePath(string $path): string
- Normalize an absolute path to forward slashes and to include a trailing slash for directories.normalizeDirectorySeparators(string $path): string
- Normalize all directory separators to be a forward slash.trailingSlashIt(string $path): string
- Ensure that a directory path ends on a trailing slash.startsWith(string $haystack, string $needle): bool
- Check whether one file/directory path starts with another path.Includes unit tests.