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 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();

View file

@ -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);

View file

@ -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;

View file

@ -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));

View file

@ -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);

View file

@ -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();
}