Add PHP-CS-Fixer integration (#1148)
* Add PHP-CS-Fixer checks * Remove composer.lock to early catch FC break on CI * Travis: cache dependencies * Enable code-coverage only for latest build * Remove Symfony-specific PHP-Doc rules * Apply coding-standards fix
This commit is contained in:
parent
add60c3e54
commit
8550acd0e4
|
|
@ -5,3 +5,5 @@ test/testbootstrap.php
|
||||||
build/
|
build/
|
||||||
vendor/
|
vendor/
|
||||||
*.pem
|
*.pem
|
||||||
|
composer.lock
|
||||||
|
.php_cs.cache
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
return PhpCsFixer\Config::create()
|
||||||
|
->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,
|
||||||
|
'psr4' => false,
|
||||||
|
'semicolon_after_instruction' => true,
|
||||||
|
'simplified_null_return' => true,
|
||||||
|
])
|
||||||
|
->setFinder(
|
||||||
|
PhpCsFixer\Finder::create()
|
||||||
|
->in(__DIR__ . '/src')
|
||||||
|
->in(__DIR__ . '/test')
|
||||||
|
)
|
||||||
|
;
|
||||||
27
.travis.yml
27
.travis.yml
|
|
@ -1,18 +1,28 @@
|
||||||
language: php
|
language: php
|
||||||
php:
|
|
||||||
- 7.1
|
|
||||||
- 7.0
|
|
||||||
- 5.6
|
|
||||||
- 5.5
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- php: 7.1
|
||||||
|
env: CODE_COVERAGE=1
|
||||||
|
- php: 7.0
|
||||||
|
- php: 5.6
|
||||||
|
- php: 5.5
|
||||||
|
env: CS_CHECK=1
|
||||||
- php: hhvm
|
- php: hhvm
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- $HOME/.composer
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
- sudo apt-get install -y -qq postfix
|
- sudo apt-get install -y -qq postfix
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- composer install
|
- composer install
|
||||||
|
- if [ "$CODE_COVERAGE" != 1 ]; then phpenv config-rm xdebug.ini || true; fi
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- sudo service postfix stop
|
- sudo service postfix stop
|
||||||
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
|
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
|
||||||
|
|
@ -28,8 +38,11 @@ before_script:
|
||||||
else
|
else
|
||||||
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini
|
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./vendor/bin/phpunit --configuration ./travis.phpunit.xml.dist --bootstrap ./vendor/autoload.php
|
- ./vendor/bin/phpunit --configuration ./travis.phpunit.xml.dist --bootstrap ./vendor/autoload.php
|
||||||
|
- if [ "$CS_CHECK" = 1 ]; then ./vendor/bin/php-cs-fixer --diff --dry-run --verbose fix; fi
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- wget https://scrutinizer-ci.com/ocular.phar
|
- if [ "$CODE_COVERAGE" = 1 ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
|
||||||
- php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml
|
- if [ "$CODE_COVERAGE" = 1 ]; then php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml; fi
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
"ext-ctype": "*"
|
"ext-ctype": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.2",
|
||||||
"phpdocumentor/phpdocumentor": "2.*",
|
"phpdocumentor/phpdocumentor": "2.*",
|
||||||
"phpunit/phpunit": "4.*",
|
"phpunit/phpunit": "4.*",
|
||||||
"zendframework/zend-serializer": "2.7.*",
|
"zendframework/zend-serializer": "2.7.*",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1106,7 +1106,7 @@ class PHPMailer
|
||||||
*
|
*
|
||||||
* @param string $address
|
* @param string $address
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param bool $auto Whether to also set the Sender address, defaults to true
|
* @param bool $auto Whether to also set the Sender address, defaults to true
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
|
|
|
||||||
12
src/POP3.php
12
src/POP3.php
|
|
@ -133,9 +133,9 @@ class POP3
|
||||||
/**
|
/**
|
||||||
* Simple static wrapper for all-in-one POP before SMTP.
|
* Simple static wrapper for all-in-one POP before SMTP.
|
||||||
*
|
*
|
||||||
* @param string $host The hostname to connect to
|
* @param string $host The hostname to connect to
|
||||||
* @param int|bool $port The port number to connect to
|
* @param int|bool $port The port number to connect to
|
||||||
* @param int|bool $timeout The timeout value
|
* @param int|bool $timeout The timeout value
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @param int $debug_level
|
* @param int $debug_level
|
||||||
|
|
@ -160,9 +160,9 @@ class POP3
|
||||||
* A connect, login, disconnect sequence
|
* A connect, login, disconnect sequence
|
||||||
* appropriate for POP-before SMTP authorisation.
|
* appropriate for POP-before SMTP authorisation.
|
||||||
*
|
*
|
||||||
* @param string $host The hostname to connect to
|
* @param string $host The hostname to connect to
|
||||||
* @param int|bool $port The port number to connect to
|
* @param int|bool $port The port number to connect to
|
||||||
* @param int|bool $timeout The timeout value
|
* @param int|bool $timeout The timeout value
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @param int $debug_level
|
* @param int $debug_level
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue