2
0
mirror of https://github.com/opencultureconsulting/oai-pmh2.git synced 2025-03-30 00:00:30 +01:00

Fix PHPStan issue with differing PHP versions

This commit is contained in:
Sebastian Meyer 2025-03-23 09:52:12 +01:00
parent 0228d2fd5a
commit 1ad0bb6d6e
3 changed files with 7 additions and 4 deletions

View File

@ -10,6 +10,7 @@ includes:
parameters:
level: 9
phpVersion: 80100 # PHP 8.1
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: ternary.shortNotAllowed

View File

@ -211,6 +211,7 @@ final class CsvImportCommand extends Console
'dateColumn' => $input->getOption('dateColumn'),
'setColumn' => $input->getOption('setColumn')
];
$filename = stream_get_meta_data($file)['uri'] ?? '';
$headers = fgetcsv($file, null, ",", "\"", "\\");
if (!is_array($headers) || is_null($headers[0])) {
@ -218,7 +219,7 @@ final class CsvImportCommand extends Console
'',
sprintf(
' [ERROR] File "%s" does not contain valid CSV. ',
stream_get_meta_data($file)['uri'] ?? 'unknown'
$filename ?: 'unknown'
),
''
]);
@ -239,7 +240,7 @@ final class CsvImportCommand extends Console
'',
sprintf(
' [ERROR] File "%s" does not contain mandatory columns. ',
stream_get_meta_data($file)['uri'] ?? 'unknown'
$filename ?: 'unknown'
),
''
]);

View File

@ -60,10 +60,11 @@ final class UpdateFormatsCommand extends Console
$failure = false;
foreach ($formats as $prefix => $format) {
if (
/** PHPStan and Psalm don't recognize this as assertion. */
$inDatabase->containsKey($prefix)
/** @phpstan-ignore-next-line - see line 62 */
/** @phpstan-ignore-next-line - see above */
and $format['namespace'] === $inDatabase[$prefix]->getNamespace()
/** @phpstan-ignore-next-line - see line 62 */
/** @phpstan-ignore-next-line - see above */
and $format['schema'] === $inDatabase[$prefix]->getSchema()
) {
continue;