Skip to content

Commit

Permalink
Add void return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudloff committed May 28, 2022
1 parent e3187a7 commit e81b8c7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)) {
Expand All @@ -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 {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion classes/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions classes/LocaleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion classes/Stream/ConvertedPlaylistArchiveStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
10 changes: 5 additions & 5 deletions classes/Stream/PlaylistArchiveStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -133,7 133,7 @@ public function isSeekable(): bool
*
* @return void
*/
public function rewind()
public function rewind(): void
{
rewind($this->buffer);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions classes/Stream/YoutubeChunkStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 63,7 @@ public function __toString(): string
*
* @return void
*/
public function close()
public function close(): void
{
$this->response->getBody()->close();
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -136,7 136,7 @@ public function seek($offset, $whence = SEEK_SET)
*
* @return void
*/
public function rewind()
public function rewind(): void
{
$this->response->getBody()->rewind();
}
Expand Down

0 comments on commit e81b8c7

Please sign in to comment.