Closed Achal-Aggarwal closed 7 years ago
So in case that file doesn't exist, does it make more sense to return false
or throw some Exception
(InvalidArgumentException or LogicException)?
could be anything
1) Log::add() and then return false
2) RuntimeException('Path doesn't exist')
3) or any Exception()
Definitely not Log::add
, as we want to avoid hard dependencies. If it can't stat the file for some reason, then it's more than likely that it can't chmod
either, so in that case, canChmod
should just return false. No need to throw an exception or anything.
@dongilbert yeah you are right. If file exist but the directory in which it exist is not accessible by the user then fileperms() is giving stat error.
canChmod doesn't handle the case where the passed path (file or folder) did not exist at all.
fileperms(): stat failed for joomla-framework/src/Joomla/Filesystem/Path