Skip to content

Commit

Permalink
[TASK] remove scrutinizer static analyse fixes from sources
Browse files Browse the repository at this point in the history
Relates: #3639
  • Loading branch information
dkd-kaehm authored and dkd-friedrich committed Feb 29, 2024
1 parent 3bfdb1c commit c6f7935
Show file tree
Hide file tree
Showing 65 changed files with 74 additions and 226 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Expand Up @@ -3,7 +3,6 @@
/.dockerignore export-ignore
/.gitattributes export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/.styleci.yml export-ignore
/Dockerfile export-ignore
/CONTRIBUTING.md export-ignore
40 changes: 3 additions & 37 deletions .scrutinizer.yml
Expand Up @@ -9,7 +9,7 @@ filter:

tools:
php_cpd:
enabled: true
enabled: false

# we do this on GitHub-Actions via typo3/coding-standards
php_code_sniffer:
Expand All @@ -19,45 +19,11 @@ tools:
enabled: false

php_mess_detector:
enabled: true
config:
controversial_rules:
superglobals: false
enabled: false

php_pdepend:
enabled: true

php_analyzer:
enabled: true
dependency_paths:
- 'Resources/Private/Php/*'
enabled: false

external_code_coverage:
runs: 2
timeout: 2400

checks:
php:
excluded_dependencies:
- typo3/cms-install
avoid_superglobals: false

build_failure_conditions:
- 'patches.label("Doc Comments").count > 10'
- 'patches.label("Spacing").count > 15'
- 'issues.label("coding-style").count > 10'
- 'issues.severity(>= MAJOR).count > 260'
- 'project.metric("scrutinizer.quality", < 8)'
- 'project.metric_change("scrutinizer.test_coverage", < -0.10)'


build:
environment:
php:
# We want to test with the smallest supported TYPO3 PHP version
version: 7.4
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
4 changes: 1 addition & 3 deletions Classes/Access/Rootline.php
Expand Up @@ -84,7 +84,7 @@ public function __construct(string $accessRootline = null)
$rawRootlineElements = explode(self::ELEMENT_DELIMITER, $accessRootline);
foreach ($rawRootlineElements as $rawRootlineElement) {
try {
$this->push(GeneralUtility::makeInstance(RootlineElement::class, /** @scrutinizer ignore-type */ $rawRootlineElement));
$this->push(GeneralUtility::makeInstance(RootlineElement::class, $rawRootlineElement));
} catch (RootlineElementFormatException $e) {
// just ignore the faulty element for now, might log this later
}
Expand Down Expand Up @@ -148,7 +148,6 @@ public static function getAccessRootlineByPageId(
) {
$accessRootline->push(GeneralUtility::makeInstance(
RootlineElement::class,
/** @scrutinizer ignore-type */
$pageRecord['uid'] . RootlineElement::PAGE_ID_GROUP_DELIMITER . $pageRecord['fe_group']
));
}
Expand All @@ -162,7 +161,6 @@ public static function getAccessRootlineByPageId(
if ($currentPageRecord['fe_group']) {
$accessRootline->push(GeneralUtility::makeInstance(
RootlineElement::class,
/** @scrutinizer ignore-type */
$currentPageRecord['uid'] . RootlineElement::PAGE_ID_GROUP_DELIMITER . $currentPageRecord['fe_group']
));
}
Expand Down
2 changes: 0 additions & 2 deletions Classes/ConnectionManager.php
Expand Up @@ -281,9 +281,7 @@ protected function buildNoConnectionException(string $message): NoSolrConnection
/* @var NoSolrConnectionFoundException $noSolrConnectionException */
return GeneralUtility::makeInstance(
NoSolrConnectionFoundException::class,
/** @scrutinizer ignore-type */
$message,
/** @scrutinizer ignore-type */
1575396474
);
}
Expand Down
3 changes: 0 additions & 3 deletions Classes/ContentObject/Classification.php
Expand Up @@ -97,11 +97,8 @@ protected function buildClassificationsFromConfiguration(array $configuredMapped
$className = $class['class'];
$classifications[] = GeneralUtility::makeInstance(
ClassificationItem::class,
/** @scrutinizer ignore-type */
$matchPatterns,
/** @scrutinizer ignore-type */
$unMatchPatters,
/** @scrutinizer ignore-type */
$className
);
}
Expand Down
1 change: 0 additions & 1 deletion Classes/ContentObject/Content.php
Expand Up @@ -42,7 +42,6 @@ public function render($conf = [])
{
$contentExtractor = GeneralUtility::makeInstance(
HtmlContentExtractor::class,
/** @scrutinizer ignore-type */
$this->getRawContent($this->cObj, $conf)
);

Expand Down
8 changes: 4 additions & 4 deletions Classes/ContentObject/Relation.php
Expand Up @@ -142,11 +142,11 @@ protected function getRelatedItems(ContentObjectRenderer $parentContentObject):
$uid = (int)$uid;
$field = $this->configuration['localField'];

if (!$this->tcaService->/** @scrutinizer ignore-call */ getHasConfigurationForField($table, $field)) {
if (!$this->tcaService->getHasConfigurationForField($table, $field)) {
return [];
}

$overlayUid = $this->frontendOverlayService->/** @scrutinizer ignore-call */ getUidOfOverlay($table, $field, $uid);
$overlayUid = $this->frontendOverlayService->getUidOfOverlay($table, $field, $uid);
$fieldTCA = $this->tcaService->getConfigurationForField($table, $field);

if (isset($fieldTCA['config']['MM']) && trim($fieldTCA['config']['MM']) !== '') {
Expand Down Expand Up @@ -398,7 +398,7 @@ protected function getRelatedRecords(string $foreignTable, int ...$uids): array
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($foreignTable);
$queryBuilder->select('*')
->from($foreignTable)
->where(/** @scrutinizer ignore-type */ $queryBuilder->expr()->in('uid', $uids));
->where($queryBuilder->expr()->in('uid', $uids));
if (isset($this->configuration['additionalWhereClause'])) {
$queryBuilder->andWhere($this->configuration['additionalWhereClause']);
}
Expand Down Expand Up @@ -437,7 +437,7 @@ protected function sortByKeyInIN(Statement $statement, string $columnName, ...$a
*/
protected function getLanguageUid(): int
{
return (int)$this->typoScriptFrontendController->/** @scrutinizer ignore-call */ getContext()->getPropertyFromAspect('language', 'id');
return (int)$this->typoScriptFrontendController->getContext()->getPropertyFromAspect('language', 'id');
}

/**
Expand Down
6 changes: 2 additions & 4 deletions Classes/Controller/AbstractBaseController.php
Expand Up @@ -232,9 +232,7 @@ protected function initializeSearch()
/** @noinspection PhpParamsInspection */
$this->searchService = $this->objectManager->get(
SearchResultSetService::class,
/** @scrutinizer ignore-type */
$this->typoScriptConfiguration,
/** @scrutinizer ignore-type */
$search
);
} catch (NoSolrConnectionFoundException $e) {
Expand All @@ -248,7 +246,7 @@ protected function initializeSearch()
protected function getSearchRequestBuilder(): SearchRequestBuilder
{
if ($this->searchRequestBuilder === null) {
$this->searchRequestBuilder = GeneralUtility::makeInstance(SearchRequestBuilder::class, /** @scrutinizer ignore-type */ $this->typoScriptConfiguration);
$this->searchRequestBuilder = GeneralUtility::makeInstance(SearchRequestBuilder::class, $this->typoScriptConfiguration);
}

return $this->searchRequestBuilder;
Expand All @@ -261,7 +259,7 @@ protected function logSolrUnavailable()
{
if ($this->typoScriptConfiguration->getLoggingExceptions()) {
/** @var SolrLogManager $logger */
$logger = GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$logger = GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__);
$logger->log(SolrLogManager::ERROR, 'Solr server is not available');
}
}
Expand Down
Expand Up @@ -102,7 +102,7 @@ protected function canQueueSelectedSite(): bool
*/
protected function getIndexQueueInitializationSelector(): string
{
$selector = GeneralUtility::makeInstance(IndexingConfigurationSelectorField::class, /** @scrutinizer ignore-type */ $this->selectedSite);
$selector = GeneralUtility::makeInstance(IndexingConfigurationSelectorField::class, $this->selectedSite);
$selector->setFormElementName('tx_solr-index-queue-initialization');

return $selector->render();
Expand Down Expand Up @@ -240,7 +240,7 @@ public function showErrorAction(int $indexQueueItemId): ResponseInterface
public function doIndexingRunAction(): ResponseInterface
{
/* @var IndexService $indexService */
$indexService = GeneralUtility::makeInstance(IndexService::class, /** @scrutinizer ignore-type */ $this->selectedSite);
$indexService = GeneralUtility::makeInstance(IndexService::class, $this->selectedSite);
$indexWithoutErrors = $indexService->indexItems(1);

$label = 'solr.backend.index_queue_module.flashmessage.success.index_manual';
Expand Down
3 changes: 0 additions & 3 deletions Classes/Controller/SuggestController.php
Expand Up @@ -54,11 +54,8 @@ public function suggestAction(string $queryString, ?string $callback = null, ?ar
/** @var SuggestService $suggestService */
$suggestService = GeneralUtility::makeInstance(
SuggestService::class,
/** @scrutinizer ignore-type */
$this->typoScriptFrontendController,
/** @scrutinizer ignore-type */
$this->searchService,
/** @scrutinizer ignore-type */
$this->typoScriptConfiguration
);

Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Index/IndexService.php
Expand Up @@ -78,7 +78,7 @@ public function __construct(
$this->site = $site;
$this->indexQueue = $queue ?? GeneralUtility::makeInstance(Queue::class);
$this->signalSlotDispatcher = $dispatcher ?? GeneralUtility::makeInstance(Dispatcher::class);
$this->logger = $solrLogManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->logger = $solrLogManager ?? GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__);
}

/**
Expand Down Expand Up @@ -237,7 +237,7 @@ protected function getIndexerByItem(
$indexerClass = $configuration->getIndexQueueIndexerByConfigurationName($indexingConfigurationName);
$indexerConfiguration = $configuration->getIndexQueueIndexerConfigurationByConfigurationName($indexingConfigurationName);

$indexer = GeneralUtility::makeInstance($indexerClass, /** @scrutinizer ignore-type */ $indexerConfiguration);
$indexer = GeneralUtility::makeInstance($indexerClass, $indexerConfiguration);
if (!($indexer instanceof Indexer)) {
throw new RuntimeException(
'The indexer class "' . $indexerClass . '" for indexing configuration "' . $indexingConfigurationName . '" is not a valid indexer. Must be a subclass of ApacheSolrForTypo3\Solr\IndexQueue\Indexer.',
Expand Down
Expand Up @@ -41,7 +41,7 @@ abstract class AbstractUriStrategy
public function __construct(
SolrLogManager $logger = null
) {
$this->logger = $logger ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->logger = $logger ?? GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__);
}

/**
Expand Down
Expand Up @@ -151,7 +151,7 @@ protected function deleteRecordInAllSolrConnections(
$response = $solr->getWriteService()->deleteByQuery($query);

if ($response->getHttpStatus() !== 200) {
$logger = GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$logger = GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__);
$logger->log(
SolrLogManager::ERROR,
'Couldn\'t delete index document',
Expand Down
Expand Up @@ -47,12 +47,10 @@ public function removeByRootPidAndIndexQueueUid(int $rootPid, int $indexQueueUid
return (int)$queryBuilder
->delete($this->table)
->where(
/** @scrutinizer ignore-type */
$queryBuilder->expr()->eq(
'root',
$queryBuilder->createNamedParameter($rootPid, PDO::PARAM_INT)
),
/** @scrutinizer ignore-type */
$queryBuilder->expr()->eq(
'item_id',
$queryBuilder->createNamedParameter($indexQueueUid, PDO::PARAM_INT)
Expand Down Expand Up @@ -86,7 +84,6 @@ public function findAllByIndexQueueUid(int $indexQueueUid): array
->select('property_key', 'property_value')
->from($this->table)
->where(
/** @scrutinizer ignore-type */
$queryBuilder->expr()->eq(
'item_id',
$queryBuilder->createNamedParameter($indexQueueUid, PDO::PARAM_INT)
Expand Down

0 comments on commit c6f7935

Please sign in to comment.