Skip to content

Commit

Permalink
Merge pull request #44 from koriym/php7.1
Browse files Browse the repository at this point in the history
Drop php 7.0 support and update meta files
  • Loading branch information
koriym authored Jan 14, 2019
2 parents 91b4417 + 61a2c25 commit 1f52f3b
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 160 deletions.
238 changes: 148 additions & 90 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,127 +1,185 @@
<?php
$header = <<<'EOF'
This file is part of the __PACKAGE__ package.

@license http://opensource.org/licenses/MIT MIT
/*
* PHP Coding Standards Fixer Config file for PHP 7.1 and up
*
* @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/README.rst
*/

$header = <<<'EOF'
EOF;

$finder = PhpCsFixer\Finder::create()
->exclude(['tests/Fake', 'tests/tmp', 'template'])
->in(__DIR__);

return \PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules(array(
->setRules([
'@PSR2' => true,
// 'header_comment' => ['header' => $header, 'commentType' => 'PHPDoc', 'location' =>,'after_declare_strict', 'separate' => 'none'],
'@PHP70Migration:risky' => true,
'@PHP71Migration:risky' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['align_equals' => false, 'align_double_arrow' => false],
'blank_line_after_opening_tag' => true,
'blank_line_after_namespace' => false,
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => true, // @Symfony
'blank_line_after_opening_tag' => true, // @Symfony
'blank_line_before_return' => true,
'cast_spaces' => true,
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'return', 'throw']], // @Symfony
'cast_spaces' => true, // @Symfony
'class_attributes_separation' => ['elements' => ['const', 'method']], // @Symfony
// 'class_keyword_remove' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'declare_strict_types' => false,
'dir_constant' => true,
'ereg_to_preg' => true,
'function_typehint_space' => true,
// 'comment_to_phpdoc' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'], // @Symfony
// 'date_time_immutable' => true,
'declare_equal_normalize' => true, // @Symfony
'dir_constant' => true, // @Symfony:risky
'ereg_to_preg' => true, // @Symfony:risky
'error_suppression' => true, // @Symfony:risky
'escape_implicit_backslashes' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
// 'final_internal_class' => true,
'fully_qualified_strict_types' => true,
'function_to_constant' => true, // @Symfony:risky
'function_typehint_space' => true, // @Symfony
'general_phpdoc_annotation_remove' => ['author', 'category', 'package', 'copyright', 'version'],
'hash_to_slash_comment' => true,
'header_comment' => ['header' => $header, 'comment_type' => 'comment'],
'heredoc_to_nowdoc' => true,
'include' => true,
'include' => true, // @Symfony
// 'increment_style' => 'pre', // @Symfony
'indentation_type' => true,
// 'is_null' => ['use_yoda_style' => false],
'is_null' => ['use_yoda_style' => false], // @Symfony:risky
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
// 'list_syntax' => true,
// 'logical_operators' => true,
'lowercase_cast' => true, // @Symfony
'lowercase_static_reference' => true, // @Symfony
'magic_constant_casing' => true,
// 'mb_str_functions' => true,
'method_chaining_indentation' => true,
'method_separation' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'modernize_types_casting' => true, // @Symfony:risky
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => true,
// 'native_constant_invocation' => true,
'native_function_casing' => true, // @Symfony
// 'native_function_invocation' => true,
'new_with_braces' => false, //
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'curly_brace_block', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'throw', 'use', 'useTrait'],
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => ['use' => 'echo'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
// 'no_php4_constructor' => true,
'no_short_bool_cast' => true,
// 'new_with_braces' => true, // @Symfony
'no_alias_functions' => true, // @Symfony:risky
'no_alternative_syntax' => true,
'no_binary_string' => true,
'no_blank_lines_after_class_opening' => true, // @Symfony
'no_blank_lines_after_phpdoc' => true, // @Symfony
// 'no_blank_lines_before_namespace' => true,
'no_empty_comment' => true, // @Symfony
'no_empty_phpdoc' => true, // @Symfony
'no_empty_statement' => true, // @Symfony
'no_extra_blank_lines' => true,
'no_homoglyph_names' => true, // @Symfony:risky
'no_leading_import_slash' => true, // @Symfony
'no_leading_namespace_whitespace' => true, // @Symfony
'no_mixed_echo_print' => true, // @Symfony
'no_multiline_whitespace_around_double_arrow' => true, // @Symfony
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true, // @Symfony
'no_short_echo_tag' => false,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_singleline_whitespace_before_semicolons' => true, // @Symfony
'no_spaces_around_offset' => true, // @Symfony
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_trailing_comma_in_list_call' => true, // @Symfony
'no_trailing_comma_in_singleline_array' => true, // @Symfony
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_control_parentheses' => true, // @Symfony
'no_unneeded_curly_braces' => true, // @Symfony
'no_unneeded_final_method' => true, // @Symfony
'no_unreachable_default_argument_value' => true,
'no_unset_on_property' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'no_whitespace_before_comma_in_array' => true, // @Symfony
'no_whitespace_in_blank_line' => true, // @Symfony
'non_printable_character' => true, // @Symfony
'normalize_index_brace' => true, // @Symfony
'not_operator_with_space' => false,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'object_operator_without_whitespace' => true, // @Symfony
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_construct' => true,
'php_unit_construct' => true, // @Symfony:risky
'php_unit_dedicate_assert' => true,
'php_unit_fqcn_annotation' => true,
'php_unit_expectation' => true,
'php_unit_fqcn_annotation' => true, // @Symfony
// 'php_unit_internal_class' => true, // @Symfony]
// 'php_unit_mock' => true,
'php_unit_namespaced' => true,
'php_unit_no_expectation_annotation' => true,
'php_unit_ordered_covers' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
// 'php_unit_test_annotation' => true,
// 'php_unit_test_case_static_method_calls' => true,
// 'php_unit_test_class_requires_covers' => true,
// 'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => ['property-read' => 'property', 'property-write' => 'property', 'type' => 'var'],
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
// 'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_align' => true, // @Symfony]
'phpdoc_annotation_without_dot' => true, // @Symfony]
'phpdoc_indent' => true, // @Symfony]
'phpdoc_inline_tag' => true, // @Symfony]
'phpdoc_no_access' => true, // @Symfony]
'phpdoc_no_alias_tag' => true, // @Symfony
'phpdoc_no_empty_return' => true, // @Symfony
'phpdoc_no_package' => true, // @Symfony
// 'phpdoc_no_useless_inheritdoc' => true, // @Symfony
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
// 'phpdoc_summary' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
// 'pre_increment' => true,
'phpdoc_return_self_reference' => true, // @Symfony
'phpdoc_scalar' => true, // @Symfony
'phpdoc_separation' => true, // @Symfony
'phpdoc_single_line_var_spacing' => true, // @Symfony
// 'phpdoc_summary' => true, // @Symfony
'phpdoc_to_comment' => true, // @Symfony
'phpdoc_trim' => true, // @Symfony
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true, // @Symfony
'phpdoc_types_order' => true, // @Symfony
'phpdoc_var_without_name' => true, // @Symfony
'protected_to_private' => true,
'psr0' => true,
'psr4' => true,
'random_api_migration' => true,
'psr4' => true, // @Symfony:risky
'return_assignment' => true,
'return_type_declaration' => ['space_before' => 'one'],
'self_accessor' => true,
'short_scalar_cast' => true,
// 'silenced_deprecation_error' => true,
// 'simplified_null_return' => true,
'single_blank_line_before_namespace' => false,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'self_accessor' => true, // @Symfony:risky
'semicolon_after_instruction' => true, // @Symfony
'set_type_to_cast' => true, // @Symfony:risky
'short_scalar_cast' => true, // @Symfony:risky
'simplified_null_return' => true,
'single_blank_line_before_namespace' => true, // @Symfony
// 'single_line_comment_style' => true, // @Symfony
'single_line_after_imports' => true,
'single_quote' => true, // @Symfony
'space_after_semicolon' => true, // @Symfony
'standardize_increment' => true, // @Symfony
'standardize_not_equals' => true, // @Symfony
// 'static_lambda' => true,
// 'strict_comparison' => true,
'ternary_operator_spaces' => true,
'strict_param' => true,
'ternary_to_null_coalescing' => true,
// 'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true
))
->setLineEnding("\n")
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
);
// 'string_line_ending' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
// 'trailing_comma_in_multiline_array' => true, // @Symfony
'trim_array_spaces' => true, // @Symfony
'unary_operator_spaces' => true, // @Symfony
'visibility_required' => true,
// 'void_return' => true, // @PHP71Migration:risky
'whitespace_after_comma_in_array' => true, // @Symfony
// 'yoda_style' => true // @Symfony
])
->setFinder($finder);
1 change: 0 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ tools:
external_code_coverage: true
php_code_coverage: true
php_sim: true
php_mess_detector: true
php_pdepend: true
php_analyzer: true
php_cpd: true
Expand Down
75 changes: 55 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,61 @@
language: php
sudo: false
dist: trusty

php:
- 7
- 7.1
- 7.2
- 7.1
- 7.2
- 7.3
- nightly

cache:
directories:
- vendor
- $HOME/.composer/cache
env:
matrix:
- DEPENDENCIES=""
- DEPENDENCIES="--prefer-lowest --prefer-stable"
before_script:
- composer self-update
- composer update $DEPENDENCIES
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then COVERAGE="--coverage-clover=coverage.clover"; else phpenv config-rm xdebug.ini; fi
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then composer require --dev phpstan/phpstan-shim friendsofphp/php-cs-fixer; fi
- vendor
- $HOME/.composer/cache

matrix:
fast_finish: true

before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
- composer self-update

install:
- composer install

script:
- ./vendor/bin/phpunit $COVERAGE;
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS && ./vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}";fi
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then ./vendor/bin/phpstan analyse -l max -c phpstan.neon src tests --no-progress --no-interaction; fi
after_script:
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
- ./vendor/bin/phpunit;

jobs:
include:
- stage: Test
name: Lowest dependencies
php: 7.2
install: composer update --prefer-dist --prefer-lowest

- stage: Test
name: Code coverage
php: 7.2
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
script:
- ./vendor/bin/phpunit -v --coverage-clover ./build/logs/clover.xml
after_script:
- wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover;

- stage: Code Quality
name: Static analysis
php: 7.2
install: composer require --dev phpstan/phpstan-shim ^0.10;
script:
- ./vendor/bin/phpstan analyse -l max -c phpstan.neon src tests --no-progress --no-interaction;

- stage: Code Quality
name: Coding standards
php: 7.2
install: composer require --dev friendsofphp/php-cs-fixer ^2.0;
script:
- ./vendor/bin/php-cs-fixer --dry-run -v fix;

allow_failures:
- php: nightly
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
}
],
"require": {
"php": ">=7.0.0"
"php": ">=7.1.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"phpunit/phpunit": "^7.5",
"squizlabs/php_codesniffer": "^3.2",
"friendsofphp/php-cs-fixer": "^2.11",
"phpmd/phpmd": "^2.6",
"phpstan/phpstan-shim" : "^0.9"
"phpstan/phpstan-shim" : "^0.10"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 6 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<phpunit bootstrap="./vendor/autoload.php">
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.5/phpunit.xsd"
bootstrap="vendor/autoload.php">
<testsuites>
<testsuite>
<directory suffix="Test.php">tests</directory>
<testsuite name="all">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
Expand Down
Loading

0 comments on commit 1f52f3b

Please sign in to comment.