Commit a627b597 authored by bojanz's avatar bojanz

Fix build with latest coder (codestyle checks).

parent d67dca18
......@@ -77,7 +77,7 @@ class EditQuantity extends FieldPluginBase {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public function viewsForm(&$form, FormStateInterface $form_state) {
public function viewsForm(array &$form, FormStateInterface $form_state) {
// Make sure we do not accidentally cache this form.
$form['#cache']['max-age'] = 0;
// The view is empty, abort.
......@@ -114,7 +114,7 @@ class EditQuantity extends FieldPluginBase {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public function viewsFormSubmit(&$form, FormStateInterface $form_state) {
public function viewsFormSubmit(array &$form, FormStateInterface $form_state) {
$quantities = $form_state->getValue($this->options['id']);
foreach ($quantities as $row_index => $quantity) {
/** @var \Drupal\commerce_order\Entity\OrderItemInterface $order_item */
......
......@@ -77,7 +77,7 @@ class RemoveButton extends FieldPluginBase {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public function viewsForm(&$form, FormStateInterface $form_state) {
public function viewsForm(array &$form, FormStateInterface $form_state) {
// Make sure we do not accidentally cache this form.
$form['#cache']['max-age'] = 0;
// The view is empty, abort.
......@@ -107,7 +107,7 @@ class RemoveButton extends FieldPluginBase {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public function viewsFormSubmit(&$form, FormStateInterface $form_state) {
public function viewsFormSubmit(array &$form, FormStateInterface $form_state) {
$triggering_element = $form_state->getTriggeringElement();
if (!empty($triggering_element['#remove_order_item'])) {
$row_index = $triggering_element['#row_index'];
......
......@@ -66,7 +66,7 @@ class CommerceCheckoutPane extends Plugin {
* @param array $values
* The annotation values.
*/
public function __construct($values) {
public function __construct(array $values) {
if (empty($values['admin_label'])) {
$values['admin_label'] = $values['label'];
}
......
......@@ -426,7 +426,7 @@ abstract class CheckoutFlowWithPanesBase extends CheckoutFlowBase implements Che
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The complete form state.
*/
public static function validatePaneConfigurationForm(&$pane_configuration_form, FormStateInterface $form_state) {
public static function validatePaneConfigurationForm(array &$pane_configuration_form, FormStateInterface $form_state) {
$pane_id = $pane_configuration_form['#pane_id'];
/** @var \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneInterface[] $panes */
$panes = $form_state->get('panes');
......@@ -443,7 +443,7 @@ abstract class CheckoutFlowWithPanesBase extends CheckoutFlowBase implements Che
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The complete form state.
*/
public static function multistepSubmit($form, FormStateInterface $form_state) {
public static function multistepSubmit(array $form, FormStateInterface $form_state) {
$triggering_element = $form_state->getTriggeringElement();
switch ($triggering_element['#op']) {
case 'edit':
......
......@@ -100,7 +100,7 @@ class CommercePaymentGateway extends Plugin {
* @param array $values
* The annotation values.
*/
public function __construct($values) {
public function __construct(array $values) {
if (empty($values['modes'])) {
$values['modes'] = [
'test' => t('Test'),
......
......@@ -66,7 +66,7 @@ class PaymentGatewayForm extends RenderElement {
* @return array
* The processed form element.
*/
public static function processForm($element, FormStateInterface $form_state, &$complete_form) {
public static function processForm(array $element, FormStateInterface $form_state, array &$complete_form) {
if (empty($element['#operation'])) {
throw new \InvalidArgumentException('The commerce_payment_gateway_form element requires the #operation property.');
}
......@@ -102,7 +102,7 @@ class PaymentGatewayForm extends RenderElement {
* Thrown if button-level #validate handlers are detected on the parent
* form, as a protection against buggy behavior.
*/
public static function validateForm(&$element, FormStateInterface $form_state) {
public static function validateForm(array &$element, FormStateInterface $form_state) {
// Button-level #validate handlers replace the form-level ones, which means
// that executeElementSubmitHandlers() won't be triggered.
if ($handlers = $form_state->getValidateHandlers()) {
......@@ -121,7 +121,7 @@ class PaymentGatewayForm extends RenderElement {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public static function submitForm(&$element, FormStateInterface $form_state) {
public static function submitForm(array &$element, FormStateInterface $form_state) {
$plugin_form = self::createPluginForm($element);
try {
......@@ -143,7 +143,7 @@ class PaymentGatewayForm extends RenderElement {
* @return \Drupal\commerce_payment\PluginForm\PaymentGatewayFormInterface
* The plugin form.
*/
public static function createPluginForm($element) {
public static function createPluginForm(array $element) {
/** @var \Drupal\commerce\PluginForm\PluginFormFactoryInterface $plugin_form_factory */
$plugin_form_factory = \Drupal::service('plugin_form.factory');
/** @var \Drupal\commerce_payment\Entity\EntityWithPaymentGatewayInterface $entity */
......@@ -169,7 +169,7 @@ class PaymentGatewayForm extends RenderElement {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
public static function executeElementSubmitHandlers(&$element, FormStateInterface $form_state) {
public static function executeElementSubmitHandlers(array &$element, FormStateInterface $form_state) {
if (!$form_state->isSubmitted() || $form_state->hasAnyErrors()) {
// The form wasn't submitted (#ajax in progress) or failed validation.
return;
......
......@@ -97,7 +97,7 @@ class Number extends FormElement {
* @return array
* The built commerce_number form element.
*/
public static function processElement(array $element, FormStateInterface $form_state, &$complete_form) {
public static function processElement(array $element, FormStateInterface $form_state, array &$complete_form) {
// Provide an example to the end user so that they know which decimal
// separator to use. This is the same pattern Drupal core uses.
$number_formatter = self::getNumberFormatter($element);
......@@ -157,7 +157,7 @@ class Number extends FormElement {
* @return array
* The $element with prepared variables ready for input.html.twig.
*/
public static function preRenderNumber($element) {
public static function preRenderNumber(array $element) {
// We're not using the "number" type because it won't accept
// language-specific input, such as commas.
$element['#attributes']['type'] = 'text';
......@@ -176,7 +176,7 @@ class Number extends FormElement {
* @return \CommerceGuys\Intl\Formatter\NumberFormatterInterface
* The number formatter instance.
*/
protected static function getNumberFormatter($element) {
protected static function getNumberFormatter(array $element) {
$number_formatter_factory = \Drupal::service('commerce_price.number_formatter_factory');
/** @var \CommerceGuys\Intl\Formatter\NumberFormatterInterface $number_formatter */
$number_formatter = $number_formatter_factory->createInstance(NumberFormatterInterface::DECIMAL);
......
......@@ -2,7 +2,6 @@
namespace Drupal\commerce_price\Element;
use CommerceGuys\Intl\Formatter\NumberFormatterInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element\FormElement;
......@@ -67,7 +66,7 @@ class Price extends FormElement {
* Thrown when #default_value is not an instance of
* \Drupal\commerce_price\Price.
*/
public static function processElement(array $element, FormStateInterface $form_state, &$complete_form) {
public static function processElement(array $element, FormStateInterface $form_state, array &$complete_form) {
$default_value = $element['#default_value'];
if (isset($default_value) && !self::validateDefaultValue($default_value)) {
throw new \InvalidArgumentException('The #default_value for a commerce_price element must be an array with "number" and "currency_code" keys.');
......@@ -98,7 +97,8 @@ class Price extends FormElement {
'#size' => $element['#size'],
'#maxlength' => $element['#maxlength'],
'#min_fraction_digits' => min($fraction_digits),
'#max_fraction_digits' => 6, // Field storage maximum.
// '6' is the field storage maximum.
'#max_fraction_digits' => 6,
];
unset($element['#size']);
unset($element['#maxlength']);
......
......@@ -186,7 +186,7 @@ class ProductForm extends ContentEntityForm {
* @return array
* The modified visibility_settings element.
*/
public static function hideEmptyVisibilitySettings($form) {
public static function hideEmptyVisibilitySettings(array $form) {
if (isset($form['stores']['widget']['target_id'])) {
$stores_element = $form['stores']['widget']['target_id'];
if (!Element::getVisibleChildren($stores_element)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment