This PR reformats all PHP files according to OpenCart provided ruleset.xml.
2. Description of change
add a PHP_CodeSniffer configuration file, phpcs.xml
add a PHP_CodeSniffer ruleset file, .phpcs/OpenCart/ruleset.xml
format the PHP files under the directories, src/admin and src/catalog, by using the tool PHP Code Beautifier and Fixer (phpcbf)
The commands below are the commands used to automatically format the PHP files.
$ composer global require "squizlabs/php_codesniffer=*"
$ phpcbf src
The command below is the command used to check the coding standard.
$ phpcs src
Note:
By default, the command phpcs automatically read the configuration file that has been named phpcs.xml. So, to run the above command phpcs, it is not need to specify the configuration file.
3. Quality assurance
🔧 Environments:
Platform version: OpenCart 2.0.3.1
Omise plugin version: Omise-OpenCart 2.3
PHP versions: 7.0.18
✏️ Details:
Test everything.
Test case 1: Create success charge by credit card
Test case 2: Create fail charge by credit card
Test case 3: Create success charge by internet banking
Test case 4: Create fail charge by internet banking
4. Impact of the change
The PHP files under directories, src/admin and src/catalog are reformatted by using ruleset from the OpenCart Coding standards.
5. Priority of change
High, or conflict.
6. Additional notes
The reason for adding 2 files, configuration file (phpcs.xml) and ruleset file (.phpcs/OpenCart/ruleset.xml) is to separate the rule out from the configuration. So, the ruleset file will contained only rules for checking the PHP source code.
1. Objective
This PR reformats all PHP files according to OpenCart provided ruleset.xml.
2. Description of change
phpcs.xml
.phpcs/OpenCart/ruleset.xml
src/admin
andsrc/catalog
, by using the tool PHP Code Beautifier and Fixer (phpcbf)The commands below are the commands used to automatically format the PHP files.
The command below is the command used to check the coding standard.
Note: By default, the command
phpcs
automatically read the configuration file that has been namedphpcs.xml
. So, to run the above commandphpcs
, it is not need to specify the configuration file.3. Quality assurance
🔧 Environments:
✏️ Details:
Test everything.
Test case 1: Create success charge by credit card Test case 2: Create fail charge by credit card Test case 3: Create success charge by internet banking Test case 4: Create fail charge by internet banking
4. Impact of the change
The PHP files under directories,
src/admin
andsrc/catalog
are reformatted by using ruleset from the OpenCart Coding standards.5. Priority of change
High, or conflict.
6. Additional notes
phpcs.xml
) and ruleset file (.phpcs/OpenCart/ruleset.xml
) is to separate the rule out from the configuration. So, the ruleset file will contained only rules for checking the PHP source code.References: