1 | <?php |
||
17 | class VatCalculatorServiceProvider extends ServiceProvider |
||
18 | { |
||
19 | /** |
||
20 | * Indicates if loading of the provider is deferred. |
||
21 | * |
||
22 | * @var bool |
||
23 | */ |
||
24 | protected $defer = false; |
||
25 | |||
26 | /** |
||
27 | * Bootstrap the application events. |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | public function boot() |
||
37 | |||
38 | /** |
||
39 | * Publish Teamwork configuration. |
||
40 | */ |
||
41 | protected function publishConfig() |
||
53 | |||
54 | /** |
||
55 | * Register the service provider. |
||
56 | * |
||
57 | * @return void |
||
58 | */ |
||
59 | public function register() |
||
65 | |||
66 | /** |
||
67 | * Register the application bindings. |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | protected function registerVatCalculator() |
||
81 | |||
82 | /** |
||
83 | * Register the vault facade without the user having to add it to the app.php file. |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | public function registerFacade() |
||
94 | |||
95 | /** |
||
96 | * Merges user's and teamwork's configs. |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | protected function mergeConfig() |
||
106 | |||
107 | protected function registerValidatorExtension() |
||
127 | |||
128 | /** |
||
129 | * Register predefined routes, used for the |
||
130 | * handy javascript toolkit. |
||
131 | */ |
||
132 | protected function registerRoutes() |
||
139 | } |
||
140 |
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: