This commit is contained in:
Pierre Rudloff 2020-09-27 15:53:53 +02:00
parent d38b1cd9aa
commit 8d15fbdda2
9 changed files with 25 additions and 21 deletions

View File

@ -185,7 +185,7 @@ class Config
* *
* @return string * @return string
*/ */
public static function addHttpToFormat($format) public static function addHttpToFormat(string $format)
{ {
$newFormat = []; $newFormat = [];
foreach (explode('/', $format) as $subformat) { foreach (explode('/', $format) as $subformat) {
@ -279,7 +279,7 @@ class Config
* @return void * @return void
* @throws ConfigException * @throws ConfigException
*/ */
public static function setFile($file) public static function setFile(string $file)
{ {
if (is_file($file)) { if (is_file($file)) {
$options = Yaml::parse(strval(file_get_contents($file))); $options = Yaml::parse(strval(file_get_contents($file)));

View File

@ -144,7 +144,7 @@ abstract class BaseController
* *
* @return Response HTTP response * @return Response HTTP response
*/ */
protected function displayError(Request $request, Response $response, $message) protected function displayError(Request $request, Response $response, string $message)
{ {
$controller = new FrontController($this->container); $controller = new FrontController($this->container);

View File

@ -242,7 +242,7 @@ class FrontController extends BaseController
* *
* @return Response HTTP response * @return Response HTTP response
*/ */
protected function displayError(Request $request, Response $response, $message) protected function displayError(Request $request, Response $response, string $message)
{ {
$this->view->render( $this->view->render(
$response, $response,

View File

@ -34,7 +34,7 @@ class Locale
* *
* @param string $locale ISO 15897 code * @param string $locale ISO 15897 code
*/ */
public function __construct($locale) public function __construct(string $locale)
{ {
$parse = AcceptLanguage::parse($locale); $parse = AcceptLanguage::parse($locale);
$this->language = $parse[1]['language']; $this->language = $parse[1]['language'];

View File

@ -142,11 +142,11 @@ class LocaleManager
* Smarty "t" block. * Smarty "t" block.
* *
* @param mixed[] $params Block parameters * @param mixed[] $params Block parameters
* @param string $text Block content * @param string|null $text Block content
* *
* @return string Translated string * @return string Translated string
*/ */
public function smartyTranslate(array $params, $text) public function smartyTranslate(array $params, string $text = null)
{ {
if (isset($params['params'])) { if (isset($params['params'])) {
return $this->t($text, $params['params']); return $this->t($text, $params['params']);
@ -158,14 +158,18 @@ class LocaleManager
/** /**
* Translate a string. * Translate a string.
* *
* @param string $string String to translate * @param string|null $string $string String to translate
* *
* @param mixed[] $params * @param mixed[] $params
* @return string Translated string * @return string Translated string
*/ */
public function t($string, array $params = []) public function t(string $string = null, array $params = [])
{ {
return $this->translator->trans($string, $params); if (isset($string)) {
return $this->translator->trans($string, $params);
}
return '';
} }
/** /**

View File

@ -79,7 +79,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
/** /**
* Add data to the archive. * Add data to the archive.
* *
* @param string $data Data * @param mixed $data Data
* *
* @return void * @return void
*/ */
@ -99,7 +99,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
/** /**
* Write data to the stream. * Write data to the stream.
* *
* @param string $string The string that is to be written * @param mixed $string The string that is to be written
* *
* @return int|false * @return int|false
*/ */
@ -171,7 +171,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
/** /**
* Get stream metadata as an associative array or retrieve a specific key. * Get stream metadata as an associative array or retrieve a specific key.
* *
* @param string $key string $key Specific metadata to retrieve. * @param string|null $key string $key Specific metadata to retrieve.
* *
* @return array|mixed|null * @return array|mixed|null
*/ */
@ -228,7 +228,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
/** /**
* Seek to a position in the stream. * Seek to a position in the stream.
* *
* @param int $offset Offset * @param mixed $offset Offset
* @param int $whence Specifies how the cursor position will be calculated * @param int $whence Specifies how the cursor position will be calculated
* *
* @return void * @return void
@ -272,7 +272,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface
/** /**
* Read data from the stream. * Read data from the stream.
* *
* @param int $count Number of bytes to read * @param mixed $count Number of bytes to read
* *
* @return string|false * @return string|false
* @throws AlltubeLibraryException * @throws AlltubeLibraryException

View File

@ -35,7 +35,7 @@ class YoutubeChunkStream implements StreamInterface
/** /**
* Read data from the stream. * Read data from the stream.
* *
* @param int $length Read up to $length bytes from the object and return * @param mixed $length Read up to $length bytes from the object and return
* *
* @return string * @return string
*/ */
@ -121,7 +121,7 @@ class YoutubeChunkStream implements StreamInterface
/** /**
* Seek to a position in the stream. * Seek to a position in the stream.
* *
* @param int $offset Stream offset * @param mixed $offset Stream offset
* @param int $whence Specifies how the cursor position will be calculated * @param int $whence Specifies how the cursor position will be calculated
* *
* @return void * @return void
@ -154,7 +154,7 @@ class YoutubeChunkStream implements StreamInterface
/** /**
* Write data to the stream. * Write data to the stream.
* *
* @param string $string The string that is to be written * @param mixed $string The string that is to be written
* *
* @return mixed * @return mixed
*/ */
@ -186,7 +186,7 @@ class YoutubeChunkStream implements StreamInterface
/** /**
* Get stream metadata as an associative array or retrieve a specific key. * Get stream metadata as an associative array or retrieve a specific key.
* *
* @param string $key Specific metadata to retrieve. * @param string|null $key Specific metadata to retrieve.
* *
* @return array|mixed|null * @return array|mixed|null
*/ */

View File

@ -42,7 +42,7 @@ class UglyRouter extends Router
/** /**
* Build the path for a named route including the base path. * Build the path for a named route including the base path.
* *
* @param string $name Route name * @param mixed $name Route name
* @param string[] $data Named argument replacement data * @param string[] $data Named argument replacement data
* @param string[] $queryParams Optional query string parameters * @param string[] $queryParams Optional query string parameters
* *

View File

@ -21,7 +21,7 @@ class ViewFactory
* Create Smarty view object. * Create Smarty view object.
* *
* @param ContainerInterface $container Slim dependency container * @param ContainerInterface $container Slim dependency container
* @param Request $request PSR-7 request * @param Request|null $request PSR-7 request
* *
* @return Smarty * @return Smarty
* @throws SmartyException * @throws SmartyException