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

View File

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

View File

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

View File

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

View File

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