pronamic / wp-pronamic-pay

The Pronamic Pay plugin allows you to easily accept payments with payment methods like credit card, iDEAL, Bancontact and Sofort through a variety of payment providers on your WordPress website.
https://pronamicpay.com
34 stars 14 forks source link

PHP `7.4` migration #313

Closed remcotolsma closed 1 year ago

remcotolsma commented 2 years ago

Since we now require PHP 7.4 we can also take advantage of PHP 7.4 features: https://www.php.net/manual/en/migration74.new-features.php

We can use the PHP Coding Standards Fixer (PHP CS Fixer) tool for this: https://cs.symfony.com/doc/ruleSets/PHP74Migration.html

brew install php-cs-fixer
php-cs-fixer fix ./src --rules=@PHP74Migration

Perhaps Rector can also play a role in this.

We could also consider to use the "Short Array Syntax", but this is not currently part of the WordPress Coding Standards: https://make.wordpress.org/core/2019/07/12/php-coding-standards-changes/

Short Array Syntax A little less controversial, but still with varying opinions, was the proposal to require short array syntax ( [ 1, 2, 3 ] ) instead of long array syntax ( array( 1, 2, 3 ) ) for declaring arrays.

While I’m personally partial to short array syntax, there were two particularly convincing arguments for using long array syntax:

  • It’s easier to distinguish from other forms of braces, particularly for those with vision difficulties.
  • It’s much more descriptive for beginners.

So, this change to the coding standards is the opposite of what was originally proposed, but is ultimately the more inclusive option.

We could exclude <rule ref="Universal.Arrays.DisallowShortArraySyntax"/> in https://github.com/pronamic/wp-coding-standards.

<exclude name="Generic.Arrays.DisallowShortArraySyntax" />