Add void return types

This commit is contained in:
Pierre Rudloff 2022-05-28 23:43:07 +02:00
parent e3187a7258
commit e81b8c75a8
6 changed files with 16 additions and 16 deletions

View file

@ -205,7 +205,7 @@ class Config
* @throws ConfigException If Python is missing * @throws ConfigException If Python is missing
* @throws ConfigException If youtube-dl is missing * @throws ConfigException If youtube-dl is missing
*/ */
private function validateOptions() private function validateOptions(): void
{ {
if (!is_file($this->youtubedl)) { if (!is_file($this->youtubedl)) {
throw new ConfigException("Can't find youtube-dl at " . $this->youtubedl); throw new ConfigException("Can't find youtube-dl at " . $this->youtubedl);
@ -226,7 +226,7 @@ class Config
* *
* @return void * @return void
*/ */
private function applyOptions(array $options) private function applyOptions(array $options): void
{ {
foreach ($options as $option => $value) { foreach ($options as $option => $value) {
if (isset($this->$option) && isset($value)) { if (isset($this->$option) && isset($value)) {
@ -243,7 +243,7 @@ class Config
* @return void * @return void
* @throws ConfigException * @throws ConfigException
*/ */
private function getEnv() private function getEnv(): void
{ {
foreach (get_object_vars($this) as $prop => $value) { foreach (get_object_vars($this) as $prop => $value) {
try { try {
@ -282,7 +282,7 @@ class Config
* @return void * @return void
* @throws ConfigException * @throws ConfigException
*/ */
public function setOptions(array $options) public function setOptions(array $options): void
{ {
$this->applyOptions($options); $this->applyOptions($options);
$this->validateOptions(); $this->validateOptions();

View file

@ -18,7 +18,7 @@ class ErrorHandler
* @param Throwable $e * @param Throwable $e
* @return void * @return void
*/ */
public static function handle(Throwable $e) public static function handle(Throwable $e): void
{ {
error_log($e); error_log($e);

View file

@ -114,7 +114,7 @@ class LocaleManager
* @param Locale $locale Locale * @param Locale $locale Locale
* @return void * @return void
*/ */
public function setLocale(Locale $locale) public function setLocale(Locale $locale): void
{ {
$this->translator->setLocale($locale->getIso15897()); $this->translator->setLocale($locale->getIso15897());
$this->curLocale = $locale; $this->curLocale = $locale;
@ -125,7 +125,7 @@ class LocaleManager
* Unset the current locale. * Unset the current locale.
* @return void * @return void
*/ */
public function unsetLocale() public function unsetLocale(): void
{ {
$this->translator->setLocale(self::DEFAULT_LOCALE); $this->translator->setLocale(self::DEFAULT_LOCALE);
$this->curLocale = null; $this->curLocale = null;

View file

@ -23,7 +23,7 @@ class ConvertedPlaylistArchiveStream extends PlaylistArchiveStream
* @return void * @return void
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
*/ */
protected function startVideoStream(Video $video) protected function startVideoStream(Video $video): void
{ {
$this->curVideoStream = new Stream($this->downloader->getAudioStream($video)); $this->curVideoStream = new Stream($this->downloader->getAudioStream($video));

View file

@ -83,7 +83,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
* *
* @return void * @return void
*/ */
protected function send($data) protected function send($data): void
{ {
$pos = $this->tell(); $pos = $this->tell();
@ -133,7 +133,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
* *
* @return void * @return void
*/ */
public function rewind() public function rewind(): void
{ {
rewind($this->buffer); rewind($this->buffer);
} }
@ -233,7 +233,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
* *
* @return void * @return void
*/ */
public function seek($offset, $whence = SEEK_SET) public function seek($offset, $whence = SEEK_SET): void
{ {
fseek($this->buffer, $offset, $whence); fseek($this->buffer, $offset, $whence);
} }
@ -256,7 +256,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
* @return void * @return void
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
*/ */
protected function startVideoStream(Video $video) protected function startVideoStream(Video $video): void
{ {
$response = $this->downloader->getHttpResponse($video); $response = $this->downloader->getHttpResponse($video);
@ -320,7 +320,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
* *
* @return void * @return void
*/ */
public function close() public function close(): void
{ {
if (is_resource($this->buffer)) { if (is_resource($this->buffer)) {
fclose($this->buffer); fclose($this->buffer);

View file

@ -63,7 +63,7 @@ class YoutubeChunkStream implements StreamInterface
* *
* @return void * @return void
*/ */
public function close() public function close(): void
{ {
$this->response->getBody()->close(); $this->response->getBody()->close();
} }
@ -126,7 +126,7 @@ class YoutubeChunkStream implements StreamInterface
* *
* @return void * @return void
*/ */
public function seek($offset, $whence = SEEK_SET) public function seek($offset, $whence = SEEK_SET): void
{ {
$this->response->getBody()->seek($offset, $whence); $this->response->getBody()->seek($offset, $whence);
} }
@ -136,7 +136,7 @@ class YoutubeChunkStream implements StreamInterface
* *
* @return void * @return void
*/ */
public function rewind() public function rewind(): void
{ {
$this->response->getBody()->rewind(); $this->response->getBody()->rewind();
} }