Check if $cached is not a directory to avoid error on unlink

Since the CachePathResolver is unlinking file, is it possible to check first that the $cached is a file, not a directory, to avoid error on trying to unlink a directory ? 

cf https://github.com/avalanche123/AvalancheImagineBundle/issues/134