Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel: The use statement with non-compound name 'Cache' has no effect [duplicate]

I have centos7 php56 laravel 5 and memcached but when try use Cache in routes.php I get:

ErrorException in routes.php line 3:
The use statement with non-compound name 'Cache' has no effect

router.php

<?php

use Cache;
...
like image 641
Edgaras Karka Avatar asked Jan 03 '17 10:01

Edgaras Karka


2 Answers

Just remove use Cache; from your routes.php. It is not needed there as file itself is not associated with specific namespace. Once you remove it you will not see that warning again.

like image 165
Artyom Sokolov Avatar answered Sep 24 '22 06:09

Artyom Sokolov


That is because you are already in the global namespace. So when you do something like use Cache;, you are saying "when I say Cache, I mean \Cache". Because you already are in the global namespace, that statement has no effect. That's what the warning is about.

like image 31
Daan Meijer Avatar answered Sep 21 '22 06:09

Daan Meijer