humbug /
php-scoper
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /* |
||
| 6 | * This file is part of the humbug/php-scoper package. |
||
| 7 | * |
||
| 8 | * Copyright (c) 2017 Théo FIDRY <[email protected]>, |
||
| 9 | * Pádraic Brady <[email protected]> |
||
| 10 | * |
||
| 11 | * For the full copyright and license information, please view the LICENSE |
||
| 12 | * file that was distributed with this source code. |
||
| 13 | */ |
||
| 14 | |||
| 15 | namespace Humbug\PhpScoper\PhpParser\Node; |
||
| 16 | |||
| 17 | use InvalidArgumentException; |
||
| 18 | use PhpParser\Node\Name; |
||
| 19 | |||
| 20 | final class NameFactory |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @param string|string[]|Name|null $name1 |
||
| 24 | * @param string|string[]|Name|null $name2 |
||
| 25 | */ |
||
| 26 | public static function concat($name1, $name2, array $attributes = []): Name |
||
| 27 | { |
||
| 28 | if (null === $name1 && null === $name2) { |
||
| 29 | throw new InvalidArgumentException('Expected one of the names to not be null'); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** @var Name $fqName */ |
||
| 33 | return Name::concat($name1, $name2, $attributes); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 34 | } |
||
| 35 | |||
| 36 | private function __construct() |
||
| 37 | { |
||
| 38 | } |
||
| 39 | } |
||
| 40 |