FileInfo
in package
FinalYes
Utility functions to retrieve information about the file under scan.
Tags
Table of Contents
Properties
- $bomDefinitions : array<string, string>
- List of supported BOM definitions.
Methods
- hasByteOrderMark() : string|false
- Determine whether the file under scan has a byte-order mark at the start.
- hasSheBang() : bool
- Determine whether the file under scan has a shebang line at the start.
Properties
$bomDefinitions
List of supported BOM definitions.
private
static array<string, string>
$bomDefinitions
= ['UTF-8' => 'efbbbf', 'UTF-16 (BE)' => 'feff', 'UTF-16 (LE)' => 'fffe']
Use encoding names as keys and hex BOM representations as values.
Tags
Methods
hasByteOrderMark()
Determine whether the file under scan has a byte-order mark at the start.
public
static hasByteOrderMark(File $phpcsFile) : string|false
Inspired by similar code being used in a couple of PHPCS native sniffs.
Parameters
- $phpcsFile : File
-
The file being scanned.
Tags
Return values
string|false —Name of the type of BOM found or FALSE when the file does not start with a BOM.
hasSheBang()
Determine whether the file under scan has a shebang line at the start.
public
static hasSheBang(File $phpcsFile) : bool
Parameters
- $phpcsFile : File
-
The file being scanned.