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 | * Application constructor. |
||
50 | * @throws \InvalidArgumentException |
||
51 | * @throws \Railt\Lexer\Exception\BadLexemeException |
||
52 | */ |
||
53 | public function __construct() |
||
60 | |||
61 | /** |
||
62 | * @param string $path |
||
63 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
64 | */ |
||
65 | public function tryReadManifest(string $path): void |
||
71 | |||
72 | /** |
||
73 | * @param string $path |
||
74 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
75 | */ |
||
76 | public function readManifest(string $path): void |
||
88 | |||
89 | /** |
||
90 | * @return Highlighter |
||
91 | * @throws \InvalidArgumentException |
||
92 | * @throws \Railt\Lexer\Exception\BadLexemeException |
||
93 | */ |
||
94 | private function bootHighlight(): Highlighter |
||
103 | |||
104 | /** |
||
105 | * @param LanguageInterface $language |
||
106 | * @return Application |
||
107 | */ |
||
108 | public function addLanguage(LanguageInterface $language): Application |
||
114 | |||
115 | /** |
||
116 | * @param InputInterface|null $input |
||
117 | * @param OutputInterface|null $output |
||
118 | * @throws \Throwable |
||
119 | */ |
||
120 | public function gracefulRun(InputInterface $input = null, OutputInterface $output = null): void |
||
133 | |||
134 | /** |
||
135 | * @param InputInterface|null $input |
||
136 | * @param OutputInterface|null $output |
||
137 | * @return array |
||
138 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
139 | * @throws \Symfony\Component\Console\Exception\RuntimeException |
||
140 | */ |
||
141 | private function bootPipes(InputInterface $input = null, OutputInterface $output = null): array |
||
151 | |||
152 | /** |
||
153 | * @param \Throwable $e |
||
154 | * @return int |
||
155 | */ |
||
156 | private function exitCode(\Throwable $e): int |
||
160 | |||
161 | /** |
||
162 | * @param Command $command |
||
163 | * @return Command |
||
164 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
165 | */ |
||
166 | public function add(Command $command): Command |
||
176 | |||
177 | /** |
||
178 | * @param \Throwable $e |
||
179 | * @param ConsoleOutput|null $output |
||
180 | * @return void |
||
181 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
182 | */ |
||
183 | public function throw(\Throwable $e, ConsoleOutput $output = null): void |
||
195 | } |
||
196 |
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: