Vestavěná jména

Sekce builtin rozhoduje o zápisu toho, co patří PHP: klíčových slov, true, false a null, magických konstant jako __DIR__, tříd a funkcí, které PHP deklaruje, vestavěných typů a jmen přetypování.

PHP velikost písmen v klíčových slovech a jménech funkcí a tříd nerozlišuje, takže NULL, StrLen() i new datetime fungují. Čtou se ale hůř a každý projekt je píše trochu jinak. Klíče sekce sjednotí zápis na ten, který deklaruje PHP: strlen, DateTime, stdClass. Funkce vašeho projektu nebo rozšíření, které PHP nedodává, si svůj zápis nechá.

builtin:
	keywords: lowercase
	trueFalseNull: lowercase
	classes: declared
	functions: declared
	castTypes: short
$items = Array();  // The keyword `Array` must be written `array`.
if ($value === NULL) {  // The literal `NULL` must be written `null`.
	$date = new datetime();  // The class name `datetime` must be written `DateTime`.
	$length = StrLen($name);  // The function `StrLen()` must be written `strlen()`.
	$count = (integer) $count;  // The cast `(integer)` must be written `(int)`.
}
$items = array();
if ($value === null) {
	$date = new DateTime();
	$length = strlen($name);
	$count = (int) $count;
}

builtin.castTypes

The type name of a cast.

  • short: (int), (bool), (float) in lowercase, never (integer), (Boolean), (double)
  • keep: nic se nevynucuje, kód zůstane, jak je

Požadavek · standardy: perCs short, psr12 short, nette short, symfony short · pokrývá lowercase_cast, short_scalar_cast, Generic.PHP.LowerCaseType, PSR12.Keywords.ShortFormTypeKeywords, SlevomatCodingStandard.PHP.TypeCast, Squiz.WhiteSpace.CastSpacing

builtin.keywords

The case of keywords, self and parent included.

  • lowercase: if, function, self, parent
  • keep: nic se nevynucuje, kód zůstane, jak je

Požadavek · standardy: perCs lowercase, psr12 lowercase, nette lowercase, symfony lowercase · pokrývá constant_case, lowercase_keywords, lowercase_static_reference, magic_constant_casing, Generic.PHP.LowerCaseConstant, Generic.PHP.LowerCaseKeyword, Generic.PHP.LowerCaseType, PSR2.ControlStructures.SwitchDeclaration, Squiz.ControlStructures.ForEachLoopDeclaration, Squiz.ControlStructures.LowercaseDeclaration, Squiz.Functions.LowercaseFunctionKeywords

builtin.trueFalseNull

The case of true, false and null, a leading backslash staying.

  • lowercase: true, false, null
  • uppercase: TRUE, FALSE, NULL
  • keep: nic se nevynucuje, kód zůstane, jak je

Požadavek · standardy: perCs lowercase, psr12 lowercase, nette lowercase, symfony lowercase · pokrývá constant_case, lowercase_keywords, lowercase_static_reference, magic_constant_casing, Generic.PHP.LowerCaseConstant, Generic.PHP.LowerCaseKeyword, Generic.PHP.LowerCaseType, PSR2.ControlStructures.SwitchDeclaration, Squiz.ControlStructures.ForEachLoopDeclaration, Squiz.ControlStructures.LowercaseDeclaration, Squiz.Functions.LowercaseFunctionKeywords

builtin.magicConstants

The case of the magic constants such as __DIR__.

  • uppercase: __DIR__, __CLASS__
  • lowercase: __dir__, __class__
  • keep: nic se nevynucuje, kód zůstane, jak je

Požadavek · standardy: perCs keep, psr12 keep, nette uppercase, symfony uppercase · pokrývá constant_case, lowercase_keywords, lowercase_static_reference, magic_constant_casing, Generic.PHP.LowerCaseConstant, Generic.PHP.LowerCaseKeyword, Generic.PHP.LowerCaseType, PSR2.ControlStructures.SwitchDeclaration, Squiz.ControlStructures.ForEachLoopDeclaration, Squiz.ControlStructures.LowercaseDeclaration, Squiz.Functions.LowercaseFunctionKeywords

builtin.classes

The case of the classes, interfaces and enums of PHP and of the extensions shipped with it.

  • declared: stdClass, DateTime, never datetime
  • keep: nic se nevynucuje, kód zůstane, jak je

Požadavek · standardy: perCs keep, psr12 keep, nette declared, symfony declared · pokrývá class_reference_name_casing, native_function_casing, native_type_declaration_casing, Generic.PHP.LowerCaseType, Squiz.PHP.LowercasePHPFunctions

builtin.functions

The case of the functions of PHP, a global function of the project or of an extension PHP does not ship keeping its own.

  • declared: strlen, never StrLen
  • keep: nic se nevynucuje, kód zůstane, jak je

Požadavek · standardy: perCs keep, psr12 keep, nette declared, symfony declared · pokrývá class_reference_name_casing, native_function_casing, native_type_declaration_casing, Generic.PHP.LowerCaseType, Squiz.PHP.LowercasePHPFunctions

builtin.types

The case of the built-in types of a declaration; array, callable, static, self and parent are keywords.

  • lowercase: int, string, void
  • keep: nic se nevynucuje, kód zůstane, jak je

Požadavek · standardy: perCs lowercase, psr12 lowercase, nette lowercase, symfony lowercase · pokrývá class_reference_name_casing, native_function_casing, native_type_declaration_casing, Generic.PHP.LowerCaseType, Squiz.PHP.LowercasePHPFunctions