diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e0bbfd50..a67e07ee 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,9 @@ -Before submitting your pull request, check whether your code adheres to PHPMailer -coding standards by running the following command: +Before submitting your pull request, check whether your code adheres to PHPMailer coding standards (which is mostly [PSR-12](https://www.php-fig.org/psr/psr-12/)) by running [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer): -`./vendor/bin/php-cs-fixer --diff --dry-run --verbose fix ` + ./vendor/bin/phpcs -And committing eventual changes. It's important that this command uses the specific version of php-cs-fixer configured for PHPMailer, so run `composer install` within the PHPMailer folder to use the exact version it needs. +Any problems reported can probably be fixed automatically by using its partner tool, PHP code beautifier: + + ./vendor/bin/phpcbf + +It's important that this command uses the specific version of phpcs configured for PHPMailer, so run `composer install` within the PHPMailer folder to use the exact version it needs. diff --git a/.gitignore b/.gitignore index 33110b4a..4719a995 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ build/ vendor/ *.pem composer.lock -.php_cs.cache diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 3bf20468..00000000 --- a/.php_cs +++ /dev/null @@ -1,35 +0,0 @@ -setRiskyAllowed(true) - ->setRules([ - '@Symfony' => true, - '@Symfony:risky' => true, - 'array_syntax' => ['syntax' => 'short'], - 'binary_operator_spaces' => false, - 'concat_space' => ['spacing' => 'one'], - 'heredoc_to_nowdoc' => true, - 'method_argument_space' => true, - 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'], - 'no_php4_constructor' => true, - 'no_short_echo_tag' => true, - 'no_unreachable_default_argument_value' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'ordered_imports' => true, - 'php_unit_fqcn_annotation' => false, - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_order' => true, - 'phpdoc_summary' => false, - 'semicolon_after_instruction' => true, - 'simplified_null_return' => true, - 'native_function_invocation' => false, - 'yoda_style' => false, - 'no_break_comment' => false, - 'native_constant_invocation' => false, - ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__ . '/src') - ->in(__DIR__ . '/test') - ) -; diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 95162c3b..45dd3bcb 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,6 +1,6 @@ build: environment: - php: '5.6.0' + php: '7.4.0' before_commands: - "composer install --prefer-source" @@ -49,19 +49,6 @@ tools: - test - vendor - # PHP CS Fixer (http://http://cs.sensiolabs.org/). - php_cs_fixer: - enabled: true - config: - level: psr2 - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - # Analyzes the size and structure of a PHP project. php_loc: enabled: true diff --git a/.travis.yml b/.travis.yml index b3a02a32..b2fc8d33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ before_install: - sudo apt-get install -y -qq postfix install: - - REMOVE_PACKAGE="friendsofphp/php-cs-fixer"; if [ "$CS_CHECK" = 1 ]; then REMOVE_PACKAGE="phpunit/phpunit"; fi; composer remove --no-update --no-scripts --dev $REMOVE_PACKAGE - composer install - if [ "$CODE_COVERAGE" != 1 ]; then phpenv config-rm xdebug.ini || true; fi @@ -23,12 +22,7 @@ before_script: - sudo mkdir -p /var/qmail/bin - sudo cp test/fakesendmail.sh /var/qmail/bin/sendmail - sudo cp test/fakesendmail.sh /usr/sbin/sendmail - - | - if [[ $TRAVIS_PHP_VERSION = "hhv"* ]]; then - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' >> /etc/hhvm/php.ini - else - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini - fi + - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini script: ./vendor/bin/phpunit --configuration ./travis.phpunit.xml.dist @@ -43,12 +37,8 @@ stages: jobs: include: - stage: coding-standard - before_install: - before_script: - script: ./vendor/bin/php-cs-fixer --diff --dry-run --verbose fix - after_script: - php: 5.6 - env: CS_CHECK=1 + script: ./vendor/bin/phpcs -s + php: 7.4 - stage: test - php: 7.0 - php: 7.1 @@ -57,10 +47,8 @@ jobs: - php: 7.4 env: CODE_COVERAGE=1 - php: nightly - - php: hhvm dist: trusty matrix: allow_failures: - php: nightly - - php: hhvm diff --git a/composer.json b/composer.json index 95a89919..37e01e3d 100644 --- a/composer.json +++ b/composer.json @@ -32,9 +32,12 @@ "ext-hash": "*" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.2", + "squizlabs/php_codesniffer": "3.5.6", + "phpcompatibility/php-compatibility": "9.3.5", "phpunit/phpunit": "^4.8 || ^5.7", - "doctrine/annotations": "^1.2" + "doctrine/annotations": "^1.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "roave/security-advisories": "dev-latest" }, "suggest": { "psr/log": "For optional PSR-3 debug logging", diff --git a/examples/DKIM_gen_keys.phps b/examples/DKIM_gen_keys.phps index 42cbc952..5e4aeca6 100644 --- a/examples/DKIM_gen_keys.phps +++ b/examples/DKIM_gen_keys.phps @@ -1,4 +1,5 @@ setFrom('from@example.com', 'First Last'); $mail->addAddress('whoto@example.com', 'John Doe'); $mail->Subject = 'PHPMailer mail() test'; @@ -39,7 +40,7 @@ $mail->DKIM_extraHeaders = ['List-Unsubscribe', 'List-Help']; //When you send, the DKIM settings will be used to sign the message if (!$mail->send()) { - echo 'Mailer Error: '. $mail->ErrorInfo; + echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message sent!'; } diff --git a/examples/callback.phps b/examples/callback.phps index 32165f73..06411fb4 100644 --- a/examples/callback.phps +++ b/examples/callback.phps @@ -1,4 +1,5 @@ isMail(); diff --git a/examples/contactform-ajax.phps b/examples/contactform-ajax.phps index 6f582644..373124f9 100644 --- a/examples/contactform-ajax.phps +++ b/examples/contactform-ajax.phps @@ -1,4 +1,5 @@ send()) { //The reason for failing to send will be in $mail->ErrorInfo //but it's unsafe to display errors directly to users - process the error, log it on your server. - if ($isAjax) + if ($isAjax) { http_response_code(500); + } $response = [ "status" => false, @@ -93,7 +96,9 @@ EOT;