Skip to content

Commit

Permalink
Merge pull request #150 from ergebnis/feature/synchronize
Browse files Browse the repository at this point in the history
Enhancement: Synchronize with `ergebnis/php-package-template`
  • Loading branch information
localheinz authored Oct 10, 2023
2 parents 6bb95f5 + b109b72 commit 3e491e3
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 14 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
Expand Down
139 changes: 139 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# 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/merge.yaml`](workflows/merge.yaml)
- [`workflows/release.yaml`](workflows/release.yaml)
- [`workflows/renew.yaml`](workflows/renew.yaml)
- [`workflows/triage.yaml`](workflows/triage.yaml)

## Coding Standards

We are using [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.

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`.

We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards in PHP files.

Run

```sh
make coding-standards
```

to automatically fix coding standard violations.

## Dependency Analysis

We are using [`maglnet/composer-require-checker`](https://github.com/maglnet/ComposerRequireChecker) to prevent the use of unknown symbols in production code.

Run

```sh
make dependency-analysis
```

to run a dependency analysis.

## Mutation Tests

We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests.

Enable `Xdebug` and run

```sh
make mutation-tests
```

to run mutation tests.

## Refactoring

We are using [`rector/rector`](https://github.com/rectorphp/rector) to automatically refactor code.

Run

```sh
make refactoring
```

to automatically refactor code.

## Security Analysis

We are using [`composer`](https://github.com/composer/composer) to run a security analysis.

Run

```sh
make security-analysis
```

to run a security analysis.

## Static Code Analysis

We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code.

Run

```sh
make static-code-analysis
```

to run a static code analysis.

We are also using the baseline features of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline) and [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file).

Run

```sh
make static-code-analysis-baseline
```

to regenerate the baselines in [`../phpstan-baseline.neon`](../phpstan-baseline.neon) and [`../psalm-baseline.xml`](../psalm-baseline.xml).

:exclamation: Ideally, the baselines should shrink over time.

## 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 automatically refactor code, enforce coding standards, run a static code analysis, and run tests!

## Help

:bulb: Run

```sh
make help
```

to display a list of available targets with corresponding descriptions.
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://github.com/probot/settings
# https://github.com/repository-settings/app

branches:
- name: "main"
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down Expand Up @@ -73,6 +75,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down Expand Up @@ -143,6 +147,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down Expand Up @@ -190,13 +196,15 @@ jobs:
trust-gpg-keys: "0x033E5F8D801A2F8D"

- name: "Run maglnet/composer-require-checker"
run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json"
run: ".phive/composer-require-checker check --ansi --config-file=$(pwd)/composer-require-checker.json --verbose"

mutation-tests:
name: "Mutation Tests"

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down Expand Up @@ -247,6 +255,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down Expand Up @@ -307,6 +317,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down Expand Up @@ -355,6 +367,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down Expand Up @@ -406,6 +420,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

steps:
- name: "Create release"
uses: "ergebnis/.github/actions/github/release/[email protected]"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/renew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/triage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

runs-on: "ubuntu-latest"

timeout-minutes: 5

steps:
- name: "Add labels based on branch name"
uses: "ergebnis/.github/actions/github/pull-request/[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="composer-require-checker" version="^4.6.0" installed="4.6.0" location="./.phive/composer-require-checker" copy="false"/>
<phar name="composer-require-checker" version="^4.7.0" installed="4.7.0" location="./.phive/composer-require-checker" copy="false"/>
</phive>
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.

.PHONY: dependency-analysis
dependency-analysis: phive vendor ## Runs a dependency analysis with maglnet/composer-require-checker
.phive/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json
.phive/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json --verbose

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand Down
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,36 @@ $json = Json\Json::fromFile(__DIR__ . '/contains-json.json'); // instance of Jso
## Changelog
Please have a look at [`CHANGELOG.md`](CHANGELOG.md).
The maintainers of this package record notable changes to this project in a [changelog](CHANGELOG.md).
## Contributing
Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).
The maintainers of this package suggest following the [contribution guide](.github/CONTRIBUTING.md).
## Code of Conduct
Please have a look at [`CODE_OF_CONDUCT.md`](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).
The maintainers of this package ask contributors to follow the [code of conduct](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).
## General Support Policy
The maintainers of this package provide limited support.
You can support the maintenance of this package by [sponsoring @localheinz](https://github.com/sponsors/localheinz) or [requesting an invoice for services related to this package](mailto:[email protected]?subject=ergebnis/json:%20Requesting%20invoice%20for%20services).
## PHP Version Support Policy
This package supports PHP versions with [active support](https://www.php.net/supported-versions.php).
The maintainers of this package add support for a PHP version following its initial release and drop support for a PHP version when it has reached its end of active support.
## Security Policy
Please have a look at [`SECURITY.md`](.github/SECURITY.md).
This package has a [security policy](.github/SECURITY.md).
## License
This package is licensed using the MIT License.
Please have a look at [`LICENSE.md`](LICENSE.md).
This package uses the [MIT license](LICENSE.md).
## Curious what I am up to?
## Social
Follow me on [Twitter](https://twitter.com/intent/follow?screen_name=localheinz)!
Follow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.
2 changes: 1 addition & 1 deletion test/Util/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait Helper
final protected static function faker(string $locale = 'en_US'): Generator
{
/**
* @var array<string, Generator>
* @var array<string, Generator> $fakers
*/
static $fakers = [];

Expand Down

0 comments on commit 3e491e3

Please sign in to comment.