Skip to content

Commit 3aa338a

Browse files
committed
added boilerplate
1 parent 5cadaad commit 3aa338a

9 files changed

Lines changed: 145 additions & 0 deletions

File tree

.github/workflows/coding-style.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Coding Style
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
nette_cc:
7+
name: Nette Code Checker
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: 8.3
14+
coverage: none
15+
16+
- run: composer create-project nette/code-checker temp/code-checker ^3 --no-progress
17+
- run: php temp/code-checker/code-checker --strict-types --ignore "tests/*/fixtures"
18+
19+
20+
nette_cs:
21+
name: Nette Coding Standard
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: 8.3
28+
coverage: none
29+
30+
- run: composer create-project nette/coding-standard temp/coding-standard ^3 --no-progress
31+
- run: php temp/coding-standard/ecs check
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Static Analysis
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
phpstan:
7+
name: PHPStan
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: 8.1
14+
coverage: none
15+
16+
- run: composer install --no-progress --prefer-dist
17+
- run: composer phpstan -- --no-progress

.github/workflows/tests.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
11+
12+
fail-fast: false
13+
14+
name: PHP ${{ matrix.php }} tests
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php }}
20+
coverage: none
21+
22+
- run: composer install --no-progress --prefer-dist
23+
- run: composer tester
24+
- if: failure()
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: output-${{ matrix.php }}
28+
path: tests/**/output

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/vendor
22
/composer.lock
3+
/tests/output

composer.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "nette/phpstan-rules",
3+
"type": "phpstan-extension",
4+
"description": "🐘 PHPStan rules and type extensions for Nette libraries",
5+
"homepage": "https://nette.org",
6+
"keywords": ["phpstan", "nette", "static analysis"],
7+
"license": ["BSD-3-Clause", "GPL-2.0-only", "GPL-3.0-only"],
8+
"authors": [
9+
{
10+
"name": "David Grudl",
11+
"homepage": "https://davidgrudl.com"
12+
}
13+
],
14+
"require": {
15+
"php": "8.1 - 8.5",
16+
"phpstan/phpstan": "^2.1"
17+
},
18+
"require-dev": {
19+
"nette/tester": "^2.6"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"Nette\\PHPStan\\": "src"
24+
}
25+
},
26+
"scripts": {
27+
"phpstan": "phpstan analyse",
28+
"tester": "tester tests -s"
29+
},
30+
"extra": {
31+
"phpstan": {
32+
"includes": [
33+
"extension.neon"
34+
]
35+
},
36+
"branch-alias": { "dev-master": "1.0-dev" }
37+
}
38+
}

extension.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
parameters:

phpstan.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
parameters:
2+
level: 8
3+
4+
paths:
5+
- src
6+
- tests
7+
8+
includes:
9+
- extension.neon

tests/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*/output
2+
/test.log
3+
/tmp

tests/bootstrap.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
// The Nette Tester command-line runner can be
6+
// invoked through the command: ../vendor/bin/tester .
7+
8+
if (@!include __DIR__ . '/../vendor/autoload.php') {
9+
echo 'Install Nette Tester using `composer install`';
10+
exit(1);
11+
}
12+
13+
14+
// configure environment
15+
Tester\Environment::setup();
16+
Tester\Environment::setupFunctions();
17+
date_default_timezone_set('Europe/Prague');

0 commit comments

Comments
 (0)