Skip to content

Commit

Permalink
Enhancement: Synchronize with ergebnis/php-package-template
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Nov 18, 2024
1 parent 5758d87 commit f212ba5
Show file tree
Hide file tree
Showing 15 changed files with 229 additions and 941 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ indent_size = 2
[*.md]
indent_size = 2

[*.neon]
indent_style = tab

[*.{yaml,yml}]
indent_size = 2

Expand Down
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
/composer.lock export-ignore
/infection.json export-ignore
/Makefile export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon export-ignore
/rector.php export-ignore
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CONTRIBUTING
# Contributing

We use [GitHub Actions](https://github.com/features/actions) as a continuous integration system.

Expand Down Expand Up @@ -96,7 +96,7 @@ to run a security analysis.

## Static Code Analysis

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

Run

Expand All @@ -106,15 +106,15 @@ make static-code-analysis

to run a static code analysis.

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

Run

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ updates:
open-pull-requests-limit: 10
package-ecosystem: "composer"
schedule:
interval: "daily"
interval: "weekly"
versioning-strategy: "increase"

- commit-message:
Expand All @@ -28,4 +28,4 @@ updates:
open-pull-requests-limit: 10
package-ecosystem: "github-actions"
schedule:
interval: "daily"
interval: "weekly"
12 changes: 6 additions & 6 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ jobs:
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run vimeo/psalm"
run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4"
- name: "Run phpstan/phpstan"
run: "vendor/bin/phpstan --ansi --configuration=phpstan.neon --memory-limit=-1"

tests:
name: "Tests"
Expand Down Expand Up @@ -483,14 +483,14 @@ jobs:
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Remove platform configuration with composer"
if: "matrix.dependencies != 'locked'"
run: "composer config platform --ansi --unset"

- name: "Remove incompatible dependencies with composer"
if: "matrix.dependencies != 'locked'"
run: "composer remove ergebnis/composer-normalize ergebnis/license ergebnis/php-cs-fixer-config infection/infection psalm/plugin-phpunit phpunit/phpunit rector/rector vimeo/psalm --ansi --dev --no-interaction --no-progress"

- name: "Remove platform configuration with composer"
if: "matrix.dependencies != 'locked'"
run: "composer config platform.php --ansi --unset"

- name: "Require phpunit/phpunit"
if: "matrix.dependencies != 'locked'"
run: "composer require phpunit/phpunit:\"^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.6.16\" --ansi --dev --no-interaction --no-progress"
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="~3.8.0" installed="3.8.0" location="./.phive/composer-require-checker" copy="false"/>
<phar name="composer-require-checker" version="~3.8.0" installed="3.8.0" location="./.phive/composer-require-checker" copy="false"/>
</phive>
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ security-analysis: vendor ## Runs a security analysis with composer
composer audit

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --show-info=false --stats --threads=4
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan
vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon
vendor/bin/phpstan --configuration=phpstan.neon --memory-limit=-1

.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with vimeo/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan
vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon
vendor/bin/phpstan --allow-empty-baseline --configuration=phpstan.neon --generate-baseline=phpstan-baseline.neon --memory-limit=-1

.PHONY: tests
tests: vendor ## Runs unit tests with phpunit/phpunit
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
[![Renew](https://github.com/ergebnis/clock/workflows/Renew/badge.svg)](https://github.com/ergebnis/clock/actions)

[![Code Coverage](https://codecov.io/gh/ergebnis/clock/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/clock)
[![Type Coverage](https://shepherd.dev/github/ergebnis/clock/coverage.svg)](https://shepherd.dev/github/ergebnis/clock)

[![Latest Stable Version](https://poser.pugx.org/ergebnis/clock/v/stable)](https://packagist.org/packages/ergebnis/clock)
[![Total Downloads](https://poser.pugx.org/ergebnis/clock/downloads)](https://packagist.org/packages/ergebnis/clock)
[![Monthly Downloads](http://poser.pugx.org/ergebnis/clock/d/monthly)](https://packagist.org/packages/ergebnis/clock)

This project provides a [`composer`](https://getcomposer.org) package with abstractions of a clock, following the suggestion by [Martin Fowler](https://martinfowler.com/bliki/ClockWrapper.html), and compatible with [PSR-20](https://www.php-fig.org/psr/psr-20/).
This project provides a [GitHub repository template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for a [`composer`](https://getcomposer.org) package with [GitHub Actions](https://docs.github.com/en/actions) workflows using standard PHP development tools.

## Installation

Expand Down Expand Up @@ -126,7 +125,7 @@ The maintainers of this project suggest following the [contribution guide](.gith

## Code of Conduct

The maintainers of this project ask contributors to follow the [code of conduct](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).
The maintainers of this project ask contributors to follow the [code of conduct](.github/CODE_OF_CONDUCT.md).

## General Support Policy

Expand Down
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
"ergebnis/license": "^2.5.0",
"ergebnis/php-cs-fixer-config": "^6.37.0",
"infection/infection": "~0.26.6",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^1.12.10",
"phpstan/phpstan-deprecation-rules": "^1.2.1",
"phpstan/phpstan-phpunit": "^1.4.0",
"phpstan/phpstan-strict-rules": "^1.6.1",
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.6.16",
"psalm/plugin-phpunit": "~0.19.0",
"rector/rector": "^1.2.10",
"vimeo/psalm": "^5.26.1"
"rector/rector": "^1.2.10"
},
"provide": {
"psr/clock-implementation": "1.0.0"
Expand All @@ -50,7 +53,8 @@
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"infection/extension-installer": true
"infection/extension-installer": true,
"phpstan/extension-installer": true
},
"audit": {
"abandoned": "report"
Expand All @@ -62,6 +66,9 @@
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "2.9-dev"
},
"composer-normalize": {
"indent-size": 2,
"indent-style": "space"
Expand Down
Loading

0 comments on commit f212ba5

Please sign in to comment.