Php-cs-fixer: [Proposal] Ordering Traits

Created on 29 Jul 2015  路  7Comments  路  Source: FriendsOfPHP/PHP-CS-Fixer

Lets say I've included two traits within my class and I want to order them by name.

Before:

use SerializerTrait, DispatchesJobs;

After:

use DispatchesJobs, SerializerTrait;

Don't know if this will be a problem PHP-wise? Otherwise it would make a good feature.

kinfeature request

All 7 comments

I think this might change the behavior of the code if 2 traits are defining a method with the same name

If two traits insert a method with the same name, isn't a fatal error produced? If the conflict is not explicitly resolved?

http://stackoverflow.com/a/25064632/4801875

Yeah a fatal error is thrown so the order of the traits shouldn't have an impact.

:+1: for feature, but it also must support aliasing and resolving conflicts.

Bump

@JarJak the best way of getting this implemented is to have a crack at it yourself! If you need any pointers feel free to as in the Gitter chat

added in https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4701 by @julienfalque :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ndench picture ndench  路  3Comments

BackEndTea picture BackEndTea  路  3Comments

fisharebest picture fisharebest  路  3Comments

aidantwoods picture aidantwoods  路  3Comments

EvgenyOrekhov picture EvgenyOrekhov  路  3Comments