Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .github/phpstan_12.4.neon
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
parameters:
ignoreErrors:
- '#Call to an undefined method Psr\\Http\\Message\\RequestFactoryInterface::request\(\)\.#'
- '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\ManifestInterface::getOriginalJsonArray\(\)\.#'
- '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\RangeInterface::getMemberRangesAndRanges\(\)\.#'
-
message: '#Class TYPO3\\CMS\\Core\\Database\\Schema\\Parser\\Lexer constructor invoked with 0 parameters, 1 required\.#'
path: ../Classes/Command/DatabaseDocs/Generator.php
-
message: '#Parameter \#1 \$statement of class TYPO3\\CMS\\Core\\Database\\Schema\\Parser\\Parser constructor expects string, TYPO3\\CMS\\Core\\Database\\Schema\\Parser\\Lexer given\.#'
path: ../Classes/Command/DatabaseDocs/Generator.php
-
message: '#Method TYPO3\\CMS\\Core\\Database\\Schema\\Parser\\Parser::parse\(\) invoked with 1 parameter, 0 required\.#'
path: ../Classes/Command/DatabaseDocs/Generator.php
message: '#Call to an undefined method DOMXPath|SimpleXMLElement::getName\(\)\.#'
path: ../Classes/Common/MetsDocument.php
-
message: '#Class TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScriptFactory not found\.#'
path: ../Classes/Common/TypoScriptHelper.php
Expand All @@ -21,6 +13,9 @@ parameters:
-
message: '#Call to method createSetupConfigOrFullSetup\(\) on an unknown class TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScriptFactory\.#'
path: ../Classes/Common/TypoScriptHelper.php
-
message: '#Parameter \#1 \$separator of function explode expects non-empty-string, string given\.#'
path: ../Classes/Controller/ToolboxController.php
-
message: '#PHPDoc tag @var for variable \$action contains unknown class TYPO3\\CMS\\Scheduler\\SchedulerManagementAction\.#'
path: ../Classes/Task/BaseAdditionalFieldProvider.php
Expand All @@ -30,10 +25,14 @@ parameters:
-
message: '#Cannot call method getFirst\(\) on iterable<Kitodo\\Dlf\\Domain\\Model\\SolrCore>|TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface\.#'
path: ../Classes/Controller/Backend/NewTenantController.php
-
message: '#PHPDoc tag \@var with type TYPO3\\CMS\\Scheduler\\SchedulerManagementAction is not subtype of native type TYPO3\\CMS\\Scheduler\\Task\\Enumeration\\Action\.#'
path: ../Classes/Task/BaseAdditionalFieldProvider.php
level: 7
paths:
- ../Classes/
excludePaths:
- ../Classes/Common/IiifManifest.php
- ../Classes/Controller/OaiPmhController.php
- ../Classes/Command/DbDocs/Generator.php # dbdocs command is not supported in Typo3 v12
- ../Classes/Command/DatabaseDocs/Generator.php # dbdocs command is not supported in Typo3 v12
treatPhpDocTypesAsCertain: false
13 changes: 9 additions & 4 deletions .github/phpstan_13.4.neon
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
parameters:
ignoreErrors:
- '#Call to an undefined method Psr\\Http\\Message\\RequestFactoryInterface::request\(\)\.#'
- '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\ManifestInterface::getOriginalJsonArray\(\)\.#'
- '#Call to an undefined method Ubl\\Iiif\\Presentation\\Common\\Model\\Resources\\RangeInterface::getMemberRangesAndRanges\(\)\.#'
-
message: '#Method TYPO3\\CMS\\Core\\Database\\Schema\\Parser\\Parser::parse\(\) invoked with 0 parameters, 1 required\.#'
path: ../Classes/Command/DatabaseDocs/Generator.php
message: '#Call to an undefined method DOMXPath|SimpleXMLElement::getName\(\)\.#'
path: ../Classes/Common/MetsDocument.php
-
message: '#Call to an undefined method TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController::getFromCache\(\)\.#'
path: ../Classes/Common/TypoScriptHelper.php
-
message: '#Call to an undefined method TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController::releaseLocks\(\)\.#'
path: ../Classes/Common/TypoScriptHelper.php
-
message: '#Parameter \#1 \$separator of function explode expects non-empty-string, string given\.#'
path: ../Classes/Controller/ToolboxController.php
-
message: '#PHPDoc tag @var for variable \$action contains unknown class TYPO3\\CMS\\Scheduler\\Task\\Enumeration\\Action\.#'
path: ../Classes/Task/BaseAdditionalFieldProvider.php
Expand All @@ -21,8 +22,12 @@ parameters:
-
message: '#Call to method equals\(\) on an unknown class TYPO3\\CMS\\Scheduler\\Task\\Enumeration\\Action\.#'
path: ../Classes/Task/BaseAdditionalFieldProvider.php
-
message: '#PHPDoc tag \@var with type TYPO3\\CMS\\Scheduler\\Task\\Enumeration\\Action is not subtype of native type TYPO3\\CMS\\Scheduler\\SchedulerManagementAction\.#'
path: ../Classes/Task/BaseAdditionalFieldProvider.php
level: 7
paths:
- ../Classes
excludePaths:
- ../Classes/Common/IiifManifest.php
treatPhpDocTypesAsCertain: false
2 changes: 1 addition & 1 deletion Classes/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function getSolrCoreUid(array $solrCores, bool|string|null $inputSolrI
{
if (MathUtility::canBeInterpretedAsInteger($inputSolrId)) {
return MathUtility::forceIntegerInRange((int) $inputSolrId, 0);
} elseif (is_string($inputSolrId) && array_key_exists($inputSolrId, $solrCores)) {
} else if (is_string($inputSolrId) && array_key_exists($inputSolrId, $solrCores)) {
return $solrCores[$inputSolrId];
}
return null;
Expand Down
11 changes: 2 additions & 9 deletions Classes/Command/DatabaseDocs/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use TYPO3\CMS\Core\Database\Schema\Parser\Lexer;
use TYPO3\CMS\Core\Database\Schema\Parser\Parser;
use TYPO3\CMS\Core\Database\Schema\SqlReader;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down Expand Up @@ -104,14 +103,8 @@ public function collectTables(): array
$result = [];

foreach ($createTableStatements as $statement) {
$typo3Version = (new Typo3Version())->getMajorVersion();
if ($typo3Version >= 13) {
$parser = new Parser(new Lexer());
list($table) = $parser->parse($statement);
} else {
$parser = new Parser($statement);
list($table) = $parser->parse();
}
$parser = new Parser(new Lexer());
list($table) = $parser->parse($statement);

$tableName = $table->getName();
if (!str_starts_with($tableName, 'tx_dlf_')) {
Expand Down
25 changes: 12 additions & 13 deletions Classes/Common/AbstractDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
use Kitodo\Dlf\Domain\Repository\FormatRepository;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Log\Logger;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
Expand All @@ -36,24 +35,24 @@
* @abstract
*
* @property int $configPid this holds the PID for the configuration
* @property-read array $formats this holds the configuration for all supported metadata encodings
* @property-read array<string, array<string, string>> $formats this holds the configuration for all supported metadata encodings
* @property bool $formatsLoaded flag with information if the available metadata formats are loaded
* @property-read bool $hasFulltext flag with information if there are any fulltext files available
* @property array $lastSearchedPhysicalPage the last searched logical and physical page
* @property array $logicalUnits this holds the logical units
* @property-read array $metadataArray this holds the documents' parsed metadata array
* @property array<string, mixed> $lastSearchedPhysicalPage the last searched logical and physical page
* @property mixed[] $logicalUnits this holds the logical units
* @property-read mixed[] $metadataArray this holds the documents' parsed metadata array
* @property bool $metadataArrayLoaded flag with information if the metadata array is loaded
* @property-read int $numPages the holds the total number of pages
* @property-read int $parentId this holds the UID of the parent document or zero if not multi-volumed
* @property-read array $physicalStructure this holds the physical structure
* @property-read array $physicalStructureInfo this holds the physical structure metadata
* @property-read mixed[] $physicalStructure this holds the physical structure
* @property-read mixed[] $physicalStructureInfo this holds the physical structure metadata
* @property bool $physicalStructureLoaded flag with information if the physical structure is loaded
* @property array $rawTextArray this holds the documents' raw text pages with their corresponding structMap//div's ID (METS) or Range / Manifest / Sequence ID (IIIF) as array key
* @property array<string, string> $rawTextArray this holds the documents' raw text pages with their corresponding structMap//div's ID (METS) or Range / Manifest / Sequence ID (IIIF) as array key
* @property-read string $recordId the METS file's / IIIF manifest's record identifier
* @property-read int $rootId this holds the UID of the root document or zero if not multi-volumed
* @property-read array $smLinks this holds the smLinks between logical and physical structMap
* @property-read array<string, mixed[]> $smLinks this holds the smLinks between logical and physical structMap
* @property bool $smLinksLoaded flag with information if the smLinks are loaded
* @property-read array $tableOfContents this holds the logical structure
* @property-read array<int, mixed[]> $tableOfContents this holds the logical structure
* @property bool $tableOfContentsLoaded flag with information if the table of contents is loaded
* @property-read string $thumbnail this holds the document's thumbnail location
* @property bool $thumbnailLoaded flag with information if the thumbnail is loaded
Expand Down Expand Up @@ -88,7 +87,7 @@ abstract class AbstractDocument

/**
* @access protected
* @var mixed[] Additional information about files (e.g., ADMID), indexed by ID.
* @var array<string, array<string, string>> Additional information about files (e.g., ADMID), indexed by ID.
*/
protected array $fileInfos = [];

Expand Down Expand Up @@ -319,7 +318,7 @@ abstract public function getDownloadLocation(string $id): string;
*
* @param string $id The "@ID" attribute of the file node (METS) or the "@id" property of the IIIF resource
*
* @return mixed[]|null The set of file information
* @return array<string, string>|null The set of file information
*/
abstract public function getFileInfo(string $id): ?array;

Expand Down Expand Up @@ -852,7 +851,7 @@ protected function magicGetHasFulltext(): bool
*
* @access protected
*
* @return array<mixed, array<string, mixed[]>> Array of metadata with their corresponding logical structure node ID as key
* @return array<array<string, array<mixed>>|int> Array of metadata with their corresponding logical structure node ID as key
*/
protected function magicGetMetadataArray(): array
{
Expand Down
37 changes: 19 additions & 18 deletions Classes/Common/IiifManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@
* @access public
*
* @property int $configPid this holds the PID for the configuration
* @property-read array $formats this holds the configuration for all supported metadata encodings
* @property-read array<string, array<string, string>> $formats this holds the configuration for all supported metadata encodings
* @property bool $formatsLoaded flag with information if the available metadata formats are loaded
* @property-read bool $hasFulltext flag with information if there are any fulltext files available
* @property array $lastSearchedPhysicalPage the last searched logical and physical page
* @property array $logicalUnits this holds the logical units
* @property-read array $metadataArray this holds the documents' parsed metadata array
* @property array<string, mixed> $lastSearchedPhysicalPage the last searched logical and physical page
* @property mixed[] $logicalUnits this holds the logical units
* @property-read mixed[] $metadataArray this holds the documents' parsed metadata array
* @property bool $metadataArrayLoaded flag with information if the metadata array is loaded
* @property-read int $numPages the holds the total number of pages
* @property-read int $parentId this holds the UID of the parent document or zero if not multi-volumed
* @property-read array $physicalStructure this holds the physical structure
* @property-read array $physicalStructureInfo this holds the physical structure metadata
* @property-read mixed[] $physicalStructure this holds the physical structure
* @property-read mixed[] $physicalStructureInfo this holds the physical structure metadata
* @property bool $physicalStructureLoaded flag with information if the physical structure is loaded
* @property array $rawTextArray this holds the documents' raw text pages with their corresponding structMap//div's ID (METS) or Range / Manifest / Sequence ID (IIIF) as array key
* @property array<string, string> $rawTextArray this holds the documents' raw text pages with their corresponding structMap//div's ID (METS) or Range / Manifest / Sequence ID (IIIF) as array key
* @property-read string $recordId the METS file's / IIIF manifest's record identifier
* @property-read int $rootId this holds the UID of the root document or zero if not multi-volumed
* @property-read array $smLinks this holds the smLinks between logical and physical structMap
* @property-read array<string, mixed[]> $smLinks this holds the smLinks between logical and physical structMap
* @property bool $smLinksLoaded flag with information if the smLinks are loaded
* @property-read array $tableOfContents this holds the logical structure
* @property-read array<int, mixed[]> $tableOfContents this holds the logical structure
* @property bool $tableOfContentsLoaded flag with information if the table of contents is loaded
* @property-read string $thumbnail this holds the document's thumbnail location
* @property bool $thumbnailLoaded flag with information if the thumbnail is loaded
Expand All @@ -68,8 +68,8 @@
* @property ManifestInterface $iiif a PHP object representation of a IIIF manifest
* @property string $iiifVersion 'IIIF1', 'IIIF2' or 'IIIF3', depending on the API $this->iiif conforms to
* @property bool $hasFulltextSet flag if document has already been analyzed for presence of the fulltext for the Solr index
* @property array $originalMetadataArray this holds the original manifest's parsed metadata array with their corresponding resource (Manifest / Sequence / Range) ID as array key
* @property array $mimeTypes this holds the mime types of linked resources in the manifest (extracted during parsing) for later us
* @property mixed[] $originalMetadataArray this holds the original manifest's parsed metadata array with their corresponding resource (Manifest / Sequence / Range) ID as array key
* @property mixed[] $mimeTypes this holds the mime types of linked resources in the manifest (extracted during parsing) for later us
*
*/
final class IiifManifest extends AbstractDocument
Expand Down Expand Up @@ -385,14 +385,15 @@ public function getLogicalStructure(string $id, bool $recursive = false): array
}

if (!empty($logUnits[0])) {
/** @var IiifResourceInterface[] $logUnits */
if (!$recursive) {
$details = $this->getLogicalStructureInfo($logUnits[0]); // @phpstan-ignore-line
$details = $this->getLogicalStructureInfo($logUnits[0]);
} else {
// cache the ranges - they might occur multiple times in the structures "tree" - with full data as well as referenced as id
$processedStructures = [];
foreach ($logUnits as $logUnit) {
if (!array_search($logUnit->getId(), $processedStructures)) { // @phpstan-ignore-line
$this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, true, $processedStructures); // @phpstan-ignore-line
if (!array_search($logUnit->getId(), $processedStructures)) {
$this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, true, $processedStructures);
}
}
}
Expand All @@ -409,7 +410,7 @@ public function getLogicalStructure(string $id, bool $recursive = false): array
* @param bool $recursive Whether to include the child elements
* @param mixed[] $processedStructures IIIF resources that already have been processed
*
* @return array<string, string> Logical structure array
* @return array<string, array|string> Logical structure array
*/
protected function getLogicalStructureInfo(IiifResourceInterface $resource, bool $recursive = false, array &$processedStructures = []): array
{
Expand Down Expand Up @@ -462,7 +463,7 @@ protected function getLogicalStructureInfo(IiifResourceInterface $resource, bool
*
* @access private
*
* @param array<string, string> $details Logical structure array to which the start canvas info should be applied
* @param array<string, mixed> $details Logical structure array to which the start canvas info should be applied
* @param IiifResourceInterface $resource IIIF resource, either a manifest or range, for which the start canvas info should be applied
*
* @return void
Expand All @@ -486,7 +487,7 @@ private function applyStartCanvasInfo(array &$details, IiifResourceInterface $re
*
* @access private
*
* @param array<string, string> $details Logical structure array to which the children should be added
* @param array<string, mixed> $details Logical structure array to which the children should be added
* @param ManifestInterface $resource IIIF manifest resource for which the children should be added
* @param mixed[] $processedStructures IIIF resources that already have been processed
*
Expand Down Expand Up @@ -520,7 +521,7 @@ private function addChildrenFromManifest(array &$details, ManifestInterface $res
*
* @access private
*
* @param array<string, string> $details Logical structure array to which the children should be added
* @param array<string, mixed> $details Logical structure array to which the children should be added
* @param RangeInterface $resource IIIF range resource for which the children should be added
* @param mixed[] $processedStructures IIIF resources that already have been processed
*
Expand Down
Loading
Loading