diff --git a/composer.json b/composer.json index 6112fb9d36..16d97e87e7 100644 --- a/composer.json +++ b/composer.json @@ -20,12 +20,12 @@ "ezyang/htmlpurifier": "^4.11", "fmizzell/maquina": "^1.1.1", "fylax/forceutf8": "^3.0", - "getdkan/contracts": "^1.1.3", - "getdkan/csv-parser": "^1.3.2", - "getdkan/file-fetcher": "^5.0.4", - "getdkan/harvest": "^1.0.4", + "getdkan/contracts": "^1.2.0", + "getdkan/csv-parser": "^1.3.3", + "getdkan/file-fetcher": "^5.0.5", + "getdkan/harvest": "^1.0.5", "getdkan/pdlt": "^0.1.7", - "getdkan/procrastinator": "^5.0.2", + "getdkan/procrastinator": "^5.0.3", "getdkan/rooted-json-data": "^0.2.2", "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", "ilbee/csv-response": "^1.2.0", diff --git a/modules/common/src/Storage/DatabaseTableInterface.php b/modules/common/src/Storage/DatabaseTableInterface.php index a00741e2cd..a59e11caf0 100644 --- a/modules/common/src/Storage/DatabaseTableInterface.php +++ b/modules/common/src/Storage/DatabaseTableInterface.php @@ -2,17 +2,22 @@ namespace Drupal\common\Storage; +use Contracts\BulkRetrieverInterface; +use Contracts\BulkStorerInterface; use Contracts\RemoverInterface; use Contracts\RetrieverInterface; use Contracts\StorerInterface; -use Contracts\BulkRetrieverInterface; -use Contracts\BulkStorerInterface; -use Contracts\CountableInterface; /** * Databaset table interface. */ -interface DatabaseTableInterface extends StorerInterface, RetrieverInterface, RemoverInterface, BulkStorerInterface, CountableInterface, BulkRetrieverInterface { +interface DatabaseTableInterface extends + BulkRetrieverInterface, + BulkStorerInterface, + \Countable, + RemoverInterface, + RetrieverInterface, + StorerInterface { /** * Remove the table from the database. diff --git a/modules/common/src/Storage/Query.php b/modules/common/src/Storage/Query.php index a18d330d1b..a1f2bff459 100644 --- a/modules/common/src/Storage/Query.php +++ b/modules/common/src/Storage/Query.php @@ -2,19 +2,22 @@ namespace Drupal\common\Storage; -use Contracts\SorterInterface; use Contracts\ConditionerInterface; -use Contracts\OffsetterInterface; use Contracts\LimiterInterface; +use Contracts\OffsetterInterface; +use Contracts\SorterInterface; /** * DKAN API Query data object. + * + * @todo Should we remove these external interfaces and only declare + * QueryInterface? */ class Query implements - SorterInterface, ConditionerInterface, + LimiterInterface, OffsetterInterface, - LimiterInterface { + SorterInterface { /** * The collection of records (usually, a database table) to query against. @@ -135,7 +138,7 @@ public function filterByProperty($property) { * @param string $value * Property value to filter against. * @param bool $case - * Case sensitive filter? + * Case-sensitive filter? */ public function conditionByIsEqualTo(string $property, string $value, bool $case = FALSE) { $this->conditions[] = (object) [ diff --git a/modules/common/tests/src/Traits/CleanUp.php b/modules/common/tests/src/Traits/CleanUp.php index 7e6b16c6ae..9dec1c7d1d 100644 --- a/modules/common/tests/src/Traits/CleanUp.php +++ b/modules/common/tests/src/Traits/CleanUp.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\common\Traits; use Drupal\node\Entity\Node; -use FileFetcher\FileFetcher; /** * @deprecated Will be removed in a future version of DKAN. diff --git a/modules/common/tests/src/Unit/DkanApiDocsGeneratorTest.php b/modules/common/tests/src/Unit/DkanApiDocsGeneratorTest.php index ab1eb0948a..90e5dd5b6e 100644 --- a/modules/common/tests/src/Unit/DkanApiDocsGeneratorTest.php +++ b/modules/common/tests/src/Unit/DkanApiDocsGeneratorTest.php @@ -6,7 +6,6 @@ use Drupal\common\DkanApiDocsGenerator; use Drupal\common\Plugin\DkanApiDocsBase; use Drupal\common\Plugin\DkanApiDocsPluginManager; -use Drupal\common\Plugin\OpenApiSpec; use MockChain\Chain; use PHPUnit\Framework\TestCase; diff --git a/modules/data_dictionary_widget/data_dictionary_widget.module b/modules/data_dictionary_widget/data_dictionary_widget.module index f6a6f7a64a..07c9f721c9 100644 --- a/modules/data_dictionary_widget/data_dictionary_widget.module +++ b/modules/data_dictionary_widget/data_dictionary_widget.module @@ -4,7 +4,7 @@ * @file * Module for creating Data Dictionary Widget. */ - +use Drupal\Core\Entity\EntityFormInterface; use Drupal\Core\Entity\Display\EntityFormDisplayInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; @@ -77,7 +77,7 @@ function data_dictionary_widget_form_alter(&$form, &$form_state, $form_id) { $formObject = $form_state->getFormObject(); $target_form_ids = ['node_data_edit_form', 'node_data_form']; - if ($formObject instanceof \Drupal\Core\Entity\EntityFormInterface && in_array($form_id, $target_form_ids)) { + if ($formObject instanceof EntityFormInterface && in_array($form_id, $target_form_ids)) { $entity = $formObject->getEntity(); $data_type = $entity->get('field_data_type')->value; if (isset($form["field_json_metadata"]["widget"][0]["dictionary_fields"])) { diff --git a/modules/datastore/src/Plugin/QueueWorker/ImportJob.php b/modules/datastore/src/Plugin/QueueWorker/ImportJob.php index 22c8c61504..e0b20deda0 100644 --- a/modules/datastore/src/Plugin/QueueWorker/ImportJob.php +++ b/modules/datastore/src/Plugin/QueueWorker/ImportJob.php @@ -2,11 +2,11 @@ namespace Drupal\datastore\Plugin\QueueWorker; -use Contracts\ParserInterface; +use CsvParser\Parser\ParserInterface; use Drupal\common\Storage\DatabaseTableInterface; +use ForceUTF8\Encoding; use Procrastinator\Job\AbstractPersistentJob; use Procrastinator\Result; -use ForceUTF8\Encoding; /** * Procrastinator job for importing to the datastore. @@ -82,7 +82,7 @@ class ImportJob extends AbstractPersistentJob { /** * Parser object. * - * @var \Contracts\ParserInterface + * @var \CsvParser\Parser\ParserInterface */ protected $parser; @@ -378,7 +378,7 @@ protected function assertUniqueHeaders(array $header) { /** * Get the parser object. * - * @return \Contracts\ParserInterface + * @return \CsvParser\Parser\ParserInterface * Parser object. */ public function getParser(): ParserInterface { diff --git a/modules/datastore/tests/src/Kernel/Service/Info/ImportInfoListTest.php b/modules/datastore/tests/src/Kernel/Service/Info/ImportInfoListTest.php index 5031f6f9a3..3414f59272 100644 --- a/modules/datastore/tests/src/Kernel/Service/Info/ImportInfoListTest.php +++ b/modules/datastore/tests/src/Kernel/Service/Info/ImportInfoListTest.php @@ -6,7 +6,6 @@ use Drupal\common\Storage\FileFetcherJobStoreFactory; use Drupal\datastore\Plugin\QueueWorker\ImportJob; use Drupal\common\Storage\JobStore; -use Drupal\common\Storage\JobStoreFactory; use Drupal\datastore\Service\Info\ImportInfo; use Drupal\KernelTests\KernelTestBase; use Drupal\metastore\ResourceMapper; diff --git a/modules/datastore/tests/src/Unit/Plugin/QueueWorker/ImportJobTest.php b/modules/datastore/tests/src/Unit/Plugin/QueueWorker/ImportJobTest.php index 4e2e77e65c..3b1336852c 100644 --- a/modules/datastore/tests/src/Unit/Plugin/QueueWorker/ImportJobTest.php +++ b/modules/datastore/tests/src/Unit/Plugin/QueueWorker/ImportJobTest.php @@ -2,14 +2,14 @@ namespace Drupal\Tests\datastore\Unit\Plugin\QueueWorker; -use Contracts\ParserInterface; -use CsvParser\Parser\Csv; use Contracts\Mock\Storage\Memory; +use CsvParser\Parser\Csv; +use CsvParser\Parser\ParserInterface; +use Drupal\common\Storage\DatabaseTableInterface; use Drupal\datastore\DatastoreResource; use Drupal\datastore\Plugin\QueueWorker\ImportJob; -use Drupal\common\Storage\DatabaseTableInterface; -use Procrastinator\Result; use PHPUnit\Framework\TestCase; +use Procrastinator\Result; /** * Unit tests for Importer class. diff --git a/modules/datastore/tests/src/Unit/Service/Info/ImportInfoTest.php b/modules/datastore/tests/src/Unit/Service/Info/ImportInfoTest.php index a9d10c63f6..f1b65030d1 100644 --- a/modules/datastore/tests/src/Unit/Service/Info/ImportInfoTest.php +++ b/modules/datastore/tests/src/Unit/Service/Info/ImportInfoTest.php @@ -4,21 +4,13 @@ use Contracts\Mock\Storage\Memory; use CsvParser\Parser\Csv; -use Drupal\common\FileFetcher\FileFetcherFactory; use Drupal\datastore\DatastoreResource; use Drupal\datastore\Plugin\QueueWorker\ImportJob; -use Drupal\common\Storage\JobStore; -use Drupal\common\Storage\JobStoreFactory; use Drupal\datastore\Service\Info\ImportInfo; -use Drupal\datastore\Service\Info\ImportInfoList; use Drupal\Tests\datastore\Unit\Plugin\QueueWorker\TestMemStorage; use FileFetcher\FileFetcher; -use MockChain\Chain; -use MockChain\Options; use PHPUnit\Framework\TestCase; use Procrastinator\Job\Job; -use Procrastinator\Result; -use Symfony\Component\DependencyInjection\Container; /** * @coversDefaultClass \Drupal\datastore\Service\Info\ImportInfo diff --git a/modules/datastore/tests/src/Unit/Service/ResourceLocalizerTest.php b/modules/datastore/tests/src/Unit/Service/ResourceLocalizerTest.php index 46cbb0b064..50479311f8 100644 --- a/modules/datastore/tests/src/Unit/Service/ResourceLocalizerTest.php +++ b/modules/datastore/tests/src/Unit/Service/ResourceLocalizerTest.php @@ -7,7 +7,6 @@ use Drupal\common\FileFetcher\FileFetcherFactory; use Drupal\common\Storage\DatabaseTableInterface; use Drupal\common\Storage\FileFetcherJobStoreFactory; -use Drupal\common\Storage\JobStoreFactory; use Drupal\common\Util\DrupalFiles; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\File\FileSystem; diff --git a/modules/datastore/tests/src/Unit/Storage/DatabaseTableFactoryTest.php b/modules/datastore/tests/src/Unit/Storage/DatabaseTableFactoryTest.php index a09f7c8701..614d60e5f7 100644 --- a/modules/datastore/tests/src/Unit/Storage/DatabaseTableFactoryTest.php +++ b/modules/datastore/tests/src/Unit/Storage/DatabaseTableFactoryTest.php @@ -6,7 +6,6 @@ use Drupal\datastore\DatastoreResource; use Drupal\datastore\Storage\DatabaseTable; use Drupal\datastore\Storage\DatabaseTableFactory; -use Drupal\indexer\IndexManager; use MockChain\Chain; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; diff --git a/modules/harvest/src/Storage/HarvestHashesEntityDatabaseTable.php b/modules/harvest/src/Storage/HarvestHashesEntityDatabaseTable.php index dbde79dbef..415bd764be 100644 --- a/modules/harvest/src/Storage/HarvestHashesEntityDatabaseTable.php +++ b/modules/harvest/src/Storage/HarvestHashesEntityDatabaseTable.php @@ -122,7 +122,7 @@ public function store($data, string $id = NULL) : string { * @param string $id * Dataset node UUID. * - * @return \Contracts\HydratableInterface|string|null + * @return \Procrastinator\HydratableInterface * JSON-encoded result of query. */ public function retrieve(string $id) { diff --git a/modules/metastore/modules/metastore_search/tests/src/Unit/Plugin/search_api/datasource/DkanDatasetTest.php b/modules/metastore/modules/metastore_search/tests/src/Unit/Plugin/search_api/datasource/DkanDatasetTest.php index e436bf48d2..77f71bf011 100644 --- a/modules/metastore/modules/metastore_search/tests/src/Unit/Plugin/search_api/datasource/DkanDatasetTest.php +++ b/modules/metastore/modules/metastore_search/tests/src/Unit/Plugin/search_api/datasource/DkanDatasetTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\metastore_search\Unit\Plugin\search_api\datasource; -use _PHPStan_7d6f0f6a4\Psr\Container\ContainerInterface; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeManager; diff --git a/modules/metastore/src/Controller/MetastoreRevisionController.php b/modules/metastore/src/Controller/MetastoreRevisionController.php index 2f3f19f257..6bee93772a 100644 --- a/modules/metastore/src/Controller/MetastoreRevisionController.php +++ b/modules/metastore/src/Controller/MetastoreRevisionController.php @@ -2,14 +2,14 @@ namespace Drupal\metastore\Controller; -use Contracts\FactoryInterface as ContractsFactoryInterface; -use Drupal\common\JsonResponseTrait; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Contracts\FactoryInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\RevisionLogInterface; +use Drupal\common\JsonResponseTrait; use Drupal\metastore\Exception\MissingObjectException; use Drupal\metastore\MetastoreApiResponse; use Drupal\metastore\Storage\MetastoreEntityStorageInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** @@ -53,7 +53,7 @@ class MetastoreRevisionController implements ContainerInjectionInterface { * * @var \Contracts\FactoryInterface */ - private ContractsFactoryInterface $storageFactory; + private FactoryInterface $storageFactory; /** * Inherited. @@ -72,7 +72,7 @@ public static function create(ContainerInterface $container) { */ public function __construct( MetastoreApiResponse $apiResponse, - ContractsFactoryInterface $storageFactory + FactoryInterface $storageFactory ) { $this->apiResponse = $apiResponse; $this->storageFactory = $storageFactory; diff --git a/modules/metastore/tests/src/Unit/Commands/MetastoreCommandsTest.php b/modules/metastore/tests/src/Unit/Commands/MetastoreCommandsTest.php index 94205d5584..9c5fe47408 100644 --- a/modules/metastore/tests/src/Unit/Commands/MetastoreCommandsTest.php +++ b/modules/metastore/tests/src/Unit/Commands/MetastoreCommandsTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\metastore\Unit\Commands; -use Drupal\Core\Logger\LoggerChannel; use Drupal\metastore\Commands\MetastoreCommands; use Drupal\metastore\Storage\Data; use Drupal\metastore\Storage\DataFactory; diff --git a/modules/metastore/tests/src/Unit/MetastoreSubscriberTest.php b/modules/metastore/tests/src/Unit/MetastoreSubscriberTest.php index 7e090743d5..8ebee95a2c 100644 --- a/modules/metastore/tests/src/Unit/MetastoreSubscriberTest.php +++ b/modules/metastore/tests/src/Unit/MetastoreSubscriberTest.php @@ -9,7 +9,6 @@ use Drupal\common\DataResource; use Drupal\common\Events\Event; -use Drupal\common\Storage\JobStore; use Drupal\metastore\EventSubscriber\MetastoreSubscriber; use Drupal\metastore\MetastoreService; use Drupal\metastore\ReferenceLookupInterface; diff --git a/phpunit.xml b/phpunit.xml index 170850e1e4..7b692074e7 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -63,5 +63,6 @@ +