Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

[*.{php,phpt}]
indent_style = tab
indent_size = 4

[*.xml]
indent_style = tab
indent_size = 4

[*.neon]
indent_style = tab
indent_size = 4

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

[composer.json]
indent_style = tab
indent_size = 4
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.php text eol=lf

.github export-ignore
tests export-ignore
tmp export-ignore
.gitattributes export-ignore
.gitignore export-ignore
Makefile export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
19 changes: 19 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": [
"config:base",
"schedule:weekly"
],
"rangeStrategy": "update-lockfile",
"packageRules": [
{
"matchPaths": ["+(composer.json)"],
"enabled": true,
"groupName": "root-composer"
},
{
"matchPaths": [".github/**"],
"enabled": true,
"groupName": "github-actions"
}
]
}
149 changes: 149 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Build"

on:
pull_request:
push:
branches:
- "1.0.x"

jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: "mongodb"

- name: "Validate Composer"
run: "composer validate"

- name: "Allow installing on PHP 8.4"
if: matrix.php-version == '8.4'
run: "composer config platform.php 8.3.99"

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

- name: "Lint"
run: "make lint"

coding-standard:
name: "Coding Standard"

runs-on: "ubuntu-latest"

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

- name: "Checkout build-cs"
uses: actions/checkout@v5
with:
repository: "phpstan/build-cs"
path: "build-cs"
ref: "2.x"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.2"
ini-file: development

- name: "Validate Composer"
run: "composer validate"

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

- name: "Install build-cs dependencies"
working-directory: "build-cs"
run: "composer install --no-interaction --no-progress"

- name: "Lint"
run: "make lint"

- name: "Coding Standard"
run: "make cs"

tests:
name: "Tests"
runs-on: "ubuntu-latest"

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "xdebug"
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: "mongodb"

- name: "Allow installing on PHP 8.4"
if: matrix.php-version == '8.4'
run: "composer config platform.php 8.3.99"

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

- name: "Tests"
run: "make tests"

static-analysis:
name: "PHPStan"
runs-on: "ubuntu-latest"

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-file: development

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

- name: "PHPStan"
run: "make phpstan"
53 changes: 53 additions & 0 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Create tag"

on:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:
inputs:
version:
description: 'Next version'
required: true
default: 'patch'
type: choice
options:
- patch
- minor

jobs:
create-tag:
name: "Create tag"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}

- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: 'Get next versions'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}

- name: "Create new minor tag"
uses: rickstaa/action-create-tag@v1
if: inputs.version == 'minor'
with:
tag: ${{ steps.semvers.outputs.minor }}
message: ${{ steps.semvers.outputs.minor }}

- name: "Create new patch tag"
uses: rickstaa/action-create-tag@v1
if: inputs.version == 'patch'
with:
tag: ${{ steps.semvers.outputs.patch }}
message: ${{ steps.semvers.outputs.patch }}
21 changes: 21 additions & 0 deletions .github/workflows/release-toot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Toot release

# More triggers
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#release
on:
release:
types: [published]

jobs:
toot:
runs-on: ubuntu-latest
steps:
- uses: cbrgm/mastodon-github-action@v2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this release toot/tweet stuff for this repo?

if: ${{ !github.event.repository.private }}
with:
# GitHub event payload
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release
message: "New release: ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} ${{ github.event.release.html_url }} #phpstan"
env:
MASTODON_URL: https://phpc.social
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/release-tweet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tweet release

# More triggers
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#release
on:
release:
types: [published]

jobs:
tweet:
runs-on: ubuntu-latest
steps:
- uses: Eomm/why-don-t-you-tweet@v2
if: ${{ !github.event.repository.private }}
with:
# GitHub event payload
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release
tweet-message: "New release: ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} ${{ github.event.release.html_url }} #phpstan"
env:
# Get your tokens from https://developer.twitter.com/apps
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Create release"

on:
push:
tags:
- '*'

jobs:
deploy:
name: "Deploy"
runs-on: "ubuntu-latest"

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

- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }}

- name: "Create release"
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.changelog.outputs.changelog }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/tests/tmp
/build-cs
/vendor
/composer.lock
/.env
.phpunit.result.cache
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2016 Ondřej Mirtes
Copyright (c) 2025 PHPStan s.r.o.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading