From e9cabc27bc7788ac94fce757caae1cf18ed232ba Mon Sep 17 00:00:00 2001 From: Liam Morland <lkmorlan@uwaterloo.ca> Date: Fri, 3 Apr 2020 16:48:10 -0400 Subject: [PATCH] Coding standards --- README.txt | 3 ++- fillpdf.module | 6 ++++-- modules/fillpdf_legacy/fillpdf_legacy.module | 4 ++++ .../tests/Kernel/LegacyBackendTest.php | 3 +++ src/Component/Helper/FillPdfMappingHelper.php | 6 ++++-- src/Controller/HandlePdfController.php | 3 --- src/Entity/FillPdfFileContextViewsData.php | 5 +++-- src/Entity/FillPdfForm.php | 1 - src/EntityHelper.php | 7 ++++--- src/EntityHelperInterface.php | 5 +++-- src/FieldMapping.php | 2 ++ src/FieldMapping/TextFieldMapping.php | 3 +++ src/FillPdfAccessHelperInterface.php | 11 ++++++---- ...FillPdfFileContextAccessControlHandler.php | 18 ++++++++++++++--- src/FillPdfFormAccessControlHandler.php | 1 + src/FillPdfFormListBuilder.php | 20 +++++++++---------- src/FillPdfLinkManipulatorInterface.php | 4 ++-- src/Form/FillPdfAdminFormBase.php | 4 ++-- src/InputHelper.php | 4 ++-- src/Plugin/FillPdfActionPluginBase.php | 2 +- .../PdfBackend/FillPdfServicePdfBackend.php | 8 ++++++-- src/Serializer.php | 8 ++++---- src/Service/FillPdfContextManager.php | 3 +++ .../FillPdfBackend/TestFillPdfBackend.php | 2 +- .../Functional/FillPdfFormImportFormTest.php | 2 +- .../src/Functional/FillPdfUploadTestBase.php | 3 +-- tests/src/Functional/PdfPopulationTest.php | 11 +++++----- tests/src/Traits/TestFillPdfTrait.php | 2 +- .../FieldMapping/ImageFieldMappingTest.php | 6 ++++++ .../FieldMapping/TextFieldMappingTest.php | 6 ++++++ .../LinkManipulator/ParseEntityIdsTest.php | 8 ++++---- 31 files changed, 111 insertions(+), 60 deletions(-) diff --git a/README.txt b/README.txt index acf11fc..3a76142 100644 --- a/README.txt +++ b/README.txt @@ -1 +1,2 @@ -See the full documentation on drupal.org: http://drupal.org/documentation/modules/fillpdf +See the full documentation on drupal.org: +http://drupal.org/documentation/modules/fillpdf diff --git a/fillpdf.module b/fillpdf.module index ae77bd8..fc5b81a 100644 --- a/fillpdf.module +++ b/fillpdf.module @@ -5,6 +5,7 @@ * Allows mappings of PDFs to site content. */ +use Drupal\Core\Url; use Drupal\Core\Routing\RouteMatchInterface; /** @@ -14,15 +15,16 @@ function fillpdf_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { case 'help.page.fillpdf': $content = t('See the <a href=":documentation">documentation on drupal.org</a> for a full description of and guide to this module.', [ - ':documentation' => \Drupal\Core\Url::fromUri('https://www.drupal.org/docs/8/modules/fillpdf') + ':documentation' => Url::fromUri('https://www.drupal.org/docs/8/modules/fillpdf') ->toString(), ]); return $content; + case 'fillpdf.forms_admin': if (\Drupal::moduleHandler()->moduleExists('help')) { return t('See the <a href=":link">documentation</a> for an explanation on dowloading these forms to PDF', [ - ':link' => \Drupal\Core\Url::fromUri('https://www.drupal.org/docs/8/modules/fillpdf') + ':link' => Url::fromUri('https://www.drupal.org/docs/8/modules/fillpdf') ->toString(), ]); } diff --git a/modules/fillpdf_legacy/fillpdf_legacy.module b/modules/fillpdf_legacy/fillpdf_legacy.module index 2281e66..30540d2 100644 --- a/modules/fillpdf_legacy/fillpdf_legacy.module +++ b/modules/fillpdf_legacy/fillpdf_legacy.module @@ -1,5 +1,9 @@ <?php +/** + * @file + */ + use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; diff --git a/modules/fillpdf_legacy/tests/Kernel/LegacyBackendTest.php b/modules/fillpdf_legacy/tests/Kernel/LegacyBackendTest.php index 2c37481..8fbce3a 100644 --- a/modules/fillpdf_legacy/tests/Kernel/LegacyBackendTest.php +++ b/modules/fillpdf_legacy/tests/Kernel/LegacyBackendTest.php @@ -12,6 +12,9 @@ use Drupal\Tests\fillpdf\Kernel\FillPdfKernelTestBase; */ class LegacyBackendTest extends FillPdfKernelTestBase { + /** + * + */ public function testTestBackend() { $backend_manager = $this->container->get('plugin.manager.fillpdf.pdf_backend'); $test_backend = $backend_manager->createInstance('test'); diff --git a/src/Component/Helper/FillPdfMappingHelper.php b/src/Component/Helper/FillPdfMappingHelper.php index 611046e..3ba02d3 100644 --- a/src/Component/Helper/FillPdfMappingHelper.php +++ b/src/Component/Helper/FillPdfMappingHelper.php @@ -57,10 +57,12 @@ class FillPdfMappingHelper { * @return string * $value with any matching replacements applied. * - * @deprecated in fillpdf:8.x-4.7 and will be removed from fillpdf:8.x-5.0. + * @deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. + * Deprecated in core. + * @see https://www.drupal.org/project/fillpdf/issues/3044743 */ public static function transformString($value, array $form_replacements, array $field_replacements) { - @trigger_error('transformString is deprecated in fillpdf:8.x-4.7 and will be removed from fillpdf:8.x-5.0. See https://www.drupal.org/project/fillpdf/issues/3044743', E_USER_DEPRECATED); + @trigger_error('transformString is deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Deprecated in core. See https://www.drupal.org/project/fillpdf/issues/3044743', E_USER_DEPRECATED); // Merge both with field-level replacements taking precedence. $replacements = array_merge($form_replacements, $field_replacements); return isset($replacements[$value]) ? $replacements[$value] : $value; diff --git a/src/Controller/HandlePdfController.php b/src/Controller/HandlePdfController.php index eb27ec6..44ffc59 100644 --- a/src/Controller/HandlePdfController.php +++ b/src/Controller/HandlePdfController.php @@ -6,15 +6,12 @@ use Drupal\Core\Link; use Drupal\Core\Url; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\StreamWrapper\StreamWrapperInterface; -use Drupal\file\Entity\File; use Drupal\fillpdf\FillPdfContextManagerInterface; use Drupal\fillpdf\FillPdfFormInterface; use Drupal\fillpdf\FillPdfLinkManipulatorInterface; use Drupal\fillpdf\Service\BackendProxyInterface; use Drupal\fillpdf\TokenResolverInterface; -use Drupal\fillpdf\Component\Helper\FillPdfMappingHelper; use Drupal\fillpdf\Entity\FillPdfForm; -use Drupal\fillpdf\FieldMapping\TextFieldMapping; use Drupal\fillpdf\Plugin\FillPdfActionPluginManager; use Drupal\fillpdf\Plugin\PdfBackendManager; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Entity/FillPdfFileContextViewsData.php b/src/Entity/FillPdfFileContextViewsData.php index 976c586..526ac3f 100644 --- a/src/Entity/FillPdfFileContextViewsData.php +++ b/src/Entity/FillPdfFileContextViewsData.php @@ -9,17 +9,18 @@ use Drupal\views\EntityViewsDataInterface; * Provides Views data for FillPDF file context entities. */ class FillPdfFileContextViewsData extends EntityViewsData implements EntityViewsDataInterface { + /** * {@inheritdoc} */ public function getViewsData() { $data = parent::getViewsData(); - $data['fillpdf_file_context']['table']['base'] = array( + $data['fillpdf_file_context']['table']['base'] = [ 'field' => 'id', 'title' => $this->t('FillPDF file context'), 'help' => $this->t('The FillPDF file context ID.'), - ); + ]; return $data; } diff --git a/src/Entity/FillPdfForm.php b/src/Entity/FillPdfForm.php index 58e7379..f239a94 100644 --- a/src/Entity/FillPdfForm.php +++ b/src/Entity/FillPdfForm.php @@ -124,7 +124,6 @@ class FillPdfForm extends ContentEntityBase implements FillPdfFormInterface { ]); // @todo: add post_save_redirect field for where to send the browser by default after they generate a PDF - $fields['scheme'] = BaseFieldDefinition::create('list_string') ->setLabel('File storage') ->setSettings([ diff --git a/src/EntityHelper.php b/src/EntityHelper.php index 458ddfd..ae333a0 100644 --- a/src/EntityHelper.php +++ b/src/EntityHelper.php @@ -6,9 +6,10 @@ namespace Drupal\fillpdf; * Class EntityHelper. * * @package Drupal\fillpdf - * @deprecated This class and the 'fillpdf.entity_helper' service is deprecated - * in FillPDF 8.x-4.7 and will be removed before FillPDF 8.x-5.0. - * The getFormFields() method lives within the FillPdfForm entity now. + * @deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Applies + * to this class and the 'fillpdf.entity_helper' service. The getFormFields() + * method lives within the FillPdfForm entity now. + * @see https://www.drupal.org/project/fillpdf/issues/3046257 * @see \Drupal\fillpdf\Entity\FillPdfForm::getFormFields() */ class EntityHelper implements EntityHelperInterface { diff --git a/src/EntityHelperInterface.php b/src/EntityHelperInterface.php index 9eb0e7c..078d12c 100644 --- a/src/EntityHelperInterface.php +++ b/src/EntityHelperInterface.php @@ -6,7 +6,8 @@ namespace Drupal\fillpdf; * Interface EntityHelperInterface. * * @package Drupal\fillpdf - * @deprecated This interface and the 'fillpdf.entity_helper' service is - * deprecated in FillPDF 8.x-4.7 and will be removed before FillPDF 8.x-5.0. + * @deprecated in FillPDF 8.x-4.7 and is removed from FillPDF 8.x-5.0. Applies + * to this interface and the 'fillpdf.entity_helper' service. + * @see https://www.drupal.org/project/fillpdf/issues/3046257 */ interface EntityHelperInterface {} diff --git a/src/FieldMapping.php b/src/FieldMapping.php index 63c6ea2..056c50f 100644 --- a/src/FieldMapping.php +++ b/src/FieldMapping.php @@ -3,6 +3,8 @@ namespace Drupal\fillpdf; /** + * Represents a mapping between a PDF field and a merge value. + * * Represents a mapping between a PDF field and a merge value (a value with * which to fill in the field). This is a barebones base class intended to be * subclassed and enhanced with additional properties and getter methods. diff --git a/src/FieldMapping/TextFieldMapping.php b/src/FieldMapping/TextFieldMapping.php index 6fd4585..99dffac 100644 --- a/src/FieldMapping/TextFieldMapping.php +++ b/src/FieldMapping/TextFieldMapping.php @@ -24,7 +24,10 @@ final class TextFieldMapping extends FieldMapping { } /** + * Return parent::getData(). + * * @return string + * The return value of parent::getData(). */ public function __toString() { return parent::getData(); diff --git a/src/FillPdfAccessHelperInterface.php b/src/FillPdfAccessHelperInterface.php index 8d80126..730b569 100644 --- a/src/FillPdfAccessHelperInterface.php +++ b/src/FillPdfAccessHelperInterface.php @@ -2,7 +2,6 @@ namespace Drupal\fillpdf; -use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; @@ -19,11 +18,13 @@ interface FillPdfAccessHelperInterface { * Should ultimately pass control to self::canGeneratePdfFromContext(). * * @param string $url - * The root-relative FillPDF URL that would be used to generate the PDF. - * e.g. /fillpdf?fid=1&entity_type=node&entity_id=1 + * The root-relative FillPDF URL that would be used to generate the PDF. + * e.g. /fillpdf?fid=1&entity_type=node&entity_id=1. * @param \Drupal\Core\Session\AccountInterface $account + * The account. * * @return \Drupal\Core\Access\AccessResultInterface + * The access results. * * @see \Drupal\fillpdf\FillPdfAccessHelperInterface::canGeneratePdfFromContext() */ @@ -41,6 +42,7 @@ interface FillPdfAccessHelperInterface { * The user whose access is being checked. * * @return \Drupal\Core\Access\AccessResultInterface + * The access results. * * @see \Drupal\fillpdf\FillPdfAccessHelperInterface::canGeneratePdfFromContext() */ @@ -49,7 +51,7 @@ interface FillPdfAccessHelperInterface { /** * This is the main access checking function of this class. * - * self::canGeneratePdfFromLinkUrl() should delegate to this one. + * Method self::canGeneratePdfFromLinkUrl() should delegate to this one. * * @param array $context * As returned by FillPdfLinkManipulator's parse functions. @@ -57,6 +59,7 @@ interface FillPdfAccessHelperInterface { * The user whose access is being checked. * * @return \Drupal\Core\Access\AccessResultInterface + * The access results. * * @see \Drupal\fillpdf\FillPdfAccessHelperInterface::canGeneratePdfFromLink() */ diff --git a/src/FillPdfFileContextAccessControlHandler.php b/src/FillPdfFileContextAccessControlHandler.php index 61c7b12..28e21f0 100644 --- a/src/FillPdfFileContextAccessControlHandler.php +++ b/src/FillPdfFileContextAccessControlHandler.php @@ -17,15 +17,24 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class FillPdfFileContextAccessControlHandler extends EntityAccessControlHandler implements EntityHandlerInterface { - /** @var \Drupal\fillpdf\FillPdfAccessHelperInterface */ + /** + * @var \Drupal\fillpdf\FillPdfAccessHelperInterface + */ protected $accessHelper; - /** @var FillPdfLinkManipulatorInterface */ + /** + * @var FillPdfLinkManipulatorInterface + */ protected $linkManipulator; - /** @var FillPdfContextManagerInterface */ + /** + * @var FillPdfContextManagerInterface + */ protected $contextManager; + /** + * + */ public function __construct(EntityTypeInterface $entity_type, FillPdfAccessHelperInterface $access_helper, FillPdfLinkManipulatorInterface $link_manipulator, FillPdfContextManagerInterface $context_manager) { parent::__construct($entity_type); @@ -34,6 +43,9 @@ class FillPdfFileContextAccessControlHandler extends EntityAccessControlHandler $this->contextManager = $context_manager; } + /** + * + */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static($entity_type, $container->get('fillpdf.access_helper'), $container->get('fillpdf.link_manipulator'), $container->get('fillpdf.context_manager')); } diff --git a/src/FillPdfFormAccessControlHandler.php b/src/FillPdfFormAccessControlHandler.php index 80e2222..36d849a 100644 --- a/src/FillPdfFormAccessControlHandler.php +++ b/src/FillPdfFormAccessControlHandler.php @@ -24,6 +24,7 @@ class FillPdfFormAccessControlHandler extends EntityAccessControlHandler { case 'duplicate': case 'delete': return AccessResult::allowedIfHasPermission($account, 'administer pdfs'); + default: return AccessResult::neutral(); } diff --git a/src/FillPdfFormListBuilder.php b/src/FillPdfFormListBuilder.php index 363e817..4cbb6c7 100644 --- a/src/FillPdfFormListBuilder.php +++ b/src/FillPdfFormListBuilder.php @@ -24,20 +24,20 @@ class FillPdfFormListBuilder extends EntityListBuilder { public function getDefaultOperations(EntityInterface $entity) { $duplicate = [ - 'title' => t('Duplicate'), - 'weight' => 10, - 'url' => $this->ensureDestination($entity->toUrl('duplicate-form')), + 'title' => t('Duplicate'), + 'weight' => 10, + 'url' => $this->ensureDestination($entity->toUrl('duplicate-form')), ]; $export = [ - 'title' => t('Export configuration'), - 'weight' => 20, - 'url' => $this->ensureDestination($entity->toUrl('export-form')), + 'title' => t('Export configuration'), + 'weight' => 20, + 'url' => $this->ensureDestination($entity->toUrl('export-form')), ]; $import = [ - 'title' => t('Import configuration'), - 'weight' => 30, - 'url' => $this->ensureDestination($entity->toUrl('import-form')), - ]; + 'title' => t('Import configuration'), + 'weight' => 30, + 'url' => $this->ensureDestination($entity->toUrl('import-form')), + ]; $operations = parent::getDefaultOperations($entity) + [ 'duplicate' => $duplicate, diff --git a/src/FillPdfLinkManipulatorInterface.php b/src/FillPdfLinkManipulatorInterface.php index b17f670..991ec11 100644 --- a/src/FillPdfLinkManipulatorInterface.php +++ b/src/FillPdfLinkManipulatorInterface.php @@ -47,8 +47,8 @@ interface FillPdfLinkManipulatorInterface { * Parses a Url object. * * @param \Drupal\Core\Url $link - * The valid URL containing the FillPDF generation metadata. - * e.g. 'http://example.com/fillpdf?entity_ids[]=node:1&entity_ids[]=contact:7'. + * The valid URL containing the FillPDF generation metadata. e.g. + * 'http://example.com/fillpdf?entity_ids[]=node:1&entity_ids[]=contact:7'. * * @return array * An associative array representing the request context and containing the diff --git a/src/Form/FillPdfAdminFormBase.php b/src/Form/FillPdfAdminFormBase.php index c7b394c..f99a3f1 100644 --- a/src/Form/FillPdfAdminFormBase.php +++ b/src/Form/FillPdfAdminFormBase.php @@ -4,14 +4,14 @@ namespace Drupal\fillpdf\Form; use Drupal\Core\Form\FormBase; -@trigger_error('FillPdfAdminFormBase is deprecated in fillpdf:8.x-4.7 and will be removed from fillpdf:8.x-5.0. Use \Drupal\Core\Form\FormBase instead. See https://www.drupal.org/project/fillpdf/issues/3044743', E_USER_DEPRECATED); +@trigger_error('FillPdfAdminFormBase is deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Use \Drupal\Core\Form\FormBase instead. See https://www.drupal.org/project/fillpdf/issues/3044743', E_USER_DEPRECATED); /** * Class FillPdfAdminFormBase. * * @package Drupal\fillpdf\Form * - * @deprecated in fillpdf:8.x-4.7 and will be removed from fillpdf:8.x-5.0. Use + * @deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Use * FormBase instead. * @see https://www.drupal.org/project/fillpdf/issues/3044743 * @see \Drupal\Core\Form\FormBase diff --git a/src/InputHelper.php b/src/InputHelper.php index cbb9e72..11c86c8 100644 --- a/src/InputHelper.php +++ b/src/InputHelper.php @@ -119,13 +119,13 @@ class InputHelper implements InputHelperInterface { * @param \Drupal\file\FileInterface $file * The file object to save. * - * @deprecated in fillpdf:8.x-4.7 and will be removed from fillpdf:8.x-5.0. + * @deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. * Use FileInterface::setPermanent() and FileInterface::save() instead. * @see https://www.drupal.org/project/fillpdf/issues/3055123 * @see \Drupal\file\FileInterface */ protected function saveFileUpload(FileInterface $file) { - @trigger_error('InputHelper::saveFileUpload() is deprecated in fillpdf:8.x-4.7 and will be removed before fillpdf:8.x-5.0. Use \Drupal\file\FileInterface::setPermanent() and \Drupal\file\FileInterface::save() instead. See https://www.drupal.org/project/fillpdf/issues/3055123.', E_USER_DEPRECATED); + @trigger_error('InputHelper::saveFileUpload() is deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Use \Drupal\file\FileInterface::setPermanent() and \Drupal\file\FileInterface::save() instead. See https://www.drupal.org/project/fillpdf/issues/3055123.', E_USER_DEPRECATED); $file->setPermanent(); $file->save(); } diff --git a/src/Plugin/FillPdfActionPluginBase.php b/src/Plugin/FillPdfActionPluginBase.php index 9752dd5..8ae90d3 100644 --- a/src/Plugin/FillPdfActionPluginBase.php +++ b/src/Plugin/FillPdfActionPluginBase.php @@ -37,7 +37,7 @@ abstract class FillPdfActionPluginBase extends PluginBase implements FillPdfActi * @see \Drupal\Component\Plugin\ConfigurableInterface::getConfiguration() */ public function getConfiguration() { - @trigger_error('FillPdfActionPluginInterface::getConfiguration() is deprecated in fillpdf:8.x-4.8 and will be removed before fillpdf:8.x-5.0. Custom FillPdfActionPlugins may extend ConfigurableInterface instead. See https://www.drupal.org/project/fillpdf/issues/3058862.', E_USER_DEPRECATED); + @trigger_error('FillPdfActionPluginInterface::getConfiguration() is deprecated in fillpdf:8.x-4.8 and is removed from fillpdf:8.x-5.0. Custom FillPdfActionPlugins may extend ConfigurableInterface instead. See https://www.drupal.org/project/fillpdf/issues/3058862.', E_USER_DEPRECATED); return $this->configuration; } diff --git a/src/Plugin/PdfBackend/FillPdfServicePdfBackend.php b/src/Plugin/PdfBackend/FillPdfServicePdfBackend.php index fa3bc8c..b3f6023 100644 --- a/src/Plugin/PdfBackend/FillPdfServicePdfBackend.php +++ b/src/Plugin/PdfBackend/FillPdfServicePdfBackend.php @@ -67,9 +67,13 @@ class FillPdfServicePdfBackend extends PdfBackendBase implements FillPdfBackendP /** * Make an XML-RPC request. * - * @param $method + * @param string $method + * The method to call. Additional arguments are the paramters to the + * xmlrpc() call. * - * @return \stdClass + * @return object + * Object with properties 'error' and 'data' representing the result of the + * request. */ protected function xmlRpcRequest($method /* $args */) { $url = $this->configuration['remote_protocol'] . '://' . $this->configuration['remote_endpoint']; diff --git a/src/Serializer.php b/src/Serializer.php index ddfcdec..270c4cb 100644 --- a/src/Serializer.php +++ b/src/Serializer.php @@ -69,8 +69,8 @@ class Serializer implements SerializerInterface { foreach ($field_json as $normalized_field) { $field = $this->serializer->denormalize($normalized_field, 'Drupal\fillpdf\Entity\FillPdfFormField'); // @todo: Exported fields are now already keyed by PDF key. For now, we're - // not using the array keys to remain compatible with previous exports, - // but should do so that at some later point. + // not using the array keys to remain compatible with previous exports, + // but should do so that at some later point. $decoded_fields[$field->pdf_key->value] = $field; } @@ -136,14 +136,14 @@ class Serializer implements SerializerInterface { * @return string[] * Array of unmatched PDF keys. * - * @deprecated in fillpdf:8.x-4.7 and will be removed from fillpdf:8.x-5.0. + * @deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. * Field lists are already keyed by pdf_key now, so rekeying them is * unnecessary. Use ::importFormFields instead. * @see https://www.drupal.org/project/fillpdf/issues/3055097 * @see \Drupal\fillpdf\SerializerInterface::importFormFields() */ public function importFormFieldsByKey(array $form_fields, array $existing_fields = []) { - @trigger_error('SerializerInterface::importFormFieldsByKey() is deprecated in fillpdf:8.x-4.7 and will be removed before fillpdf:8.x-5.0. Use \Drupal\fillpdf\SerializerInterface::importFormFields() instead. See https://www.drupal.org/project/fillpdf/issues/3055097', E_USER_DEPRECATED); + @trigger_error('SerializerInterface::importFormFieldsByKey() is deprecated in fillpdf:8.x-4.7 and is removed from fillpdf:8.x-5.0. Use \Drupal\fillpdf\SerializerInterface::importFormFields() instead. See https://www.drupal.org/project/fillpdf/issues/3055097', E_USER_DEPRECATED); $keyed_fields = []; foreach ($form_fields as $form_field) { $keyed_fields[$form_field->pdf_key->value] = $form_field; diff --git a/src/Service/FillPdfContextManager.php b/src/Service/FillPdfContextManager.php index 5f8f977..35a3f51 100644 --- a/src/Service/FillPdfContextManager.php +++ b/src/Service/FillPdfContextManager.php @@ -5,6 +5,9 @@ namespace Drupal\fillpdf\Service; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\fillpdf\FillPdfContextManagerInterface; +/** + * + */ class FillPdfContextManager implements FillPdfContextManagerInterface { /** diff --git a/tests/modules/fillpdf_test/src/Plugin/FillPdfBackend/TestFillPdfBackend.php b/tests/modules/fillpdf_test/src/Plugin/FillPdfBackend/TestFillPdfBackend.php index 7b1be6c..c6e68d9 100644 --- a/tests/modules/fillpdf_test/src/Plugin/FillPdfBackend/TestFillPdfBackend.php +++ b/tests/modules/fillpdf_test/src/Plugin/FillPdfBackend/TestFillPdfBackend.php @@ -42,7 +42,7 @@ class TestFillPdfBackend implements FillPdfBackendPluginInterface, ContainerFact * @param \Drupal\Core\State\StateInterface $state * The state. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, StateInterface $state) { + public function __construct(array $configuration, $plugin_id, array $plugin_definition, StateInterface $state) { $this->configuration = $configuration; $this->state = $state; } diff --git a/tests/src/Functional/FillPdfFormImportFormTest.php b/tests/src/Functional/FillPdfFormImportFormTest.php index bff0cc5..65510fd 100644 --- a/tests/src/Functional/FillPdfFormImportFormTest.php +++ b/tests/src/Functional/FillPdfFormImportFormTest.php @@ -54,7 +54,7 @@ class FillPdfFormImportFormTest extends BrowserTestBase { // Change some configuration. // @todo: Even without a destination set, we should always return somewhere - // instead of remaining on the duplicate confirm page. + // instead of remaining on the duplicate confirm page. $edit = [ 'replacements[0][value]' => 'n|No', ]; diff --git a/tests/src/Functional/FillPdfUploadTestBase.php b/tests/src/Functional/FillPdfUploadTestBase.php index b33fe16..793b47d 100644 --- a/tests/src/Functional/FillPdfUploadTestBase.php +++ b/tests/src/Functional/FillPdfUploadTestBase.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\fillpdf\Functional; use Drupal; -use Drupal\Component\Version\Constraint; use Drupal\file\Entity\File; use Drupal\fillpdf\Component\Utility\FillPdf; use Drupal\Component\Render\FormattableMarkup; @@ -14,7 +13,7 @@ use Drupal\fillpdf\FillPdfFormInterface; * * @group fillpdf */ -abstract class FillPdfUploadTestBase extends FillPdfTestBase { +abstract class FillPdfUploadTestBase extends FillPdfTestBase { /** * Upload a file in the managed file widget. diff --git a/tests/src/Functional/PdfPopulationTest.php b/tests/src/Functional/PdfPopulationTest.php index 573df84..8790c7b 100644 --- a/tests/src/Functional/PdfPopulationTest.php +++ b/tests/src/Functional/PdfPopulationTest.php @@ -12,7 +12,6 @@ use Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait; use Drupal\user\Entity\Role; // When 8.7.x is fully EOL, this can be removed. - if (!trait_exists('\Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait')) { class_alias('\Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait', '\Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait'); } @@ -85,10 +84,12 @@ class PdfPopulationTest extends FillPdfTestBase { $node = $this->createNode([ 'title' => 'Hello & how are you?', 'type' => 'article', - 'body' => [[ - 'value' => "<p>PDF form fields don't accept <em>any</em> HTML.</p>", - 'format' => 'restricted_html', - ]], + 'body' => [ + [ + 'value' => "<p>PDF form fields don't accept <em>any</em> HTML.</p>", + 'format' => 'restricted_html', + ], + ], ]); // Hit the generation route, check the results from the test backend plugin. diff --git a/tests/src/Traits/TestFillPdfTrait.php b/tests/src/Traits/TestFillPdfTrait.php index 187fe9d..37aec75 100644 --- a/tests/src/Traits/TestFillPdfTrait.php +++ b/tests/src/Traits/TestFillPdfTrait.php @@ -155,7 +155,7 @@ trait TestFillPdfTrait { * The MIME type. * * @todo Consider using FileManagedTestBase::createFile() instead. - * @see \Drupal\Tests\file\Functional\FileManagedTestBase::createFile(). + * @see \Drupal\Tests\file\Functional\FileManagedTestBase::createFile() */ protected function getMimeType($content) { $finfo = new \finfo(FILEINFO_MIME_TYPE); diff --git a/tests/src/Unit/FieldMapping/ImageFieldMappingTest.php b/tests/src/Unit/FieldMapping/ImageFieldMappingTest.php index fcf3772..de580ae 100644 --- a/tests/src/Unit/FieldMapping/ImageFieldMappingTest.php +++ b/tests/src/Unit/FieldMapping/ImageFieldMappingTest.php @@ -11,6 +11,9 @@ use Drupal\Tests\UnitTestCase; */ class ImageFieldMappingTest extends UnitTestCase { + /** + * + */ public function test__construct() { // Test valid and invalid instantiations. $image_field_mapping = new ImageFieldMapping('Dummy image', 'jpg'); @@ -20,6 +23,9 @@ class ImageFieldMappingTest extends UnitTestCase { new ImageFieldMapping('Dummy image', 'bmp'); } + /** + * + */ public function testGetExtension() { $image_field_mapping = new ImageFieldMapping('Dummy image', 'jpg'); self::assertEquals('jpg', $image_field_mapping->getExtension()); diff --git a/tests/src/Unit/FieldMapping/TextFieldMappingTest.php b/tests/src/Unit/FieldMapping/TextFieldMappingTest.php index 113859c..5c3ac13 100644 --- a/tests/src/Unit/FieldMapping/TextFieldMappingTest.php +++ b/tests/src/Unit/FieldMapping/TextFieldMappingTest.php @@ -11,12 +11,18 @@ use Drupal\Tests\UnitTestCase; */ class TextFieldMappingTest extends UnitTestCase { + /** + * + */ public function test__construct() { // Test valid and invalid instantiations. $text_field_mapping = new TextFieldMapping('Dummy text'); self::assertInstanceOf(TextFieldMapping::class, $text_field_mapping, 'Instantiation works.'); } + /** + * + */ public function testGetData() { $text_field_mapping = new TextFieldMapping('Dummy text'); self::assertInternalType('string', $text_field_mapping->getData(), 'Data returned as string.'); diff --git a/tests/src/Unit/LinkManipulator/ParseEntityIdsTest.php b/tests/src/Unit/LinkManipulator/ParseEntityIdsTest.php index 57adc9f..d6810fc 100644 --- a/tests/src/Unit/LinkManipulator/ParseEntityIdsTest.php +++ b/tests/src/Unit/LinkManipulator/ParseEntityIdsTest.php @@ -15,14 +15,14 @@ class ParseEntityIdsTest extends UnitTestCase { /** * Tests parsing entity IDs from query parameters and back. * - * @covers ::parseEntityIds - * @covers ::prepareEntityIds - * * @param array $input * Input query parameters. - * @param array $input + * @param array $expected * Expected output query parameters. * + * @covers ::parseEntityIds + * @covers ::prepareEntityIds + * * @dataProvider providerTestEntityIds */ public function testEntityIds(array $input, array $expected) { -- GitLab