awesomemotive / wpforms-phpcs

PHP Coding Standards used by the WPForms team.
https://wpforms.com
GNU General Public License v2.0
12 stars 1 forks source link

Disable long functions/objects/classes usage #3

Closed wppunk closed 3 years ago

wppunk commented 3 years ago

Description

Basically, use the use statement instead of a long declaration.

Tested code

Incorrect:

namespace Test;

\func( ... )
\some\namespace\func2( ... );
\DateTime( ... )
\Some\Name\Space\Example()
\Some\Name\Space\Example2::class

Correct:

namespace Test;

use Some\Name\Space\Example;
use Some\Name\Space\Example2;

use function some\name\space\func2;

func();
func2();
DateTime();
Example::class;