From e08dd7a4ec23022819c36bf8b2c1dc968c5e2fcf Mon Sep 17 00:00:00 2001 From: Maks3w Date: Tue, 9 Oct 2018 21:50:51 +0200 Subject: [PATCH] Modernization --- .php_cs | 99 +++++++++++++++++----- .travis.yml | 30 ++++--- LICENSE.txt | 2 +- composer.json | 22 +++-- phpunit.xml.dist | 9 +- src/Adapter/AdapterInterface.php | 2 + src/Adapter/XmlseclibsAdapter.php | 2 + src/Soap/SoapClient.php | 2 + test/Adapter/AdapterInterfaceTestTrait.php | 7 +- test/Adapter/XmlseclibsAdapterTest.php | 7 +- test/Soap/SoapClientTest.php | 7 +- 11 files changed, 127 insertions(+), 62 deletions(-) diff --git a/.php_cs b/.php_cs index a0e7b3d..0c2df27 100644 --- a/.php_cs +++ b/.php_cs @@ -1,27 +1,80 @@ fixers( +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules( [ - '-concat_without_spaces', - '-empty_return', - '-phpdoc_no_empty_return', - '-phpdoc_params', - '-phpdoc_to_comment', - '-single_array_no_trailing_comma', - 'concat_with_spaces', - 'ereg_to_preg', - 'multiline_spaces_before_semicolon', - 'ordered_use', - 'short_array_syntax', - 'strict', - 'strict_param', - '-psr0', // Bugged XmlDSigTest to lowercase change - ] + '@PHP71Migration' => true, + '@PSR2' => true, + 'array_syntax' => [ + 'syntax' => 'short' + ], + 'binary_operator_spaces' => true, + 'blank_line_after_opening_tag' => true, + 'concat_space' => [ + 'spacing' => 'one', + ], + 'declare_strict_types' => true, + 'dir_constant' => true, + 'ereg_to_preg' => true, + 'general_phpdoc_annotation_remove' => [ + 'expectedException', + 'expectedExceptionMessage', + 'expectedExceptionMessageRegExp', + ], + 'hash_to_slash_comment' => true, + 'heredoc_to_nowdoc' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_cast' => true, + 'method_separation' => true, + 'modernize_types_casting' => true, + 'new_with_braces' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_consecutive_blank_lines' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_short_bool_cast' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'ordered_imports' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_strict' => false, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_alias_tag' => true, + 'phpdoc_no_package' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'pre_increment' => true, + 'psr4' => true, + 'self_accessor' => true, + 'semicolon_after_instruction' => true, + 'short_scalar_cast' => true, + 'single_blank_line_before_namespace' => true, + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => true, + 'whitespace_after_comma_in_array' => true, + ]) + ->setFinder(PhpCsFixer\Finder::create() + ->in('src') + ->in('test') ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in('src') - ->in('test') - ) - ; +; diff --git a/.travis.yml b/.travis.yml index 98b1bbf..3b04abe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,32 +5,36 @@ language: php cache: directories: - $HOME/.composer/cache + - vendor matrix: fast_finish: true include: - - php: 5.4 - - php: 5.5 + - php: 7.0 env: - - EXECUTE_CS_CHECK=true - - php: 5.6 + - COMPOSER_ARGUMENTS=--prefer-lowest + - php: 7.0 env: - EXECUTE_TEST_COVERALLS=true - - php: 7 - - php: hhvm + - php: 7.2 + env: + - EXECUTE_CS_CHECK=true before_install: - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0; fi - - travis_retry composer self-update - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls:dev-master; fi install: - - travis_retry composer install --no-interaction + - travis_retry composer update --no-interaction $COMPOSER_ARGUMENTS + - composer info -i script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml; fi - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit; fi - - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run; fi + - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then vendor/bin/phpunit --coverage-clover clover.xml tests; fi + - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then vendor/bin/phpunit tests; fi + - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then vendor/bin/php-cs-fixer fix -v --dry-run; fi after_script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls; fi + - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then + wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; + chmod +x coveralls.phar; + php coveralls.phar -v; + fi diff --git a/LICENSE.txt b/LICENSE.txt index 4463146..37dee12 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2012, Maks3w +Copyright (c) 2018, Maks3w All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/composer.json b/composer.json index acb4c34..5fc15ab 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,6 @@ { "name": "fr3d/xmldsig", "description": "Tool for easy management of XML Signatures (http://www.w3.org/TR/xmldsig-core/)", - "license": "BSD-2-Clause", "keywords": [ "xml", "xmldsig", @@ -9,28 +8,27 @@ "security", "soap" ], - "authors": [ - { - "name": "Maks3w", - "email": "github.maks3w@virtualplanets.net" - } - ], + "license": "BSD-2-Clause", "homepage": "https://github.com/Maks3w/xmldsig/", "require": { - "robrichards/xmlseclibs": "^2.0" + "php": ">= 7.0", + "ext-dom": "*", + "ext-soap": "*", + "robrichards/xmlseclibs": "^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.10.*", - "phpunit/phpunit": "^4.0" + "friendsofphp/php-cs-fixer": "^2.0", + "phpunit/phpunit": "^6.0", + "sensiolabs/security-checker": "^5.0" }, "autoload": { "psr-4": { - "FR3D\\XmlDSig\\": ["src"] + "FR3D\\XmlDSig\\": "src" } }, "autoload-dev": { "psr-4": { - "FR3D\\XmlDSigTest\\": ["test"] + "FR3D\\XmlDSig\\": "test" } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 27060d0..792d779 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,9 @@ - + ./test diff --git a/src/Adapter/AdapterInterface.php b/src/Adapter/AdapterInterface.php index 7af1e4b..d631d5b 100644 --- a/src/Adapter/AdapterInterface.php +++ b/src/Adapter/AdapterInterface.php @@ -1,5 +1,7 @@