Php-cs-fixer: Add lowercase hints fixer

Created on 20 Feb 2018  路  7Comments  路  Source: FriendsOfPHP/PHP-CS-Fixer

-function foo(sTrIng $str): sTrIng {}
+function foo(string $str): string {}

-function foo(ITERABLE $arr): ITERABLE {}
+function foo(iterable $arr): iterable {}

-function foo(Int $num): Int {}
+function foo(int $num): int {}

-function foo(fLOAT $num): fLOAT {}
+function foo(float $num): float {}
kinfeature request

All 7 comments

Maybe in type castings as well:

-$foo = (sTrInG) $foo;
+$foo = (string) $foo;

Ah right, I searched in the Casing namespace only :)

Then I would deprecate this one in favor of the new one, which would cover both type hints and type castings, WDYT?

I'm ok: before spending time on code I need @keradus feedback if he's ok with this approach.

better not call it lowercase something, as you could fix the casing of stdClass (and other predefined classes as well)

If we are able to prepare general solution that will fix casing everywhere for built-in types, I'm :+1:
Like we do for true/false/null constants, we don't care where they are used, we always fix casing.

@SpacePossum this should be tagged with has PR

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sennewood picture sennewood  路  3Comments

EvgenyOrekhov picture EvgenyOrekhov  路  3Comments

ro0NL picture ro0NL  路  3Comments

amitbisht511 picture amitbisht511  路  3Comments

BackEndTea picture BackEndTea  路  3Comments