xarxaprod-wp-theme/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/CastStructureSpacingStandar...

24 lines
727 B
XML
Raw Normal View History

2024-01-09 16:13:20 +01:00
<documentation title="Cast Structure Spacing">
<standard>
<![CDATA[
A type cast should be preceded by whitespace.
There is only one exception to this rule: when the cast is preceded by the spread operator there should be no space between the spread operator and the cast.
]]>
</standard>
<code_comparison>
<code title="Valid: space before typecast.">
<![CDATA[
$a =<em> </em>(int) '420';
// No space between spread operator and cast.
$a = function_call( <em>...(array)</em> $mixed );
]]>
</code>
<code title="Invalid: no space before typecast.">
<![CDATA[
$a <em>=(</em>int) '420';
]]>
</code>
</code_comparison>
</documentation>