Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ about what you're working on, you can contact us via the
```

to automatically fix coding standard issues.
- Run

```shell
make static-analysis
```

to run a static analysis or, if applicable, run

```shell
make static-analysis-baseline
```

to regenerate the baseline.
- Review the change once more just before submitting it.

## What happens after submitting contribution?
Expand Down Expand Up @@ -134,6 +147,20 @@ Having said that, here are the organizational rules:
make coding-standards
```

6. Use reasonable commit messages.
6. Run

```shell
make static-analysis
```

to run a static analysis or, if applicable, run

```shell
make static-analysis-baseline
```

to regenerate the baseline.

7. Use reasonable commit messages.

Thank you for contributing to https://www.php.net!
43 changes: 43 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,49 @@ jobs:
- name: "Validate XML files"
run: "for a in $(find . -name '*.xml'); do xmllint --quiet --noout $a; done"

static-analysis:
name: "Static Analysis"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "8.2"

dependencies:
- "locked"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"

- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "none, curl, dom, json, mbstring, tokenizer, xml, xmlwriter, iconv"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

- name: "Determine composer cache directory"
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v3"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies with composer"
run: "composer install --ansi --no-interaction --no-progress"

- name: "Run static analysis"
run: "vendor/bin/phpstan"

tests:
name: "Tests"

Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ HTTP_HOST:=localhost:8080
CORES?=$(shell (nproc || sysctl -n hw.ncpu) 2> /dev/null)

.PHONY: it
it: coding-standards tests ## Runs all the targets
it: coding-standards static-analysis tests ## Runs all the targets

.PHONY: code-coverage
code-coverage: vendor ## Collects code coverage from running unit tests with phpunit/phpunit
Expand All @@ -18,6 +18,14 @@ coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fix
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: static-analysis
static-analysis: vendor ## Runs a static code analysis
vendor/bin/phpstan

.PHONY: static-analysis-baseline
static-analysis-baseline: vendor ## Generates a baseline for static analysis
vendor/bin/phpstan --generate-baseline

.PHONY: tests
tests: vendor ## Runs unit and end-to-end tests with phpunit/phpunit
vendor/bin/phpunit --configuration=tests/phpunit.xml --testsuite=unit
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"require-dev": {
"ext-curl": "*",
"friendsofphp/php-cs-fixer": "^3.95.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.2",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^11.5.50"
},
"autoload": {
Expand All @@ -29,6 +32,9 @@
"platform": {
"php": "8.2.0"
},
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
170 changes: 169 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading