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 b08b883f..542200eb 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -205,7 +205,7 @@ public static function addHttpToFormat(string $format): string * @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 @@ private function validateOptions() * * @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 @@ private function applyOptions(array $options) * @return void * @throws ConfigException */ - private function getEnv() + private function getEnv(): void { foreach (get_object_vars($this) as $prop => $value) { try { @@ -282,7 +282,7 @@ public static function fromFile(string $file): 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 f8dd60ab..c48b354a 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 58b8944f..44b33ad2 100644 --- a/classes/LocaleManager.php +++ b/classes/LocaleManager.php @@ -114,7 +114,7 @@ public function getLocale(): ?Locale * @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 @@ public function setLocale(Locale $locale) * 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 c4114ea6..35b57e41 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 5c9ed4a1..58c052ff 100644 --- a/classes/Stream/PlaylistArchiveStream.php +++ b/classes/Stream/PlaylistArchiveStream.php @@ -83,7 +83,7 @@ public function __construct(Downloader $downloader, Video $video) * * @return void */ - protected function send($data) + protected function send($data): void { $pos = $this->tell(); @@ -133,7 +133,7 @@ public function isSeekable(): bool * * @return void */ - public function rewind() + public function rewind(): void { rewind($this->buffer); } @@ -233,7 +233,7 @@ public function tell() * * @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 @@ public function eof(): bool * @return void * @throws AlltubeLibraryException */ - protected function startVideoStream(Video $video) + protected function startVideoStream(Video $video): void { $response = $this->downloader->getHttpResponse($video); @@ -320,7 +320,7 @@ public function read($length) * * @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 f66996fc..6632eb27 100644 --- a/classes/Stream/YoutubeChunkStream.php +++ b/classes/Stream/YoutubeChunkStream.php @@ -63,7 +63,7 @@ public function __toString(): string * * @return void */ - public function close() + public function close(): void { $this->response->getBody()->close(); } @@ -126,7 +126,7 @@ public function isSeekable(): bool * * @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 @@ public function seek($offset, $whence = SEEK_SET) * * @return void */ - public function rewind() + public function rewind(): void { $this->response->getBody()->rewind(); }