Skip to content

Commit 9c0b969

Browse files
authored
initial setup
1 parent 16fdbb0 commit 9c0b969

File tree

18 files changed

+624
-0
lines changed

18 files changed

+624
-0
lines changed

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
9+
[*.{php,phpt}]
10+
indent_style = tab
11+
indent_size = 4
12+
13+
[*.xml]
14+
indent_style = tab
15+
indent_size = 4
16+
17+
[*.neon]
18+
indent_style = tab
19+
indent_size = 4
20+
21+
[*.{yaml,yml}]
22+
indent_style = space
23+
indent_size = 2
24+
25+
[composer.json]
26+
indent_style = tab
27+
indent_size = 4

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.php text eol=lf
2+
3+
.github export-ignore
4+
tests export-ignore
5+
tmp export-ignore
6+
.gitattributes export-ignore
7+
.gitignore export-ignore
8+
Makefile export-ignore
9+
phpstan.neon export-ignore
10+
phpunit.xml export-ignore

.github/renovate.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": [
3+
"config:base",
4+
"schedule:weekly"
5+
],
6+
"rangeStrategy": "update-lockfile",
7+
"packageRules": [
8+
{
9+
"matchPaths": ["+(composer.json)"],
10+
"enabled": true,
11+
"groupName": "root-composer"
12+
},
13+
{
14+
"matchPaths": [".github/**"],
15+
"enabled": true,
16+
"groupName": "github-actions"
17+
}
18+
]
19+
}

.github/workflows/build.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Build"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "1.0.x"
10+
11+
jobs:
12+
lint:
13+
name: "Lint"
14+
runs-on: "ubuntu-latest"
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
php-version:
20+
- "8.2"
21+
- "8.3"
22+
- "8.4"
23+
24+
steps:
25+
- name: "Checkout"
26+
uses: actions/checkout@v5
27+
28+
- name: "Install PHP"
29+
uses: "shivammathur/setup-php@v2"
30+
with:
31+
coverage: "none"
32+
php-version: "${{ matrix.php-version }}"
33+
ini-file: development
34+
extensions: "mongodb"
35+
36+
- name: "Validate Composer"
37+
run: "composer validate"
38+
39+
- name: "Allow installing on PHP 8.4"
40+
if: matrix.php-version == '8.4'
41+
run: "composer config platform.php 8.3.99"
42+
43+
- name: "Install dependencies"
44+
run: "composer install --no-interaction --no-progress"
45+
46+
- name: "Lint"
47+
run: "make lint"
48+
49+
coding-standard:
50+
name: "Coding Standard"
51+
52+
runs-on: "ubuntu-latest"
53+
54+
steps:
55+
- name: "Checkout"
56+
uses: actions/checkout@v5
57+
58+
- name: "Checkout build-cs"
59+
uses: actions/checkout@v5
60+
with:
61+
repository: "phpstan/build-cs"
62+
path: "build-cs"
63+
ref: "2.x"
64+
65+
- name: "Install PHP"
66+
uses: "shivammathur/setup-php@v2"
67+
with:
68+
coverage: "none"
69+
php-version: "8.2"
70+
ini-file: development
71+
72+
- name: "Validate Composer"
73+
run: "composer validate"
74+
75+
- name: "Install dependencies"
76+
run: "composer install --no-interaction --no-progress"
77+
78+
- name: "Install build-cs dependencies"
79+
working-directory: "build-cs"
80+
run: "composer install --no-interaction --no-progress"
81+
82+
- name: "Lint"
83+
run: "make lint"
84+
85+
- name: "Coding Standard"
86+
run: "make cs"
87+
88+
tests:
89+
name: "Tests"
90+
runs-on: "ubuntu-latest"
91+
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
php-version:
96+
- "8.2"
97+
- "8.3"
98+
- "8.4"
99+
100+
steps:
101+
- name: "Checkout"
102+
uses: actions/checkout@v5
103+
104+
- name: "Install PHP"
105+
uses: "shivammathur/setup-php@v2"
106+
with:
107+
coverage: "xdebug"
108+
php-version: "${{ matrix.php-version }}"
109+
ini-file: development
110+
extensions: "mongodb"
111+
112+
- name: "Allow installing on PHP 8.4"
113+
if: matrix.php-version == '8.4'
114+
run: "composer config platform.php 8.3.99"
115+
116+
- name: "Install dependencies"
117+
run: "composer install --no-interaction --no-progress"
118+
119+
- name: "Tests"
120+
run: "make tests"
121+
122+
static-analysis:
123+
name: "PHPStan"
124+
runs-on: "ubuntu-latest"
125+
126+
strategy:
127+
fail-fast: false
128+
matrix:
129+
php-version:
130+
- "8.2"
131+
- "8.3"
132+
- "8.4"
133+
134+
steps:
135+
- name: "Checkout"
136+
uses: actions/checkout@v5
137+
138+
- name: "Install PHP"
139+
uses: "shivammathur/setup-php@v2"
140+
with:
141+
coverage: "none"
142+
php-version: "${{ matrix.php-version }}"
143+
ini-file: development
144+
145+
- name: "Install dependencies"
146+
run: "composer install --no-interaction --no-progress"
147+
148+
- name: "PHPStan"
149+
run: "make phpstan"

.github/workflows/create-tag.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Create tag"
4+
5+
on:
6+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Next version'
11+
required: true
12+
default: 'patch'
13+
type: choice
14+
options:
15+
- patch
16+
- minor
17+
18+
jobs:
19+
create-tag:
20+
name: "Create tag"
21+
runs-on: "ubuntu-latest"
22+
steps:
23+
- name: "Checkout"
24+
uses: actions/checkout@v5
25+
with:
26+
fetch-depth: 0
27+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
28+
29+
- name: 'Get Previous tag'
30+
id: previoustag
31+
uses: "WyriHaximus/github-action-get-previous-tag@v1"
32+
env:
33+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
34+
35+
- name: 'Get next versions'
36+
id: semvers
37+
uses: "WyriHaximus/github-action-next-semvers@v1"
38+
with:
39+
version: ${{ steps.previoustag.outputs.tag }}
40+
41+
- name: "Create new minor tag"
42+
uses: rickstaa/action-create-tag@v1
43+
if: inputs.version == 'minor'
44+
with:
45+
tag: ${{ steps.semvers.outputs.minor }}
46+
message: ${{ steps.semvers.outputs.minor }}
47+
48+
- name: "Create new patch tag"
49+
uses: rickstaa/action-create-tag@v1
50+
if: inputs.version == 'patch'
51+
with:
52+
tag: ${{ steps.semvers.outputs.patch }}
53+
message: ${{ steps.semvers.outputs.patch }}

.github/workflows/release-toot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Toot release
2+
3+
# More triggers
4+
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#release
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
toot:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: cbrgm/mastodon-github-action@v2
14+
if: ${{ !github.event.repository.private }}
15+
with:
16+
# GitHub event payload
17+
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release
18+
message: "New release: ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} ${{ github.event.release.html_url }} #phpstan"
19+
env:
20+
MASTODON_URL: https://phpc.social
21+
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Tweet release
2+
3+
# More triggers
4+
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#release
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
tweet:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: Eomm/why-don-t-you-tweet@v2
14+
if: ${{ !github.event.repository.private }}
15+
with:
16+
# GitHub event payload
17+
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release
18+
tweet-message: "New release: ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} ${{ github.event.release.html_url }} #phpstan"
19+
env:
20+
# Get your tokens from https://developer.twitter.com/apps
21+
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
22+
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
23+
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
24+
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Create release"
4+
5+
on:
6+
push:
7+
tags:
8+
- '*'
9+
10+
jobs:
11+
deploy:
12+
name: "Deploy"
13+
runs-on: "ubuntu-latest"
14+
15+
steps:
16+
- name: "Checkout"
17+
uses: actions/checkout@v5
18+
19+
- name: Generate changelog
20+
id: changelog
21+
uses: metcalfc/[email protected]
22+
with:
23+
myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }}
24+
25+
- name: "Create release"
26+
id: create-release
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}
30+
with:
31+
tag_name: ${{ github.ref }}
32+
release_name: ${{ github.ref }}
33+
body: ${{ steps.changelog.outputs.changelog }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/tests/tmp
2+
/build-cs
3+
/vendor
4+
/composer.lock
5+
/.env
6+
.phpunit.result.cache

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Ondřej Mirtes
4+
Copyright (c) 2025 PHPStan s.r.o.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

0 commit comments

Comments
 (0)