Skip to content

Commit

Permalink
Merge pull request #53 from bbatsche/2.0
Browse files Browse the repository at this point in the history
2.1
  • Loading branch information
bbatsche authored Jul 23, 2020
2 parents 8c3157c + 995875a commit 2706929
Show file tree
Hide file tree
Showing 27 changed files with 1,761 additions and 1,123 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and miscellaneous support files with "export-ignore".
/.* export-ignore
/hooks export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml export-ignore
/test export-ignore
161 changes: 158 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,160 @@
vendor
.idea
# Created by https://www.toptal.com/developers/gitignore/api/macos,linux,composer,intellij+all,phpunit
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,linux,composer,intellij+all,phpunit

### Composer ###
composer.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
composer.lock
.php_cs.cache

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### PHPUnit ###
# Covers PHPUnit
# Reference: https://phpunit.de/

# Generated files
.phpunit.result.cache

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

# End of https://www.toptal.com/developers/gitignore/api/macos,linux,composer,intellij+all,phpunit
/.php_cs.cache
/phpstan.neon
102 changes: 42 additions & 60 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,50 @@

$finder = PhpCsFixer\Finder::create()
->in('src')
->in('test');
->in('test')
->notName('function.php'); // no_superfluous_php_doc_tags does not play well with function.php
// basically treat rule & file as mutually exclusive; either have one or the other

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'align_multiline_comment' => ['comment_type' => 'all_multiline'],
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['default' => 'align_single_space_minimal'],
'class_attributes_separation' => ['elements' => ['const', 'method', 'property']],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'comment_to_phpdoc' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'date_time_immutable' => true,
'escape_implicit_backslashes' => ['single_quoted' => true],
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'fully_qualified_strict_types' => true,
'heredoc_to_nowdoc' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => true,
'method_chaining_indentation' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => true,
'native_function_invocation' => true,
'no_alternative_syntax' => true,
'no_extra_blank_lines' => [
'tokens' => [
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'switch',
'throw',
'use',
],
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => [
'default' => 'align_single_space_minimal',
'operators' => ['||' => null, '&&' => null]
],
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_superfluous_elseif' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => ['sortAlgorithm' => 'alpha'],
'ordered_imports' => ['importsOrder' => ['const', 'class', 'function']],
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
'phpdoc_order' => true,
'phpdoc_types_order' => ['sort_algorithm' => 'none', 'null_adjustment' => 'always_last'],
'psr0' => true,
'simplified_null_return' => true,
'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']],
'yoda_style' => false,
'class_attributes_separation' => ['elements' => ['const', 'method', 'property']],
'class_definition' => [
'single_item_single_line' => true,
'multi_line_extends_each_single_line' => true,
],
'concat_space' => ['spacing' => 'one'],
'date_time_immutable' => true,
'final_static_access' => true,
'global_namespace_import' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => true,
'mb_str_functions' => true,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'no_unset_on_property' => false,
'ordered_class_elements' => ['sortAlgorithm' => 'alpha'],
'ordered_imports' => ['imports_order' => ['const', 'class', 'function']],
'phpdoc_line_span' => ['const' => 'single', 'property' => 'single'],
'phpdoc_no_empty_return' => false,
'phpdoc_types_order' => ['sort_algorithm' => 'none', 'null_adjustment' => 'always_last'],
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
'php_unit_test_class_requires_covers' => false,
'psr0' => ['dir' => 'src'],
'self_static_accessor' => true,
'simplified_null_return' => true,
'yoda_style' => false,
])
->setFinder($finder);
->setFinder($finder)
->setRiskyAllowed(true);
69 changes: 61 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,81 @@
language: php

php:
- 7
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

env:
- PHPUNIT_VERSION=6.0
- PHPUNIT_VERSION=7.0
- PHPUNIT_VERSION=6 TEST_SUITE=unit
- PHPUNIT_VERSION=7 TEST_SUITE=static
- PHPUNIT_VERSION=7 TEST_SUITE=unit
- PHPUNIT_VERSION=8 TEST_SUITE=static
- PHPUNIT_VERSION=8 TEST_SUITE=unit
- PHPUNIT_VERSION=9 TEST_SUITE=static
- PHPUNIT_VERSION=9 TEST_SUITE=unit

matrix:
exclude:
- php: 7
env: PHPUNIT_VERSION=7.0
# PHP 7.0
- php: 7.0
env: PHPUNIT_VERSION=7 TEST_SUITE=static
- php: 7.0
env: PHPUNIT_VERSION=7 TEST_SUITE=unit
- php: 7.0
env: PHPUNIT_VERSION=8 TEST_SUITE=static
- php: 7.0
env: PHPUNIT_VERSION=8 TEST_SUITE=unit
- php: 7.0
env: PHPUNIT_VERSION=9 TEST_SUITE=static
- php: 7.0
env: PHPUNIT_VERSION=9 TEST_SUITE=unit

# PHP 7.1
- php: 7.1
env: PHPUNIT_VERSION=8 TEST_SUITE=static
- php: 7.1
env: PHPUNIT_VERSION=8 TEST_SUITE=unit
- php: 7.1
env: PHPUNIT_VERSION=9 TEST_SUITE=static
- php: 7.1
env: PHPUNIT_VERSION=9 TEST_SUITE=unit

# PHP 7.2
- php: 7.2
env: PHPUNIT_VERSION=9 TEST_SUITE=static
- php: 7.2
env: PHPUNIT_VERSION=9 TEST_SUITE=unit

# PHP 7.3
- php: 7.3
env: PHPUNIT_VERSION=6 TEST_SUITE=unit

# PHP 7.4
- php: 7.4
env: PHPUNIT_VERSION=6 TEST_SUITE=unit
- php: 7.4
env: PHPUNIT_VERSION=7 TEST_SUITE=static
- php: 7.4
env: PHPUNIT_VERSION=7 TEST_SUITE=unit

sudo: false

before_install:
# Remove some dependencies that aren't needed for static test suite and are incompatible with PHP 7 or PHPUnit 6
- if [ $TEST_SUITE == "unit" ]; then composer remove --dev ergebnis/composer-normalize maglnet/composer-require-checker phpstan/phpstan phpstan/phpstan-mockery phpstan/phpstan-phpunit phpstan/phpstan-strict-rules; fi

install:
- composer require phpunit/phpunit:^$PHPUNIT_VERSION --update-no-dev --no-interaction --prefer-dist --no-progress --no-suggest --update-with-all-dependencies
- if [ -e composer.lock ]; then rm -rf composer.lock vendor; fi
- if [ -e phpstan.phpunit${PHPUNIT_VERSION}.neon ]; then cp phpstan.phpunit${PHPUNIT_VERSION}.neon phpstan.neon; fi
- composer require phpunit/phpunit:^${PHPUNIT_VERSION}.0 --update-no-dev --no-interaction --prefer-dist --no-progress --no-suggest --update-with-all-dependencies
- travis_retry composer install --dev --no-interaction --prefer-dist

script:
- composer cs-check
- composer test-coverage
- if [ $TEST_SUITE == "static" ]; then composer style:check; fi
- if [ $TEST_SUITE == "static" ]; then composer test:static; fi
- if [ $TEST_SUITE == "unit" ]; then composer test:coverage; fi

after_success:
- bash <(curl -s https://codecov.io/bash)
Loading

0 comments on commit 2706929

Please sign in to comment.