Stronger typying now that we target PHP 7.4

This commit is contained in:
Pierre Rudloff 2023-03-21 20:18:21 +01:00
parent b23ce88be8
commit 71647158d3
No known key found for this signature in database
5 changed files with 31 additions and 29 deletions

View File

@ -24,84 +24,86 @@ class Config
*
* @var string
*/
public $youtubedl = 'vendor/ytdl-org/youtube-dl/youtube_dl/__main__.py';
public string $youtubedl = 'vendor/ytdl-org/youtube-dl/youtube_dl/__main__.py';
/**
* python binary path.
*
* @var string
*/
public $python = '/usr/bin/python';
public string $python = '/usr/bin/python';
/**
* youtube-dl parameters.
*
* @var string[]
*/
public $params = ['--no-warnings', '--ignore-errors', '--flat-playlist', '--restrict-filenames', '--no-playlist'];
public array $params = [
'--no-warnings', '--ignore-errors', '--flat-playlist', '--restrict-filenames', '--no-playlist'
];
/**
* Enable audio conversion.
*
* @var bool
*/
public $convert = false;
public bool $convert = false;
/**
* Enable advanced conversion mode.
*
* @var bool
*/
public $convertAdvanced = false;
public bool $convertAdvanced = false;
/**
* List of formats available in advanced conversion mode.
*
* @var string[]
*/
public $convertAdvancedFormats = ['mp3', 'avi', 'flv', 'wav'];
public array $convertAdvancedFormats = ['mp3', 'avi', 'flv', 'wav'];
/**
* ffmpeg binary path.
*
* @var string
*/
public $ffmpeg = '/usr/bin/ffmpeg';
public string $ffmpeg = '/usr/bin/ffmpeg';
/**
* Path to the directory that contains the phantomjs binary.
*
* @var string
*/
public $phantomjsDir = '/usr/bin/';
public string $phantomjsDir = '/usr/bin/';
/**
* Disable URL rewriting.
*
* @var bool
*/
public $uglyUrls = false;
public bool $uglyUrls = false;
/**
* Stream downloaded files trough server?
*
* @var bool
*/
public $stream = false;
public bool $stream = false;
/**
* Allow to remux video + audio?
*
* @var bool
*/
public $remux = false;
public bool $remux = false;
/**
* MP3 bitrate when converting (in kbit/s).
*
* @var int
*/
public $audioBitrate = 128;
public int $audioBitrate = 128;
/**
* ffmpeg logging level.
@ -109,21 +111,21 @@ class Config
*
* @var string
*/
public $ffmpegVerbosity = 'error';
public string $ffmpegVerbosity = 'error';
/**
* App name.
*
* @var string
*/
public $appName = 'AllTube Download';
public string $appName = 'AllTube Download';
/**
* Generic formats supported by youtube-dl.
*
* @var string[]
*/
public $genericFormats = [
public array $genericFormats = [
'best/bestvideo' => 'Best',
'bestvideo+bestaudio' => 'Remux best video with best audio',
'worst/worstvideo' => 'Worst',
@ -134,21 +136,21 @@ class Config
*
* @var bool
*/
public $debug = false;
public bool $debug = false;
/**
* Default to audio.
*
* @var bool
*/
public $defaultAudio = false;
public bool $defaultAudio = false;
/**
* Disable audio conversion from/to seeker.
*
* @var bool
*/
public $convertSeek = true;
public bool $convertSeek = true;
/**
* Config constructor.

View File

@ -30,21 +30,21 @@ abstract class BaseController
*
* @var Video
*/
protected $video;
protected Video $video;
/**
* Default youtube-dl format.
*
* @var string
*/
protected $defaultFormat = 'best/bestvideo';
protected string $defaultFormat = 'best/bestvideo';
/**
* Slim dependency container.
*
* @var ContainerInterface
*/
protected $container;
protected ContainerInterface $container;
/**
* Config instance.

View File

@ -27,14 +27,14 @@ class LocaleManager
*
* @var Locale|null
*/
private $curLocale;
private ?Locale $curLocale = null;
/**
* Session segment used to store session variables.
*
* @var Segment
*/
private $sessionSegment;
private Segment $sessionSegment;
/**
* Default locale.
@ -48,7 +48,7 @@ class LocaleManager
*
* @var Translator
*/
private $translator;
private Translator $translator;
/**
* LocaleManager constructor.

View File

@ -24,7 +24,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
*
* @var Video[]
*/
private $videos = [];
private array $videos = [];
/**
* Stream used to store data before it is sent to the browser.
@ -38,21 +38,21 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
*
* @var StreamInterface
*/
protected $curVideoStream;
protected StreamInterface $curVideoStream;
/**
* True if the archive is complete.
*
* @var bool
*/
private $isComplete = false;
private bool $isComplete = false;
/**
* Downloader object.
*
* @var Downloader
*/
protected $downloader;
protected Downloader $downloader;
/**
* PlaylistArchiveStream constructor.

View File

@ -20,7 +20,7 @@ class YoutubeChunkStream implements StreamInterface
*
* @var ResponseInterface
*/
private $response;
private ResponseInterface $response;
/**
* YoutubeChunkStream constructor.