From 709527d7b669834e4ddda0b66c6e29ed2c84aa2a Mon Sep 17 00:00:00 2001 From: Kevin Pham Date: Mon, 11 Jul 2022 16:04:47 +1000 Subject: [PATCH] style: fix remaining trailing comma phpcs issues There's a bug in phpcs that is preventing these checks from catching all cases. With this in mind, I've opted to use the Drupal standards to catch these missing cases which seems to work well. The rule is "Drupal.Arrays.Array.CommaLastItem" --- classes/dataflow.php | 2 +- classes/local/step/connector_s3.php | 2 +- classes/step.php | 11 ++++++----- edit.php | 2 +- tests/tool_dataflows_secret_service_test.php | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/classes/dataflow.php b/classes/dataflow.php index 942d64e1..71833397 100644 --- a/classes/dataflow.php +++ b/classes/dataflow.php @@ -209,7 +209,7 @@ public function get_variables(): array { 'DATAFLOW_RUN_NAME' => $this->engine->run->name ?? null, ], 'dataflow' => $dataflow, - 'steps' => $steps + 'steps' => $steps, ]; return $variables; } diff --git a/classes/local/step/connector_s3.php b/classes/local/step/connector_s3.php index 95d5948d..74808280 100644 --- a/classes/local/step/connector_s3.php +++ b/classes/local/step/connector_s3.php @@ -92,7 +92,7 @@ public function execute(): bool { $config = $this->enginestep->stepdef->config; $connectionoptions = [ 'version' => 'latest', - 'region' => $config->region + 'region' => $config->region, ]; if ($config->key !== '') { $connectionoptions['credentials'] = [ diff --git a/classes/step.php b/classes/step.php index 68b7732d..a26827b0 100644 --- a/classes/step.php +++ b/classes/step.php @@ -547,11 +547,12 @@ protected function validate_link_count(int $count, string $inputoutput, string $ $steptype = $this->steptype; [$min, $max] = $steptype->$fn(); if ($count < $min || $count > $max) { - return ["invalid_count_{$inputoutput}{$flowconnector}s_{$this->id}" => get_string( - "stepinvalid{$inputoutput}{$flowconnector}count", - 'tool_dataflows', - $count - ) . ' ' . visualiser::get_link_expectations($steptype, $inputoutput) + return [ + "invalid_count_{$inputoutput}{$flowconnector}s_{$this->id}" => get_string( + "stepinvalid{$inputoutput}{$flowconnector}count", + 'tool_dataflows', + $count + ) . ' ' . visualiser::get_link_expectations($steptype, $inputoutput), ]; } return true; diff --git a/edit.php b/edit.php index c8307f63..3932e63c 100644 --- a/edit.php +++ b/edit.php @@ -56,7 +56,7 @@ // Render the specific dataflow form. $customdata = [ 'persistent' => $persistent ?? null, // An instance, or null. - 'userid' => $USER->id // For the hidden userid field. + 'userid' => $USER->id, // For the hidden userid field. ]; $form = new dataflow_form($PAGE->url->out(false), $customdata); if ($form->is_cancelled()) { diff --git a/tests/tool_dataflows_secret_service_test.php b/tests/tool_dataflows_secret_service_test.php index 50ebf246..fae33deb 100644 --- a/tests/tool_dataflows_secret_service_test.php +++ b/tests/tool_dataflows_secret_service_test.php @@ -56,7 +56,7 @@ protected static function form_define_fields(): array { 'secret' => ['type' => PARAM_TEXT, 'secret' => true], 'source' => ['type' => PARAM_TEXT], 'target' => ['type' => PARAM_TEXT], - 'sourceremote' => ['type' => PARAM_BOOL] + 'sourceremote' => ['type' => PARAM_BOOL], ]; } }