PHP Class SlevomatCodingStandard\Helpers\NamespaceHelper

"Canonical" is a fully qualified name without the leading backslash.
Show file Open project: slevomat/coding-standard Class Usage Examples

Public Methods

Method Description
findCurrentNamespaceName ( PHP_CodeSniffer_File $phpcsFile, integer $anyPointer ) : string | null
getNameParts ( string $name ) : string[]
getUnqualifiedNameFromFullyQualifiedName ( string $name ) : string
hasNamespace ( string $typeName ) : boolean
isFullyQualifiedName ( string $typeName ) : boolean
isQualifiedName ( string $name ) : boolean
isTypeInNamespace ( string $typeName, string $namespace ) : boolean
normalizeToCanonicalName ( string $fullyQualifiedName ) : string

Method Details

findCurrentNamespaceName() public static method

public static findCurrentNamespaceName ( PHP_CodeSniffer_File $phpcsFile, integer $anyPointer ) : string | null
$phpcsFile PHP_CodeSniffer_File
$anyPointer integer any pointer type where the search begins from (backwards)
return string | null

getNameParts() public static method

public static getNameParts ( string $name ) : string[]
$name string
return string[]

getUnqualifiedNameFromFullyQualifiedName() public static method

public static getUnqualifiedNameFromFullyQualifiedName ( string $name ) : string
$name string
return string

hasNamespace() public static method

public static hasNamespace ( string $typeName ) : boolean
$typeName string
return boolean

isFullyQualifiedName() public static method

public static isFullyQualifiedName ( string $typeName ) : boolean
$typeName string
return boolean

isQualifiedName() public static method

public static isQualifiedName ( string $name ) : boolean
$name string
return boolean

isTypeInNamespace() public static method

public static isTypeInNamespace ( string $typeName, string $namespace ) : boolean
$typeName string
$namespace string
return boolean

normalizeToCanonicalName() public static method

public static normalizeToCanonicalName ( string $fullyQualifiedName ) : string
$fullyQualifiedName string
return string