UnnecessaryUseAlias
info on by default quick-fixGroup: Code style · PhpStorm name: UnnecessaryUseAliasInspection
An import alias identical to the last segment of the imported name (use App\Mail\Sender as Sender;) changes nothing. Drop the as clause.
Example
php
<?php
namespace Shop;
use Psr\Log\LoggerInterface as LoggerInterface;
use \Redis as Redis;
use function Util\slugify as slugify;
use Psr\Cache\{CacheItemInterface as CacheItemInterface, InvalidArgumentException};
use Psr\Clock\ClockInterface as Clock;
use Psr\Link\LinkInterface as linkinterface;
class Cart {
use \Shop\Traits\Totals { total as total; }
}php
<?php
namespace Shop;
use Psr\Log\LoggerInterface;
use \Redis;
use function Util\slugify;
use Psr\Cache\{CacheItemInterface, InvalidArgumentException};
use Psr\Clock\ClockInterface as Clock;
use Psr\Link\LinkInterface as linkinterface;
class Cart {
use \Shop\Traits\Totals { total as total; }
}Reported:
- line 4: Alias LoggerInterface repeats the imported name; remove it.
- line 5: Alias Redis repeats the imported name; remove it.
- line 6: Alias slugify repeats the imported name; remove it.
- line 7: Alias CacheItemInterface repeats the imported name; remove it.
Configure
In custos.json:
json
{
"rules": {
"UnnecessaryUseAlias": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file), either of:
php
// @custos-ignore UnnecessaryUseAlias
/**
* @noinspection UnnecessaryUseAliasInspection
*/