1 | <?php |
||
27 | class FolderApiController extends ApiController { |
||
28 | |||
29 | use JSONHttpError; |
||
30 | |||
31 | private $folderService; |
||
32 | private $itemService; |
||
33 | private $userId; |
||
34 | private $serializer; |
||
35 | |||
36 | public function __construct($AppName, |
||
47 | |||
48 | |||
49 | /** |
||
50 | * @NoAdminRequired |
||
51 | * @NoCSRFRequired |
||
52 | * @CORS |
||
53 | */ |
||
54 | public function index() { |
||
59 | |||
60 | |||
61 | /** |
||
62 | * @NoAdminRequired |
||
63 | * @NoCSRFRequired |
||
64 | * @CORS |
||
65 | * |
||
66 | * @param string $name |
||
67 | * @return array|mixed|\OCP\AppFramework\Http\JSONResponse |
||
68 | */ |
||
69 | public function create($name) { |
||
81 | |||
82 | |||
83 | /** |
||
84 | * @NoAdminRequired |
||
85 | * @NoCSRFRequired |
||
86 | * @CORS |
||
87 | * |
||
88 | * @param int $folderId |
||
89 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
90 | */ |
||
91 | public function delete($folderId) { |
||
100 | |||
101 | |||
102 | /** |
||
103 | * @NoAdminRequired |
||
104 | * @NoCSRFRequired |
||
105 | * @CORS |
||
106 | * @param int $folderId |
||
107 | * @param string $name |
||
108 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
109 | */ |
||
110 | public function update($folderId, $name) { |
||
124 | |||
125 | |||
126 | /** |
||
127 | * @NoAdminRequired |
||
128 | * @NoCSRFRequired |
||
129 | * @CORS |
||
130 | * |
||
131 | * @param int $folderId |
||
132 | * @param int $newestItemId |
||
133 | */ |
||
134 | public function read($folderId, $newestItemId) { |
||
137 | |||
138 | |||
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: