[Web] Some minor fixes and improvements for PHP 8
This commit is contained in:
@@ -27,7 +27,7 @@ class CsvFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
protected function loadResource(string $resource)
|
||||
{
|
||||
$messages = [];
|
||||
|
||||
|
@@ -55,11 +55,9 @@ abstract class FileLoader extends ArrayLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $resource
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws InvalidResourceException if stream content has an invalid format
|
||||
*/
|
||||
abstract protected function loadResource($resource);
|
||||
abstract protected function loadResource(string $resource);
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ class IniFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
protected function loadResource(string $resource)
|
||||
{
|
||||
return parse_ini_file($resource, true);
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class JsonFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
protected function loadResource(string $resource)
|
||||
{
|
||||
$messages = [];
|
||||
if ($data = file_get_contents($resource)) {
|
||||
|
@@ -41,7 +41,7 @@ class MoFileLoader extends FileLoader
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
protected function loadResource(string $resource)
|
||||
{
|
||||
$stream = fopen($resource, 'r');
|
||||
|
||||
@@ -89,7 +89,7 @@ class MoFileLoader extends FileLoader
|
||||
fseek($stream, $offset);
|
||||
$singularId = fread($stream, $length);
|
||||
|
||||
if (false !== strpos($singularId, "\000")) {
|
||||
if (str_contains($singularId, "\000")) {
|
||||
[$singularId, $pluralId] = explode("\000", $singularId);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class MoFileLoader extends FileLoader
|
||||
fseek($stream, $offset);
|
||||
$translated = fread($stream, $length);
|
||||
|
||||
if (false !== strpos($translated, "\000")) {
|
||||
if (str_contains($translated, "\000")) {
|
||||
$translated = explode("\000", $translated);
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ class PhpFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
protected function loadResource(string $resource)
|
||||
{
|
||||
if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) {
|
||||
self::$cache = null;
|
||||
|
@@ -60,7 +60,7 @@ class PoFileLoader extends FileLoader
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
protected function loadResource(string $resource)
|
||||
{
|
||||
$stream = fopen($resource, 'r');
|
||||
|
||||
|
@@ -75,7 +75,7 @@ class XliffFileLoader implements LoaderInterface
|
||||
return $catalogue;
|
||||
}
|
||||
|
||||
private function extract($dom, MessageCatalogue $catalogue, string $domain)
|
||||
private function extract(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
|
||||
{
|
||||
$xliffVersion = XliffUtils::getVersionNumber($dom);
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class YamlFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
protected function loadResource(string $resource)
|
||||
{
|
||||
if (null === $this->yamlParser) {
|
||||
if (!class_exists(\Symfony\Component\Yaml\Parser::class)) {
|
||||
|
Reference in New Issue
Block a user