Skip to content

Commit

Permalink
Merge pull request #34 from SpacePossum/2_0_update_cs
Browse files Browse the repository at this point in the history
Update CS
  • Loading branch information
SpacePossum authored Jun 20, 2017
2 parents c565b8e + da71f90 commit 5b9e962
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.php_cs.dist export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
* text=auto eol=lf
Expand Down
45 changes: 0 additions & 45 deletions .php_cs

This file was deleted.

62 changes: 62 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/*
* This file is part of the GeckoPackages.
*
* (c) GeckoPackages https://github.com/GeckoPackages
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

$header = <<<'EOF'
This file is part of the GeckoPackages.
(c) GeckoPackages https://github.com/GeckoPackages
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;

return (new PhpCsFixer\Config('GeckoPackagesCS'))
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'long'],
'class_definition' => ['singleItemSingleLine' => true, 'multiLineExtendsEachSingleLine' => true],
'combine_consecutive_unsets' => true,
'dir_constant' => true,
'ereg_to_preg' => true,
'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
'modernize_types_casting' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'curly_brace_block', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'throw', 'use', 'useTrait'],
'no_multiline_whitespace_before_semicolons' => false,
'no_php4_constructor' => true,
'no_short_echo_tag' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => false,
'ordered_imports' => true,
'php_unit_fqcn_annotation' => false,
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
'phpdoc_order' => true,
'pow_to_exponentiation' => true,
'protected_to_private' => true,
'random_api_migration' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
'ternary_to_null_coalescing' => true,
// remove import from set
'phpdoc_summary' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src/')
->in(__DIR__.'/tests/')
->name('*.php')
);
25 changes: 11 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,35 @@ matrix:
fast_finish: true
include:
- php: 5.3
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest --optimize-autoloader"
- php: 5.4
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest --optimize-autoloader"
- php: 5.5
env: COMPOSER_FLAGS="--prefer-stable"
env: COMPOSER_FLAGS="--prefer-stable --optimize-autoloader"
- php: 5.6
env: COMPOSER_FLAGS="--prefer-stable"
env: COMPOSER_FLAGS="--prefer-stable --optimize-autoloader"
- php: 7.0
env: COMPOSER_FLAGS="--prefer-stable"
env: COMPOSER_FLAGS="--prefer-stable --optimize-autoloader"
- php: 7.1
env: COMPOSER_FLAGS="--prefer-stable --optimize-autoloader"
- php: nightly
env: COMPOSER_FLAGS="--dev"
- php: hhvm-3.9
sudo: required
dist: trusty
group: edge
env: COMPOSER_FLAGS="--prefer-stable"
- php: hhvm-nightly
sudo: required
dist: trusty
group: edge
env: COMPOSER_FLAGS="--dev"
env: COMPOSER_FLAGS="--dev --optimize-autoloader"
allow_failures:
- php: 7.1
- php: nightly
- php: hhvm-nightly

install:
- composer update $COMPOSER_FLAGS --no-interaction -v
- if [[ $TRAVIS_PHP_VERSION = 7.0 ]]; then curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v1.13.1/php-cs-fixer.phar -o php-cs-fixer.phar; fi
- if [[ $TRAVIS_PHP_VERSION = 7.0 ]]; then curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.3.2/php-cs-fixer.phar -o php-cs-fixer.phar; fi

script:
- chmod 755 tests/assets/dir
- chmod 644 tests/assets/dir/test_file.txt
- if [[ $TRAVIS_PHP_VERSION = 5.3 ]]; then phpunit --verbose --testsuite "5.3.6"; else phpunit --verbose; fi
- if [[ $TRAVIS_PHP_VERSION = 5.3 ]]; then vendor/bin/phpunit --verbose --testsuite "5.3.6"; else vendor/bin/phpunit --verbose; fi
- phpenv config-rm xdebug.ini || return 0
- if [[ $TRAVIS_PHP_VERSION = 7.0 ]]; then php php-cs-fixer.phar --dry-run -vvv fix; fi
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,6 @@ Contributions are welcome!

This project follows [Semantic Versioning](http://semver.org/).

Kindly note:
We do not keep a backwards compatible promise on the tests and tooling (such as document generation) of the project itself
nor the content and/or format of exception messages.
<sub>Kindly note:
We do not keep a backwards compatible promise on code annotated with `@internal`, the tests and tooling (such as document generation) of the project itself
nor the content and/or format of exception/error messages.</sub>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"php": "^5.3.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "4.0"
"phpunit/phpunit": "^4.8.35 || ^5.4.3"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Tests/AbstractGeckoPHPUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @author SpacePossum
*/
abstract class AbstractGeckoPHPUnitTest extends \PHPUnit_Framework_TestCase
abstract class AbstractGeckoPHPUnitTest extends GeckoTestCase
{
/**
* @return string
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Tests/Asserts/RangeAssertTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @author SpacePossum
*/
final class RangeAssertTraitTest extends \PHPUnit_Framework_TestCase
final class RangeAssertTraitTest extends GeckoTestCase
{
use RangeAssertTrait;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Tests/Asserts/ScalarAssertTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @author SpacePossum
*/
final class ScalarAssertTraitTest extends \PHPUnit_Framework_TestCase
final class ScalarAssertTraitTest extends GeckoTestCase
{
use ScalarAssertTrait;

Expand Down
14 changes: 14 additions & 0 deletions tests/PHPUnit/Tests/GeckoTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/*
* This file is part of the GeckoPackages.
*
* (c) GeckoPackages https://github.com/GeckoPackages
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

abstract class GeckoTestCase extends \PHPUnit_Framework_TestCase
{
}
6 changes: 3 additions & 3 deletions tests/PHPUnit/Tests/ReadMe/ReadMeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ public function testFilePermissionsOfThisFile()
This project follows [Semantic Versioning](http://semver.org/).
Kindly note:
We do not keep a backwards compatible promise on the tests and tooling (such as document generation) of the project itself
nor the content and/or format of exception messages.
<sub>Kindly note:
We do not keep a backwards compatible promise on code annotated with `@internal`, the tests and tooling (such as document generation) of the project itself
nor the content and/or format of exception/error messages.</sub>
EOF;
$readMeTemplate = str_replace('#GENERATED_LISTING#', $listing, $readMeTemplate);
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Tests/ReadMe/ReadMeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @author SpacePossum
*/
final class ReadMeTest extends \PHPUnit_Framework_TestCase
final class ReadMeTest extends GeckoTestCase
{
public function generateReadMe()
{
Expand Down
1 change: 1 addition & 0 deletions tests/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
}

require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/PHPUnit/Tests/GeckoTestCase.php';
require_once __DIR__.'/PHPUnit/Tests/AbstractGeckoPHPUnitTest.php';
require_once __DIR__.'/PHPUnit/Tests/AbstractGeckoPHPUnitFileTest.php';

0 comments on commit 5b9e962

Please sign in to comment.