diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..020231b3
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,17 @@
+root = true
+
+[*]
+charset = utf-8
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.json]
+indent_size = 2
+
+[*.{yaml,yml}]
+indent_size = 2
+
+[Makefile]
+indent_style = tab
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..aefb43ce
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,8 @@
+/.github/ export-ignore
+/tests/ export-ignore
+/.editorconfig export-ignore
+/.gitattributes export-ignore
+/.gitignore export-ignore
+/.php_cs.dist export-ignore
+/Makefile export-ignore
+/phive.xml export-ignore
diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..d9159b22
--- /dev/null
+++ b/.github/CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at am@localheinz.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
new file mode 100644
index 00000000..1b95c247
--- /dev/null
+++ b/.github/CONTRIBUTING.md
@@ -0,0 +1,62 @@
+# CONTRIBUTING
+
+We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system.
+
+For details, take a look at the following workflow configuration files:
+
+- [`workflows/integrate.yaml`](workflows/integrate.yaml)
+- [`workflows/prune.yaml`](workflows/prune.yaml)
+- [`workflows/release.yaml`](workflows/release.yaml)
+- [`workflows/triage.yaml`](workflows/triage.yaml)
+
+## Coding Standards
+
+We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files.
+
+If you do not have `yamllint` installed yet, run
+
+```sh
+$ brew install yamllint
+```
+
+to install `yamllint`.
+
+Run
+
+```sh
+$ make coding-standards
+```
+
+to detect coding standard violations.
+
+## Tests
+
+We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.
+
+Run
+
+```sh
+$ make tests
+```
+
+to run all the tests.
+
+## Extra lazy?
+
+Run
+
+```sh
+$ make
+```
+
+to detect coding standard violations and run tests!
+
+## Help
+
+:bulb: Run
+
+```sh
+$ make help
+```
+
+to display a list of available targets with corresponding descriptions.
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index b19ea81a..e47cb040 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1 +1 @@
-patreon: s_bergmann
+patreon: "s_bergmann"
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000..1788742b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,13 @@
+#### Steps required to reproduce the problem
+
+1.
+2.
+3.
+
+#### Expected Result
+
+*
+
+#### Actual Result
+
+*
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..6020dcb2
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,8 @@
+This PR
+
+* [x]
+* [ ]
+
+Follows #.
+Related to #.
+Fixes #.
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..eb22ef0e
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,27 @@
+# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+
+updates:
+ - commit-message:
+ include: "scope"
+ prefix: "composer"
+ directory: "/"
+ labels:
+ - "dependency"
+ open-pull-requests-limit: 10
+ package-ecosystem: "composer"
+ schedule:
+ interval: "daily"
+ versioning-strategy: "increase"
+
+ - commit-message:
+ include: "scope"
+ prefix: "github-actions"
+ directory: "/"
+ labels:
+ - "dependency"
+ open-pull-requests-limit: 10
+ package-ecosystem: "github-actions"
+ schedule:
+ interval: "daily"
diff --git a/.github/settings.yml b/.github/settings.yml
index 823a0113..4bd99074 100644
--- a/.github/settings.yml
+++ b/.github/settings.yml
@@ -1,7 +1,11 @@
# https://github.com/probot/settings
branches:
- - name: master
+ - name: "master"
+
+ # https://docs.github.com/en/rest/reference/repos#delete-branch-protection
+ # https://docs.github.com/en/rest/reference/repos#update-branch-protection
+
protection:
enforce_admins: false
required_pull_request_reviews:
@@ -10,28 +14,61 @@ branches:
required_approving_review_count: 1
required_status_checks:
contexts:
- - "Travis CI - Branch"
- - "Travis CI - Pull Request"
+ - "Tests (7.1, highest)"
+ - "Tests (7.1, lowest)"
+ - "Tests (7.2, highest)"
+ - "Tests (7.2, lowest)"
+ - "Tests (7.3, highest)"
+ - "Tests (7.3, lowest)"
strict: false
restrictions: null
+# https://docs.github.com/en/rest/reference/issues#create-a-label
+# https://docs.github.com/en/rest/reference/issues#update-a-label
+
labels:
- - name: bug
- color: ee0701
+ - name: "bug"
+ color: "ee0701"
+ description: ""
+
+ - name: "dependency"
+ color: "0366d6"
+ description: ""
+
+ - name: "enhancement"
+ color: "0e8a16"
+ description: ""
+
+ - name: "merge"
+ color: "6f42c1"
+ description: ""
+
+ - name: "question"
+ color: "cc317c"
+ description: ""
+
+ - name: "security"
+ color: "ee0701"
+ description: ""
+
+ - name: "stale"
+ color: "eeeeee"
+ description: ""
- - name: enhancement
- color: 0e8a16
+# https://docs.github.com/en/rest/reference/repos#update-a-repository
repository:
allow_merge_commit: true
allow_rebase_merge: false
allow_squash_merge: false
- default_branch: master
+ archived: false
+ default_branch: "master"
+ delete_branch_on_merge: true
description: ":fork_and_knife: Fork of sebastian/diff for use with ergebnis/composer-normalize."
has_downloads: true
has_issues: false
has_pages: false
has_projects: false
has_wiki: false
- name: diff
+ name: "diff"
private: false
diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml
new file mode 100644
index 00000000..0cc882ca
--- /dev/null
+++ b/.github/workflows/integrate.yaml
@@ -0,0 +1,122 @@
+# https://docs.github.com/en/actions
+
+name: "Integrate"
+
+on: # yamllint disable-line rule:truthy
+ pull_request: null
+ push:
+ branches:
+ - "main"
+
+jobs:
+ coding-standards:
+ name: "Coding Standards"
+
+ runs-on: "ubuntu-latest"
+
+ strategy:
+ matrix:
+ php-version:
+ - "7.1"
+
+ dependencies:
+ - "locked"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2.3.1"
+
+ - name: "Lint YAML files"
+ uses: "ibiqlik/action-yamllint@v1"
+ with:
+ config_file: ".yamllint.yaml"
+ file_or_dir: "."
+ strict: true
+
+ tests:
+ name: "Tests"
+
+ runs-on: "ubuntu-latest"
+
+ strategy:
+ matrix:
+ php-version:
+ - "7.1"
+ - "7.2"
+ - "7.3"
+
+ dependencies:
+ - "lowest"
+ - "highest"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2.3.1"
+
+ - name: "Install PHP with extensions"
+ uses: "shivammathur/setup-php@v2"
+ with:
+ coverage: "none"
+ php-version: "${{ matrix.php-version }}"
+
+ - name: "Determine composer cache directory"
+ id: "determine-composer-cache-directory"
+ run: "echo \"::set-output name=directory::$(composer config cache-dir)\""
+
+ - name: "Cache dependencies installed with composer"
+ uses: "actions/cache@v2"
+ with:
+ path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
+ key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
+ restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
+
+ - name: "Install lowest dependencies from composer.json"
+ if: "matrix.dependencies == 'lowest'"
+ run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"
+
+ - name: "Install locked dependencies from composer.lock"
+ if: "matrix.dependencies == 'locked'"
+ run: "composer install --no-interaction --no-progress --no-suggest"
+
+ - name: "Install highest dependencies from composer.json"
+ if: "matrix.dependencies == 'highest'"
+ run: "composer update --no-interaction --no-progress --no-suggest"
+
+ - name: "Run tests with phpunit/phpunit"
+ run: "vendor/bin/phpunit --configuration=phpunit.xml"
+
+ merge:
+ name: "Merge"
+
+ runs-on: "ubuntu-latest"
+
+ needs:
+ - "tests"
+
+ if: >
+ github.event_name == 'pull_request' &&
+ github.event.pull_request.draft == false && (
+ github.event.action == 'opened' ||
+ github.event.action == 'reopened' ||
+ github.event.action == 'synchronize'
+ ) && (
+ (github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'composer(deps-dev)')) ||
+ (github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'github-actions(deps)')) ||
+ (github.actor == 'localheinz' && contains(github.event.pull_request.labels.*.name, 'merge'))
+ )
+
+ steps:
+ - name: "Merge pull request"
+ uses: "actions/github-script@v2"
+ with:
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
+ script: |
+ const pullRequest = context.payload.pull_request
+ const repository = context.repo
+
+ await github.pulls.merge({
+ merge_method: "merge",
+ owner: repository.owner,
+ pull_number: pullRequest.number,
+ repo: repository.repo,
+ })
diff --git a/.github/workflows/prune.yaml b/.github/workflows/prune.yaml
new file mode 100644
index 00000000..9f93aa68
--- /dev/null
+++ b/.github/workflows/prune.yaml
@@ -0,0 +1,31 @@
+# https://docs.github.com/en/actions
+
+name: "Prune"
+
+on: # yamllint disable-line rule:truthy
+ schedule:
+ - cron: "0 12 * * *"
+
+jobs:
+ prune:
+ name: "Issues"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Prune issues and pull requests"
+ uses: "actions/stale@v3"
+ with:
+ days-before-close: 5
+ days-before-stale: 60
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
+ stale-issue-label: "stale"
+ stale-issue-message: |
+ Since this issue has not had any activity within the last sixty days, I have marked it as stale.
+
+ I will close it if no further activity occurs within the next five days.
+ stale-pr-label: "stale"
+ stale-pr-message: |
+ Since this pull request has not had any activity within the last sixty days, I have marked it as stale.
+
+ I will close it if no further activity occurs within the next five days.
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 00000000..1b0fe494
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,29 @@
+# https://docs.github.com/en/actions
+
+name: "Release"
+
+on: # yamllint disable-line rule:truthy
+ push:
+ tags:
+ - "**"
+
+jobs:
+ release:
+ name: "Release"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Determine tag"
+ id: "determine-tag"
+ run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\""
+
+ - name: "Create release"
+ uses: "actions/create-release@v1.1.1"
+ env:
+ GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+ with:
+ draft: false
+ prerelease: false
+ release_name: "${{ steps.determine-tag.outputs.tag }}"
+ tag_name: "${{ steps.determine-tag.outputs.tag }}"
diff --git a/.github/workflows/triage.yaml b/.github/workflows/triage.yaml
new file mode 100644
index 00000000..1790b817
--- /dev/null
+++ b/.github/workflows/triage.yaml
@@ -0,0 +1,45 @@
+# https://docs.github.com/en/actions
+
+name: "Triage"
+
+on: # yamllint disable-line rule:truthy
+ pull_request:
+ types:
+ - "opened"
+
+jobs:
+ label:
+ name: "Label"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Add labels based on branch name"
+ uses: "actions/github-script@v2"
+ with:
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
+ script: |
+ const branchPrefixLabels = {
+ feature: "enhancement",
+ fix: "bug",
+ }
+
+ const pullRequest = context.payload.pull_request
+ const repository = context.repo
+
+ const branchName = pullRequest.head.ref
+
+ const matches = branchName.match(new RegExp('^([^/]+)\/'));
+
+ if (matches instanceof Array && branchPrefixLabels.hasOwnProperty(matches[1])) {
+ const label = branchPrefixLabels[matches[1]]
+
+ github.issues.addLabels({
+ issue_number: pullRequest.number,
+ labels: [
+ label
+ ],
+ owner: repository.owner,
+ repo: repository.repo,
+ });
+ }
diff --git a/.gitignore b/.gitignore
index 35dc2118..2726cad3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
-/.idea
+/.build/
+/.notes/
+/vendor/
+/from.txt.orig
/composer.lock
-/vendor
-/.php_cs.cache
-/.phpunit.result.cache
-/from.txt.orig
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index d96c8bf7..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-language: php
-
-env:
- global:
- - secure: "Qh1la5ftgwh6pGgNZaAxnCdIIj8sANQifZYtHubaOeadSj1IjNndfgVtYBr2sx+ID/CO5DcLsVvpZJgyDIO8+jGCCXAxWiaXcMoEEc38CJpW+aQfhoZ15gkAHrmWh1u9T8fcrCizjtq7OzUS7Huc8D7g1uGFieP5PR//ywFOH3Gn9J2tzJwxIJoq0hqIBcW/BmbNVbHr9WFyU1L6L/lTLVgt9xadypo0Y3B36vkOPuq5TsqoJ+rbmLWRn2KGK2/PXzuNEfSRV2HGaYtyyYtLKYr3F+Dem7ckF6Zyjh6QqfHECxZkywdBRx/8SztZJAa0cUwIMSllBkYon4aLfSWvyRQJWEbZhCUFEacJIF8mZnhi/rXNakbJOySqiQWBL2PFJ0K51nWbHfYKNS71Z5chXav6dkQSxXKCDzARXmx3L8rpIJ2tXuWmcnR0Zn11EDzaPp65IpL1W3zlAxEKCmfW1XKiU8n0D72/8fqTXgrbbJ62VieclSW0rqJLXj040+r6zHACNJ1DN6UAuvanSnQ/CeewtFLlYxzt1QfROb5gKRTFsg4Dk3Lg1gEn6ZLPsrmvILxzLJV0C9UjRowlJ72EFE1TiRsXyMxW80I2CrPOtOrEswV5yHhZlZsT3SpBqtixr/o2dNtoogzbzarGL/vH9tmKH115LamzenpU0ZYCXnU="
-
-cache:
- directories:
- - $HOME/.composer/cache
-
-php:
- - 7.1
- - 7.2
- - 7.3
-
-before_install:
- - phpenv config-rm xdebug.ini
-
-install:
- - composer update --no-ansi --no-interaction --no-progress --no-suggest --optimize-autoloader --prefer-stable
-
-script:
- - ./vendor/bin/phpunit
-
-notifications:
- email: false
-
diff --git a/.yamllint.yaml b/.yamllint.yaml
new file mode 100644
index 00000000..b2129ac2
--- /dev/null
+++ b/.yamllint.yaml
@@ -0,0 +1,66 @@
+extends: "default"
+
+ignore: |
+ .build/
+ .notes/
+ vendor/
+
+rules:
+ braces:
+ max-spaces-inside-empty: 0
+ max-spaces-inside: 1
+ min-spaces-inside-empty: 0
+ min-spaces-inside: 1
+ brackets:
+ max-spaces-inside-empty: 0
+ max-spaces-inside: 0
+ min-spaces-inside-empty: 0
+ min-spaces-inside: 0
+ colons:
+ max-spaces-after: 1
+ max-spaces-before: 0
+ commas:
+ max-spaces-after: 1
+ max-spaces-before: 0
+ min-spaces-after: 1
+ comments:
+ ignore-shebangs: true
+ min-spaces-from-content: 1
+ require-starting-space: true
+ comments-indentation: "enable"
+ document-end:
+ present: false
+ document-start:
+ present: false
+ indentation:
+ check-multi-line-strings: false
+ indent-sequences: true
+ spaces: 2
+ empty-lines:
+ max-end: 0
+ max-start: 0
+ max: 1
+ empty-values:
+ forbid-in-block-mappings: true
+ forbid-in-flow-mappings: true
+ hyphens:
+ max-spaces-after: 2
+ key-duplicates: "enable"
+ key-ordering: "disable"
+ line-length: "disable"
+ new-line-at-end-of-file: "enable"
+ new-lines:
+ type: "unix"
+ octal-values:
+ forbid-implicit-octal: true
+ quoted-strings:
+ quote-type: "double"
+ trailing-spaces: "enable"
+ truthy:
+ allowed-values:
+ - "false"
+ - "true"
+
+yaml-files:
+ - "*.yaml"
+ - "*.yml"
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..2dbd71b4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+.PHONY: it
+it: coding-standards tests ## Runs the coding-standards and tests targets
+
+.PHONY: coding-standards
+coding-standards: vendor ## Lints YAML files with yamllint
+ yamllint -c .yamllint.yaml --strict .
+
+.PHONY: help
+help: ## Displays this list of targets with descriptions
+ @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
+
+.PHONY: tests
+tests: vendor ## Runs tests with phpunit/phpunit
+ mkdir -p .build/phpunit
+ vendor/bin/phpunit --configuration=phpunit.xml
+
+vendor: composer.json
+ composer validate --strict
+ composer install --no-interaction --no-progress --no-suggest
diff --git a/README.md b/README.md
index 794c12f0..194292c4 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,11 @@
-# localheinz/diff
+# diff
+
+[![Integrate](https://github.com/localheinz/diff/workflows/Integrate/badge.svg?branch=main)](https://github.com/localheinz/diff/actions)
+[![Prune](https://github.com/localheinz/diff/workflows/Prune/badge.svg?branch=main)](https://github.com/localheinz/diff/actions)
+[![Release](https://github.com/localheinz/diff/workflows/Release/badge.svg?branch=main)](https://github.com/localheinz/diff/actions)
+
+[![Latest Stable Version](https://poser.pugx.org/localheinz/diff/v/stable)](https://packagist.org/packages/localheinz/diff)
+[![Total Downloads](https://poser.pugx.org/localheinz/diff/downloads)](https://packagist.org/packages/localheinz/diff)
This is a fork of [`sebastian/diff`](https://github.com/sebastianbergmann/diff) for use with [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize), with permission from Sebastian Bergmann.
diff --git a/build.xml b/build.xml
deleted file mode 100644
index fa7b7e2b..00000000
--- a/build.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/phpunit.xml b/phpunit.xml
index 345c12b8..b85b6639 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -6,6 +6,7 @@
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
+ cacheResultFile=".build/phpunit/cache"
verbose="true">