diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e5384a8cf9d2743a1ddee2df1f7ed5d3631399a1..414cbd5c7d57ee513f16edb328372e9c21bedd71 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,3 +27,6 @@ include: # SKIP_ESLINT: '1' # OPT_IN_TEST_NEXT_MAJOR: '1' # _CURL_TEMPLATES_REF: 'main' +variables: + _CSPELL_IGNORE_PATHS: 'images/*, config/install/views.view.advancedqueue_jobs.yml' + _CSPELL_WORDS: 'queuename' \ No newline at end of file diff --git a/css/state.css b/css/state.css index 562bfa0499e1a665262ee750bfb9cbb42cb6ab92..e98538373811fdaa92d80f63d625c59318f38ed0 100644 --- a/css/state.css +++ b/css/state.css @@ -3,27 +3,27 @@ .advancedqueue-status-success, .advancedqueue-status-failure { display: inline-block; + width: 6em; height: 12px; - line-height: 12px; padding-left: 16px; - width: 6em; - background-position: 0 50%; background-repeat: no-repeat; + background-position: 0 50%; + line-height: 12px; } .advancedqueue-status-queued { - background-image: url('../images/queued.gif'); + background-image: url("../images/queued.gif"); } .advancedqueue-status-processing { - background-image: url('../images/processing.gif'); + background-image: url("../images/processing.gif"); } .advancedqueue-status-success { - background-image: url('../images/processed.png'); - color: #336633; + color: #363; + background-image: url("../images/processed.png"); font-weight: bold; } .advancedqueue-status-failure { - background-image: url('../images/failed.png'); - color: #ff0000; + color: #f00; + background-image: url("../images/failed.png"); font-weight: bold; } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000000000000000000000000000000000000..7a5daee5fb31149b39cf39ab940160689365f234 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,6 @@ +parameters: + ignoreErrors: + - + message: "#^\\\\Drupal calls should be avoided in classes, use dependency injection instead$#" + count: 1 + path: src/Processor.php diff --git a/src/Entity/Queue.php b/src/Entity/Queue.php index 0dec214b28bef305e62f8dc8f92a2e3525ade60f..a1ad9a9d89cf2fc1e7a9ffb80dab148a1637b3da 100644 --- a/src/Entity/Queue.php +++ b/src/Entity/Queue.php @@ -154,7 +154,7 @@ class Queue extends ConfigEntityBase implements QueueInterface { } /** - * Prepare a job for enqueuing. + * Prepare a job for enqueueing. * * @param \Drupal\advancedqueue\Job $job * The job to prepare. @@ -163,7 +163,7 @@ class Queue extends ConfigEntityBase implements QueueInterface { * A job to enqueue. This may or may not be the $job object supplied. * * @throws \Drupal\advancedqueue\Exception\InvalidBackendException - * Throws an exception if the queue's backend cannnot handle the given job. + * Throws an exception if the queue's backend cannot handle the given job. */ protected function prepareJob(Job $job): Job { $job->setQueueId($this->id()); @@ -293,9 +293,11 @@ class Queue extends ConfigEntityBase implements QueueInterface { // Invoke the setters to clear related properties. if ($property_name == 'backend') { $this->setBackendId($value); + return $this; } elseif ($property_name == 'backend_configuration') { $this->setBackendConfiguration($value); + return $this; } else { return parent::set($property_name, $value); diff --git a/src/Exception/DuplicateJobException.php b/src/Exception/DuplicateJobException.php index 7524ed0f11510276fa7addd3818e0f6471053f6e..cc447d1faaf42c7ae1326741ea6bf70a90b21bff 100644 --- a/src/Exception/DuplicateJobException.php +++ b/src/Exception/DuplicateJobException.php @@ -7,13 +7,13 @@ use Drupal\advancedqueue\Job; /** * Exception thrown when a job is detected as a duplicate. * - * This is thrown when a new job being considered for queuing is recognised as + * This is thrown when a new job being considered for queueing is recognized as * a duplicate of one or more jobs that are already queued. */ class DuplicateJobException extends \Exception { /** - * The job submitted for enqueuing. + * The job submitted for enqueueing. * * @var \Drupal\advancedqueue\Job */ @@ -32,7 +32,7 @@ class DuplicateJobException extends \Exception { * @param string $message * A message describing the duplicate situation. * @param \Drupal\advancedqueue\Job $job - * The job that was submitted for enqueuing which had existing duplicates. + * The job that was submitted for enqueueing which had existing duplicates. * @param array[\Drupal\advancedqueue\Job|int|string] $duplicates * An array of duplicate jobs or duplicate job ids. Keyed by job id. */ @@ -43,7 +43,7 @@ class DuplicateJobException extends \Exception { } /** - * Get the job submitted for enqueuing. + * Get the job submitted for enqueueing. * * @return \Drupal\advancedqueue\Job * The job. diff --git a/src/Form/QueueForm.php b/src/Form/QueueForm.php index 04a3dc87e5f8ff6161d4bb784382032efd5f6416..719af8979add0d78d33dffc2c9dfa2b6cf8d26c0 100644 --- a/src/Form/QueueForm.php +++ b/src/Form/QueueForm.php @@ -251,9 +251,10 @@ class QueueForm extends EntityForm { * {@inheritdoc} */ public function save(array $form, FormStateInterface $form_state) { - $this->entity->save(); + $save = $this->entity->save(); $this->messenger()->addStatus($this->t('Saved the %label queue.', ['%label' => $this->entity->label()])); $form_state->setRedirect('entity.advancedqueue_queue.collection'); + return $save; } } diff --git a/src/Plugin/AdvancedQueue/JobType/JobTypeInterface.php b/src/Plugin/AdvancedQueue/JobType/JobTypeInterface.php index 3bd21fdffac14fe443840b1209ea4ac885ade8a8..7acf785dac447723039290286173bf94835c210d 100644 --- a/src/Plugin/AdvancedQueue/JobType/JobTypeInterface.php +++ b/src/Plugin/AdvancedQueue/JobType/JobTypeInterface.php @@ -67,7 +67,7 @@ interface JobTypeInterface extends PluginInspectionInterface { public function process(Job $job); /** - * Handles existing jobs detected as duplicates when enqueing a new job. + * Handles existing jobs detected as duplicates when enqueuing a new job. * * A function can be used to execute a range of different strategies with * regard to duplicate jobs: @@ -81,7 +81,7 @@ interface JobTypeInterface extends PluginInspectionInterface { * - to discard the new job and leave the duplicate intact, return NULL. * * @param \Drupal\advancedqueue\Job $job - * The new job submitted for enqueuing. + * The new job submitted for enqueueing. * @param array[\Drupal\advancedqueue\Job|string|int] $duplicates * An array of jobs or job ids that are duplicates of the new job. * Keyed by job id. diff --git a/tests/modules/advancedqueue_test/src/Plugin/AdvancedQueue/Backend/BaseOnly.php b/tests/modules/advancedqueue_test/src/Plugin/AdvancedQueue/Backend/BaseOnly.php index 540c1805f35bb5279ae2ab2b458ae5beded90974..ced9dcc8efdfd622914bb903f2b0d6d0c7ab15aa 100644 --- a/tests/modules/advancedqueue_test/src/Plugin/AdvancedQueue/Backend/BaseOnly.php +++ b/tests/modules/advancedqueue_test/src/Plugin/AdvancedQueue/Backend/BaseOnly.php @@ -42,7 +42,9 @@ class BaseOnly extends BackendBase { /** * {@inheritdoc} */ - public function countJobs() {} + public function countJobs() { + return []; + } /** * {@inheritdoc}