diff --git a/src/Exception/CannotReadCurrentFolderException.php b/src/Exception/CannotReadCurrentFolderException.php index 2228376..a2f63df 100644 --- a/src/Exception/CannotReadCurrentFolderException.php +++ b/src/Exception/CannotReadCurrentFolderException.php @@ -22,7 +22,7 @@ final class CannotReadCurrentFolderException extends Exception public function __construct(string $path) { $this->path = $path; - parent::__construct(sprintf('Current folder cannot be opened `%s`', $path)); + parent::__construct(\sprintf('Current folder cannot be opened `%s`', $path)); } public function getPath(): string diff --git a/src/Exception/CannotReadFolderException.php b/src/Exception/CannotReadFolderException.php index 6a8eefc..11b7964 100644 --- a/src/Exception/CannotReadFolderException.php +++ b/src/Exception/CannotReadFolderException.php @@ -22,7 +22,7 @@ final class CannotReadFolderException extends Exception public function __construct(string $path) { $this->path = $path; - parent::__construct(sprintf('Folder cannot be opened `%s`', $path)); + parent::__construct(\sprintf('Folder cannot be opened `%s`', $path)); } public function getPath(): string diff --git a/src/Exception/FileNotCreatedException.php b/src/Exception/FileNotCreatedException.php index d51fbdc..98c07d0 100644 --- a/src/Exception/FileNotCreatedException.php +++ b/src/Exception/FileNotCreatedException.php @@ -25,7 +25,7 @@ public function __construct(string $filename, string $errorMessage) { $this->filename = $filename; $this->errorMessage = $errorMessage; - parent::__construct(sprintf('File `%s` couldn\'t be created. Error : %s', $filename, $errorMessage)); + parent::__construct(\sprintf('File `%s` couldn\'t be created. Error : %s', $filename, $errorMessage)); } public function getFilename(): string diff --git a/src/Exception/FileNotDeletedException.php b/src/Exception/FileNotDeletedException.php index 5ec619e..69b746a 100644 --- a/src/Exception/FileNotDeletedException.php +++ b/src/Exception/FileNotDeletedException.php @@ -22,7 +22,7 @@ final class FileNotDeletedException extends Exception public function __construct(string $filename) { $this->filename = $filename; - parent::__construct(sprintf('File `%s` couldn\'t be deleted', $filename)); + parent::__construct(\sprintf('File `%s` couldn\'t be deleted', $filename)); } public function getFilename(): string diff --git a/src/Exception/FileNotFoundException.php b/src/Exception/FileNotFoundException.php index 8635451..930e7f8 100644 --- a/src/Exception/FileNotFoundException.php +++ b/src/Exception/FileNotFoundException.php @@ -22,7 +22,7 @@ final class FileNotFoundException extends Exception public function __construct(string $path) { $this->path = $path; - parent::__construct(sprintf('File not found `%s`', $path)); + parent::__construct(\sprintf('File not found `%s`', $path)); } public function getPath(): string diff --git a/src/Exception/FileTooBigException.php b/src/Exception/FileTooBigException.php index e7679ca..bdd7b69 100644 --- a/src/Exception/FileTooBigException.php +++ b/src/Exception/FileTooBigException.php @@ -32,7 +32,7 @@ public function __construct(string $filename, int $size, int $maxAllowedSizeByte $this->maxAllowedSizeBytes = $maxAllowedSizeBytes; $this->maxAllowedSize = $maxAllowedSize; parent::__construct( - sprintf( + \sprintf( 'File `%s` couldn\'t be created. File size %s is bigger than %s bytes. (%s)', $filename, $size, diff --git a/src/Exception/FolderNotCreatedException.php b/src/Exception/FolderNotCreatedException.php index 7d81e4f..5f6f77e 100644 --- a/src/Exception/FolderNotCreatedException.php +++ b/src/Exception/FolderNotCreatedException.php @@ -22,7 +22,7 @@ final class FolderNotCreatedException extends Exception public function __construct(string $folder) { $this->folder = $folder; - parent::__construct(sprintf('Folder `%s` couldn\'t be created', $folder)); + parent::__construct(\sprintf('Folder `%s` couldn\'t be created', $folder)); } public function getFolder(): string diff --git a/src/Exception/FolderNotDeletedException.php b/src/Exception/FolderNotDeletedException.php index 474bfe2..641b38f 100644 --- a/src/Exception/FolderNotDeletedException.php +++ b/src/Exception/FolderNotDeletedException.php @@ -22,7 +22,7 @@ final class FolderNotDeletedException extends Exception public function __construct(string $folder) { $this->folder = $folder; - parent::__construct(sprintf('Folder `%s` couldn\'t be deleted', $folder)); + parent::__construct(\sprintf('Folder `%s` couldn\'t be deleted', $folder)); } public function getFolder(): string diff --git a/src/Exception/FolderNotRenamedException.php b/src/Exception/FolderNotRenamedException.php index 9eac2a5..048be66 100644 --- a/src/Exception/FolderNotRenamedException.php +++ b/src/Exception/FolderNotRenamedException.php @@ -22,7 +22,7 @@ final class FolderNotRenamedException extends Exception public function __construct(string $folder) { $this->folder = $folder; - parent::__construct(sprintf('Folder `%s` couldn\'t be renamed', $folder)); + parent::__construct(\sprintf('Folder `%s` couldn\'t be renamed', $folder)); } public function getFolder(): string diff --git a/src/Exception/InvalidMimeTypeException.php b/src/Exception/InvalidMimeTypeException.php index aca0f86..cea8b12 100644 --- a/src/Exception/InvalidMimeTypeException.php +++ b/src/Exception/InvalidMimeTypeException.php @@ -26,7 +26,7 @@ public function __construct(array $allowedMimeTypes, string $mimeType) $this->allowedMimeTypes = $allowedMimeTypes; $this->mimeType = $mimeType; - parent::__construct(sprintf( + parent::__construct(\sprintf( 'Invalid mime type. Excepted one of %s, `%s` given', implode(', ', $allowedMimeTypes), $mimeType diff --git a/src/Exception/InvalidTypeException.php b/src/Exception/InvalidTypeException.php index 1c1a123..1e295e1 100644 --- a/src/Exception/InvalidTypeException.php +++ b/src/Exception/InvalidTypeException.php @@ -26,7 +26,7 @@ public function __construct(string $type, array $allowedTypes) $this->type = $type; $this->allowedTypes = $allowedTypes; - parent::__construct(sprintf('Invalid type `%s`, allowed types : %s', $type, implode(', ', $allowedTypes))); + parent::__construct(\sprintf('Invalid type `%s`, allowed types : %s', $type, implode(', ', $allowedTypes))); } public function getType(): string diff --git a/src/Helper/FileHelper.php b/src/Helper/FileHelper.php index 8b27788..134fd11 100644 --- a/src/Helper/FileHelper.php +++ b/src/Helper/FileHelper.php @@ -208,11 +208,11 @@ public function upload(UploadedFile $file, string $path, ?string $folder = null) $fileName = mb_strtolower($fileName, 'UTF-8'); // Build final path and loop if the file already exists - $finalName = sprintf('%s.%s', $fileName, $extension); + $finalName = \sprintf('%s.%s', $fileName, $extension); $filePath = $this->getFullPath($path) . '/' . $finalName; $count = 1; while (file_exists($filePath)) { - $finalName = sprintf('%s_%d.%s', $fileName, $count++, $extension); + $finalName = \sprintf('%s_%d.%s', $fileName, $count++, $extension); $filePath = $this->getFullPath($path) . '/' . $finalName; } diff --git a/src/Twig/Extension/FilterExtensionDecorator.php b/src/Twig/Extension/FilterExtensionDecorator.php index 6738a1c..16eef53 100644 --- a/src/Twig/Extension/FilterExtensionDecorator.php +++ b/src/Twig/Extension/FilterExtensionDecorator.php @@ -51,8 +51,8 @@ public function filter( $dataRoots = $this->loaders['default']['filesystem']['data_root'] ?? ['/media/image/']; foreach (array_unique($dataRoots) as $imagePath) { - if (!$this->canImageBeFiltered($path) && file_exists(sprintf('%s/%s', $imagePath, $path))) { - return str_replace($this->publicDir, '', sprintf('%s/%s', $imagePath, $path)); + if (!$this->canImageBeFiltered($path) && file_exists(\sprintf('%s/%s', $imagePath, $path))) { + return str_replace($this->publicDir, '', \sprintf('%s/%s', $imagePath, $path)); } }