Skip to content

Commit a2e9fbd

Browse files
committed
Initial version
1 parent 960a12d commit a2e9fbd

93 files changed

Lines changed: 8873 additions & 0 deletions

File tree

Some content is hidden

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

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
indent_style = tab
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.{md,neon,yml}]
10+
indent_size = 2
11+
indent_style = space
12+
13+
[phpstan-baseline.neon]
14+
indent_style = tab

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.editorconfig export-ignore
2+
.gitattributes export-ignore
3+
.gitignore export-ignore
4+
.github export-ignore
5+
phpstan-baseline.neon export-ignore
6+
phpstan.neon export-ignore
7+
tests/ export-ignore
8+
9+
*.php* diff=php linguist-language=PHP

.github/workflows/checks.yml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: checks
2+
3+
on:
4+
- push
5+
6+
env:
7+
COMPOSER_NO_INTERACTION: "1"
8+
9+
jobs:
10+
format:
11+
name: Code style
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '8.4'
21+
coverage: none
22+
23+
- run: composer install --ansi --no-progress --prefer-dist
24+
25+
- name: Run PHP_Codesniffer
26+
run: vendor/bin/phpcs
27+
28+
static_analysis:
29+
name: Static analysis
30+
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: '8.4'
39+
coverage: none
40+
41+
- run: composer install --ansi --no-progress --prefer-dist
42+
43+
- name: Run parallel-lint
44+
run: composer run lint
45+
46+
- name: Run PHPStan
47+
run: composer run phpstan
48+
49+
tests:
50+
name: PHP ${{ matrix.php }} tests on ${{ matrix.os }} with ${{ matrix.deps }} deps
51+
52+
needs:
53+
- static_analysis
54+
55+
strategy:
56+
matrix:
57+
deps:
58+
- stable
59+
- lowest
60+
os:
61+
- macos-latest
62+
- ubuntu-latest
63+
- windows-latest
64+
php:
65+
- '8.1'
66+
- '8.2'
67+
- '8.3'
68+
- '8.4'
69+
70+
exclude:
71+
- deps: lowest
72+
os: macos-latest
73+
74+
- deps: lowest
75+
os: windows-latest
76+
77+
fail-fast: false
78+
79+
runs-on: ${{ matrix.os }}
80+
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- uses: shivammathur/setup-php@v2
85+
with:
86+
php-version: ${{ matrix.php }}
87+
coverage: none
88+
extensions: pdo, pdo_mysql, pdo_sqlite
89+
90+
- run: composer install --ansi --no-progress --prefer-dist
91+
92+
- run: composer update --ansi --no-progress --prefer-lowest
93+
if: matrix.deps == 'lowest'
94+
95+
- name: Run tests
96+
run: composer run test-without-db
97+
98+
- if: failure()
99+
uses: actions/upload-artifact@v4
100+
with:
101+
path: tests/output
102+
103+
db_tests:
104+
name: PHP tests with database
105+
106+
needs:
107+
- tests
108+
109+
strategy:
110+
fail-fast: false
111+
112+
runs-on: ubuntu-latest
113+
114+
services:
115+
mariadb:
116+
image: mariadb:11.8
117+
env:
118+
MARIADB_ROOT_PASSWORD: test
119+
MARIADB_USER: test
120+
MARIADB_PASSWORD: test
121+
MARIADB_DATABASE: test
122+
ports:
123+
- 3306:3306
124+
options: >-
125+
--health-cmd="mysqladmin ping -h 127.0.0.1 -u test -ptest"
126+
--health-interval=10s
127+
--health-timeout=5s
128+
--health-retries=5
129+
130+
mysql:
131+
image: mysql:8.4
132+
env:
133+
MYSQL_ROOT_PASSWORD: test
134+
MYSQL_USER: test
135+
MYSQL_PASSWORD: test
136+
MYSQL_DATABASE: test
137+
ports:
138+
- 3307:3306
139+
options: >-
140+
--health-cmd="mysqladmin ping -h 127.0.0.1 -u test -ptest"
141+
--health-interval=10s
142+
--health-timeout=5s
143+
--health-retries=5
144+
145+
postgres:
146+
image: postgres:17.5
147+
env:
148+
POSTGRES_USER: test
149+
POSTGRES_PASSWORD: test
150+
POSTGRES_DB: test
151+
ports:
152+
- 5432:5432
153+
options: >-
154+
--health-cmd="pg_isready -U test"
155+
--health-interval=10s
156+
--health-timeout=5s
157+
--health-retries=5
158+
159+
steps:
160+
- uses: actions/checkout@v4
161+
162+
- name: Wait for DBs to be ready
163+
run: |
164+
for port in 3306 3307 5432; do
165+
while ! nc -z 127.0.0.1 $port; do sleep 1; done
166+
done
167+
168+
- uses: shivammathur/setup-php@v2
169+
with:
170+
php-version: '8.4'
171+
coverage: none
172+
extensions: pdo, pdo_mysql, pdo_sqlite
173+
174+
- run: composer install --ansi --no-progress --prefer-dist
175+
176+
- name: Run tests
177+
run: composer run test-with-db
178+
179+
- if: failure()
180+
uses: actions/upload-artifact@v4
181+
with:
182+
path: tests/output

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
.phpunit.cache
3+
.phpunit.result.cache
4+
tests-temp
5+
vendor

composer.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"authors": [
3+
{
4+
"name": "Vojtěch Dobeš",
5+
"homepage": "https://vojtechdobes.com"
6+
}
7+
],
8+
"autoload": {
9+
"psr-4": {
10+
"Vojtechdobes\\PHPStan\\Dibi\\": "src/"
11+
}
12+
},
13+
"autoload-dev": {
14+
"classmap": [
15+
"tests/objects"
16+
],
17+
"psr-4": {
18+
"Vojtechdobes\\Tests\\": "tests/cases/"
19+
}
20+
},
21+
"config": {
22+
"allow-plugins": {
23+
"dealerdirect/phpcodesniffer-composer-installer": false
24+
},
25+
"sort-packages": true
26+
},
27+
"keywords": [
28+
"ci",
29+
"dibi",
30+
"phpstan",
31+
"phpstan-rules",
32+
"sql",
33+
"static-analysis",
34+
"static-code-analysis"
35+
],
36+
"license": [
37+
"BSD-3-Clause"
38+
],
39+
"name": "vojtech-dobes/phpstan-dibi-steroids",
40+
"require": {
41+
"php": "~8.1",
42+
"greenlion/php-sql-parser": "^4.7"
43+
},
44+
"require-dev": {
45+
"dibi/dibi": "^5.0",
46+
"nette/di": "^3.2",
47+
"php-parallel-lint/php-parallel-lint": "^1.4.0",
48+
"phpstan/phpstan": "^2.1.12",
49+
"phpstan/phpstan-strict-rules": "^2.0.4",
50+
"phpunit/phpunit": "^10.5",
51+
"spaze/phpstan-disallowed-calls": "^4.5.0",
52+
"tracy/tracy": "^2.10.9",
53+
"vojtech-dobes/php-codestyle": "~0.2.0"
54+
},
55+
"scripts": {
56+
"lint": "parallel-lint src tests",
57+
"phpstan": "phpstan analyse --memory-limit 512M",
58+
"test": ["@test-without-db", "@test-with-db"],
59+
"test-with-db": "composer dump-autoload && phpunit tests --group database",
60+
"test-without-db": "composer dump-autoload && phpunit tests --exclude-group database"
61+
}
62+
}

0 commit comments

Comments
 (0)