Skip to content

Commit 0862559

Browse files
authored
Fix PHP stan issues and cleanup code for PHP 8 (#24)
1 parent 7b7cf7b commit 0862559

File tree

139 files changed

+3133
-2348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+3133
-2348
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: "🐞 Bug report"
3+
about: "Create a report to help us improve"
4+
labels: bug
5+
---
6+
7+
## 🐞 Bug report
8+
Please describe the problem you are experiencing.
9+
10+
### Steps to reproduce
11+
Please provide a minimal code snippet and the detailed steps for reproducing the issue.
12+
13+
1. Step 1
14+
2. Step 2
15+
3. Step 3
16+
17+
### Expected behavior
18+
Please describe the behavior you are expecting.
19+
20+
### Screenshots
21+
If applicable, add screenshots to help explain your problem.
22+
23+
### Additional context
24+
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: "✨ Feature request"
3+
about: "Suggest an idea for this project"
4+
labels: enhancement
5+
---
6+
7+
## ✨ Feature request
8+
Please provide a brief explanation of the feature.
9+
10+
### Motivation
11+
Please share the motivation for the new feature, and what problem it is solving.
12+
13+
### Example
14+
If the proposal involves a new or changed API, please include a basic code example.
15+
16+
### Alternatives
17+
Please describe the alternative solutions or features you've considered.
18+
19+
### Additional context
20+
Please provide any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Summary
2+
Please include a summary of the change and which issue is addressed.
3+
4+
- Fixes #(issue 1)
5+
- Fixes #(issue 2)
6+
- Fixes #(issue 3)
7+
8+
### Checklist
9+
10+
- [ ] My code follows the style guidelines of this project
11+
- [ ] I have performed a self-review of my own code
12+
- [ ] I have commented my code, particularly in hard-to-understand areas
13+
- [ ] I have made corresponding changes to the documentation
14+
- [ ] My changes generate no new warnings
15+
- [ ] I have added tests that prove my fix is effective or that my feature works
16+
- [ ] New and existing unit tests pass locally with my changes
17+
- [ ] Any dependent changes have been merged and published in downstream modules
18+
- [ ] I have checked my code and corrected any misspellings

.github/release-drafter.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name-template: '$NEXT_PATCH_VERSION'
2+
tag-template: '$NEXT_PATCH_VERSION'
3+
prerelease: true
4+
categories:
5+
- title: '🚀 Features'
6+
labels:
7+
- feature
8+
- title: '🔧 Enhancements'
9+
labels:
10+
- enhancement
11+
- title: '🐞 Bug Fixes'
12+
labels:
13+
- bug
14+
- title: '🚧 Maintenance'
15+
labels:
16+
- maintenance
17+
change-template: '- $TITLE (#$NUMBER), thanks [$AUTHOR](https://github.com/$AUTHOR)!'
18+
sort-by: merged_at
19+
sort-direction: descending
20+
branches:
21+
- master
22+
exclude-labels:
23+
- wontfix
24+
- duplicate
25+
- invalid
26+
- question
27+
no-changes-template: 'This release contains minor changes and bugfixes.'
28+
template: |-
29+
## What's Changed
30+
31+
$CHANGES
32+
33+
🎉 **Thanks to all contributors helping with this release:**
34+
$CONTRIBUTORS
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Validations
2+
3+
on:
4+
push:
5+
tags-ignore:
6+
- '**'
7+
branches:
8+
- master
9+
pull_request:
10+
types:
11+
- synchronize
12+
- opened
13+
14+
jobs:
15+
security:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: symfonycorp/security-checker-action@v2
20+
21+
composer:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: '8.1'
29+
tools: composer:v2
30+
- name: Composer cache
31+
uses: actions/cache@v2
32+
with:
33+
key: composer-${{ hashFiles('**/composer.lock') }}
34+
path: ${{ github.workspace }}/.cache
35+
- name: Vendor cache
36+
uses: actions/cache@v2
37+
with:
38+
key: vendor-${{ hashFiles('**/composer.lock') }}
39+
path: ${{ github.workspace }}/vendor
40+
- name: Tools cache
41+
uses: actions/cache@v2
42+
with:
43+
key: tools
44+
path: ${{ github.workspace }}/.cache
45+
46+
- name: Install dependencies
47+
env:
48+
COMPOSER_CACHE_DIR: ${{ github.workspace }}/.cache
49+
run: |-
50+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
51+
52+
- name: Validate composer
53+
env:
54+
COMPOSER_CACHE_DIR: ${{ github.workspace }}/.cache
55+
run: composer validate
56+
57+
- name: Normalize composer
58+
env:
59+
COMPOSER_CACHE_DIR: ${{ github.workspace }}/.cache
60+
run: composer normalize --dry-run
61+
62+
phpstan:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v3
66+
- name: Setup PHP
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
php-version: '8.1'
70+
tools: composer:v2
71+
- name: Composer cache
72+
uses: actions/cache@v2
73+
with:
74+
key: composer-${{ hashFiles('**/composer.lock') }}
75+
path: ${{ github.workspace }}/.cache
76+
- name: Vendor cache
77+
uses: actions/cache@v2
78+
with:
79+
key: vendor-${{ hashFiles('**/composer.lock') }}
80+
path: ${{ github.workspace }}/vendor
81+
- name: Tools cache
82+
uses: actions/cache@v2
83+
with:
84+
key: tools
85+
path: ${{ github.workspace }}/.cache
86+
87+
- name: Install dependencies
88+
env:
89+
COMPOSER_CACHE_DIR: ${{ github.workspace }}/.cache
90+
run: |-
91+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
92+
93+
- name: phpstan
94+
run: ./vendor/bin/phpstan analyse -l max --memory-limit=1G
95+
96+
phpcs:
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v3
100+
- name: Setup PHP
101+
uses: shivammathur/setup-php@v2
102+
with:
103+
php-version: '8.1'
104+
tools: composer:v2
105+
- name: Composer cache
106+
uses: actions/cache@v2
107+
with:
108+
key: composer-${{ hashFiles('**/composer.lock') }}
109+
path: ${{ github.workspace }}/.cache
110+
- name: Vendor cache
111+
uses: actions/cache@v2
112+
with:
113+
key: vendor-${{ hashFiles('**/composer.lock') }}
114+
path: ${{ github.workspace }}/vendor
115+
- name: Tools cache
116+
uses: actions/cache@v2
117+
with:
118+
key: tools
119+
path: ${{ github.workspace }}/.cache
120+
121+
- name: Install dependencies
122+
env:
123+
COMPOSER_CACHE_DIR: ${{ github.workspace }}/.cache
124+
run: |-
125+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
126+
127+
- name: phpcs
128+
run: ./vendor/bin/phpcs -d memory_limit=1G
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags-ignore:
8+
- '**'
9+
10+
jobs:
11+
release-draft:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Update release draft
15+
uses: release-drafter/release-drafter@v5
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/composer.lock
21
/vendor
32
/phpcs.xml
43
/phpstan.neon
54
/phpunit.xml
65
.fetch_time_cache
6+
.cache

composer.json

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
{
22
"name": "antlr/antlr4-php-runtime",
3-
"type": "library",
4-
"description": "PHP 7 and 8.0 runtime for ANTLR 4",
5-
"keywords": ["antlr4", "php", "runtime"],
3+
"description": "PHP 8.0+ runtime for ANTLR 4",
64
"license": [
75
"BSD-3-Clause"
86
],
9-
"minimum-stability": "dev",
10-
"prefer-stable": true,
7+
"type": "library",
8+
"keywords": [
9+
"antlr4",
10+
"php",
11+
"runtime"
12+
],
1113
"require": {
12-
"php": "^7.4 || ^8.0",
14+
"php": "^8.0",
1315
"ext-mbstring": "*"
1416
},
1517
"require-dev": {
16-
"phpstan/phpstan": "^0.11.4",
17-
"slevomat/coding-standard": "^5.0.4",
18-
"squizlabs/php_codesniffer": "^3.4.1",
19-
"phpstan/extension-installer": "^1.0"
18+
"ergebnis/composer-normalize": "^2.15",
19+
"phpstan/extension-installer": "^1.0",
20+
"phpstan/phpstan": "^1.4",
21+
"phpstan/phpstan-deprecation-rules": "^1.0",
22+
"phpstan/phpstan-strict-rules": "^1.1",
23+
"slevomat/coding-standard": "^7.0",
24+
"squizlabs/php_codesniffer": "^3.6"
2025
},
26+
"minimum-stability": "dev",
27+
"prefer-stable": true,
2128
"autoload": {
2229
"psr-4": {
2330
"Antlr\\Antlr4\\Runtime\\": "src/"
@@ -28,9 +35,25 @@
2835
"Antlr\\Antlr4\\Runtime\\Tests\\": "tests/"
2936
}
3037
},
38+
"config": {
39+
"allow-plugins": {
40+
"phpstan/extension-installer": true,
41+
"dealerdirect/phpcodesniffer-composer-installer": true,
42+
"ergebnis/composer-normalize": true
43+
}
44+
},
3145
"extra": {
3246
"branch-alias": {
3347
"dev-master": "0.2-dev"
3448
}
49+
},
50+
"scripts": {
51+
"test": [
52+
"composer validate",
53+
"composer normalize --dry-run",
54+
"mkdir -p .cache",
55+
"phpcs",
56+
"phpstan analyse"
57+
]
3558
}
3659
}

0 commit comments

Comments
 (0)