From e81b8c75a8fe1a6e57acdf29ce78c29cc9ccae36 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 28 May 2022 23:43:07 +0200 Subject: [PATCH] Add void return types --- classes/Config.php | 8 ++++---- classes/ErrorHandler.php | 2 +- classes/LocaleManager.php | 4 ++-- classes/Stream/ConvertedPlaylistArchiveStream.php | 2 +- classes/Stream/PlaylistArchiveStream.php | 10 +++++----- classes/Stream/YoutubeChunkStream.php | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/classes/Config.php b/classes/Config.php index b08b883..542200e 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -205,7 +205,7 @@ class Config * @throws ConfigException If Python is missing * @throws ConfigException If youtube-dl is missing */ - private function validateOptions() + private function validateOptions(): void { if (!is_file($this->youtubedl)) { throw new ConfigException("Can't find youtube-dl at " . $this->youtubedl); @@ -226,7 +226,7 @@ class Config * * @return void */ - private function applyOptions(array $options) + private function applyOptions(array $options): void { foreach ($options as $option => $value) { if (isset($this->$option) && isset($value)) { @@ -243,7 +243,7 @@ class Config * @return void * @throws ConfigException */ - private function getEnv() + private function getEnv(): void { foreach (get_object_vars($this) as $prop => $value) { try { @@ -282,7 +282,7 @@ class Config * @return void * @throws ConfigException */ - public function setOptions(array $options) + public function setOptions(array $options): void { $this->applyOptions($options); $this->validateOptions(); diff --git a/classes/ErrorHandler.php b/classes/ErrorHandler.php index f8dd60a..c48b354 100644 --- a/classes/ErrorHandler.php +++ b/classes/ErrorHandler.php @@ -18,7 +18,7 @@ class ErrorHandler * @param Throwable $e * @return void */ - public static function handle(Throwable $e) + public static function handle(Throwable $e): void { error_log($e); diff --git a/classes/LocaleManager.php b/classes/LocaleManager.php index 58b8944..44b33ad 100644 --- a/classes/LocaleManager.php +++ b/classes/LocaleManager.php @@ -114,7 +114,7 @@ class LocaleManager * @param Locale $locale Locale * @return void */ - public function setLocale(Locale $locale) + public function setLocale(Locale $locale): void { $this->translator->setLocale($locale->getIso15897()); $this->curLocale = $locale; @@ -125,7 +125,7 @@ class LocaleManager * Unset the current locale. * @return void */ - public function unsetLocale() + public function unsetLocale(): void { $this->translator->setLocale(self::DEFAULT_LOCALE); $this->curLocale = null; diff --git a/classes/Stream/ConvertedPlaylistArchiveStream.php b/classes/Stream/ConvertedPlaylistArchiveStream.php index c4114ea..35b57e4 100644 --- a/classes/Stream/ConvertedPlaylistArchiveStream.php +++ b/classes/Stream/ConvertedPlaylistArchiveStream.php @@ -23,7 +23,7 @@ class ConvertedPlaylistArchiveStream extends PlaylistArchiveStream * @return void * @throws AlltubeLibraryException */ - protected function startVideoStream(Video $video) + protected function startVideoStream(Video $video): void { $this->curVideoStream = new Stream($this->downloader->getAudioStream($video)); diff --git a/classes/Stream/PlaylistArchiveStream.php b/classes/Stream/PlaylistArchiveStream.php index 5c9ed4a..58c052f 100644 --- a/classes/Stream/PlaylistArchiveStream.php +++ b/classes/Stream/PlaylistArchiveStream.php @@ -83,7 +83,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * * @return void */ - protected function send($data) + protected function send($data): void { $pos = $this->tell(); @@ -133,7 +133,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * * @return void */ - public function rewind() + public function rewind(): void { rewind($this->buffer); } @@ -233,7 +233,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * * @return void */ - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { fseek($this->buffer, $offset, $whence); } @@ -256,7 +256,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * @return void * @throws AlltubeLibraryException */ - protected function startVideoStream(Video $video) + protected function startVideoStream(Video $video): void { $response = $this->downloader->getHttpResponse($video); @@ -320,7 +320,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * * @return void */ - public function close() + public function close(): void { if (is_resource($this->buffer)) { fclose($this->buffer); diff --git a/classes/Stream/YoutubeChunkStream.php b/classes/Stream/YoutubeChunkStream.php index f66996f..6632eb2 100644 --- a/classes/Stream/YoutubeChunkStream.php +++ b/classes/Stream/YoutubeChunkStream.php @@ -63,7 +63,7 @@ class YoutubeChunkStream implements StreamInterface * * @return void */ - public function close() + public function close(): void { $this->response->getBody()->close(); } @@ -126,7 +126,7 @@ class YoutubeChunkStream implements StreamInterface * * @return void */ - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { $this->response->getBody()->seek($offset, $whence); } @@ -136,7 +136,7 @@ class YoutubeChunkStream implements StreamInterface * * @return void */ - public function rewind() + public function rewind(): void { $this->response->getBody()->rewind(); }