nette / php-generator

🐘 Generates neat PHP code for you. Supports new PHP 8.3 features.
https://doc.nette.org/php-generator
Other
2.11k stars 138 forks source link

Fix namespace sorting of capitalcase #120

Open Jeroeny opened 2 years ago

Jeroeny commented 2 years ago

Before

use App\QueryCostSet;
use App\QueryCostsBootstrapped;

After

use App\QueryCostsBootstrapped;
use App\QueryCostSet;
dg commented 2 years ago

I think that this is better:

use App\QueryCostP;
use App\QueryCostR;
use App\QueryCostT;
use App\QueryCostsBootstrapped;
use App\QueryCostsXyz;

than this:

use App\QueryCostP;
use App\QueryCostR;
use App\QueryCostsBootstrapped;
use App\QueryCostsXyz;
use App\QueryCostT;
symfonyaml commented 9 months ago

Hi @dg ! Do you think this PR will merged at some point ? At the moment I hack the uasort(...) function by "strtolowering" the compared values in PhpNamespace.php

uasort(
    $this->aliases[$of],
    fn(string $a, string $b): int => strtr(strtolower($a), '\\', ' ') <=> strtr(strtolower($b), '\\', ' '),
);