1 | <?php |
||
26 | class Application extends Symfony |
||
27 | { |
||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | public const APP_NAME = 'Railt'; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | public const APP_VERSION = '1.2'; |
||
37 | |||
38 | /** |
||
39 | * @var ExceptionRenderer |
||
40 | */ |
||
41 | private $renderer; |
||
42 | |||
43 | /** |
||
44 | * @var Highlighter |
||
45 | */ |
||
46 | private $highlighter; |
||
47 | |||
48 | /** |
||
49 | * @var ContainerInterface |
||
50 | */ |
||
51 | private $container; |
||
52 | |||
53 | /** |
||
54 | * Application constructor. |
||
55 | * @param ContainerInterface $container |
||
56 | * @throws \InvalidArgumentException |
||
57 | * @throws \Railt\Lexer\Exception\BadLexemeException |
||
58 | */ |
||
59 | public function __construct(ContainerInterface $container) |
||
67 | |||
68 | /** |
||
69 | * @param string $path |
||
70 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
71 | */ |
||
72 | public function tryReadManifest(string $path): void |
||
78 | |||
79 | /** |
||
80 | * @param string $path |
||
81 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
82 | */ |
||
83 | public function readManifest(string $path): void |
||
95 | |||
96 | /** |
||
97 | * @return ContainerInterface |
||
98 | */ |
||
99 | public function getContainer(): ContainerInterface |
||
103 | |||
104 | /** |
||
105 | * @return Highlighter |
||
106 | * @throws \InvalidArgumentException |
||
107 | * @throws \Railt\Lexer\Exception\BadLexemeException |
||
108 | */ |
||
109 | private function bootHighlight(): Highlighter |
||
118 | |||
119 | /** |
||
120 | * @param LanguageInterface $language |
||
121 | * @return Application |
||
122 | */ |
||
123 | public function addLanguage(LanguageInterface $language): Application |
||
129 | |||
130 | /** |
||
131 | * @param InputInterface|null $input |
||
132 | * @param OutputInterface|null $output |
||
133 | * @throws \Throwable |
||
134 | */ |
||
135 | public function gracefulRun(InputInterface $input = null, OutputInterface $output = null): void |
||
148 | |||
149 | /** |
||
150 | * @param InputInterface|null $input |
||
151 | * @param OutputInterface|null $output |
||
152 | * @return array |
||
153 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
154 | * @throws \Symfony\Component\Console\Exception\RuntimeException |
||
155 | */ |
||
156 | private function bootPipes(InputInterface $input = null, OutputInterface $output = null): array |
||
166 | |||
167 | /** |
||
168 | * @param \Throwable $e |
||
169 | * @return int |
||
170 | */ |
||
171 | private function exitCode(\Throwable $e): int |
||
175 | |||
176 | /** |
||
177 | * @param Command $command |
||
178 | * @return Command |
||
179 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
180 | */ |
||
181 | public function add(Command $command): Command |
||
191 | |||
192 | /** |
||
193 | * @param \Throwable $e |
||
194 | * @param ConsoleOutput|null $output |
||
195 | * @return void |
||
196 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
197 | */ |
||
198 | public function throw(\Throwable $e, ConsoleOutput $output = null): void |
||
210 | } |
||
211 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: