Skip to content

Commit be7dda2

Browse files
authored
Merge pull request #33 from MekDrop/add-phpstan
Added phpstan
2 parents c8fda54 + 0b99fb1 commit be7dda2

File tree

6 files changed

+45
-4
lines changed

6 files changed

+45
-4
lines changed

.github/workflows/on_pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
run: composer test
3737
- name: PHP CodeSniffer
3838
run: composer phpcs
39+
- name: PHPStan
40+
run: composer phpstan
3941
- name: Install Composer dependencies (without dev)
4042
run: composer install --no-progress --no-dev --no-suggest --prefer-dist --optimize-autoloader
4143

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
composer.lock
44
/.phpunit.result.cache
55
/.phpunit.cache/
6+
/.phpstan.cache/

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,28 @@ Debuging variables can be done from templates...
120120
```smarty
121121
{"_AD_INSTALLEDMODULES"|debug_print_var}
122122
```
123+
## Development
124+
125+
### Code Quality Tools
126+
127+
This project uses several tools to ensure code quality:
128+
129+
- **PHPUnit** - For unit testing
130+
```bash
131+
composer test
132+
```
133+
134+
- **PHP CodeSniffer** - For coding standards (PSR-12)
135+
```bash
136+
composer phpcs # Check code style
137+
composer phpcbf # Fix code style issues automatically
138+
```
139+
140+
- **PHPStan** - For static analysis
141+
```bash
142+
composer phpstan
143+
```
144+
123145
## How to contribute?
124146

125147
If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try [interactive GitHub tutorial](https://skills.github.com).

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@
3333
],
3434
"require-dev": {
3535
"phpunit/phpunit": "^10.0",
36-
"squizlabs/php_codesniffer": "^3.8"
36+
"squizlabs/php_codesniffer": "^3.8",
37+
"phpstan/phpstan": "^2"
3738
},
3839
"scripts": {
3940
"test": "phpunit --testdox",
4041
"phpcs": "phpcs",
41-
"phpcbf": "phpcbf"
42+
"phpcbf": "phpcbf",
43+
"phpstan": "phpstan analyse"
4244
}
4345
}

phpstan.neon

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
parameters:
2+
# Level 5 is a good starting point for most projects
3+
level: 5
4+
5+
paths:
6+
- src
7+
- tests
8+
9+
# Exclude vendor directory
10+
excludePaths:
11+
- vendor
12+
13+
# PHP 8.3 compatibility
14+
phpVersion: 80300

tests/DebugExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
class DebugExtensionTest extends TestCase
1212
{
13-
private readonly DebugExtension $extension;
14-
private readonly Smarty $smarty;
13+
private DebugExtension $extension;
14+
private Smarty $smarty;
1515

1616
protected function setUp(): void
1717
{

0 commit comments

Comments
 (0)