Skip to content

Commit eb8f6aa

Browse files
authored
Merge pull request #9 from samsonasik/refactor-enable-phpstan
refactor: enable PHPStan for code analyze
2 parents fd32c59 + 682155a commit eb8f6aa

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.gitignore export-ignore
22
/.gitattributes export-ignore
33
/.php-cs-fixer.dist.php export-ignore
4+
/phpstan.neon export-ignore

.github/workflows/tests_build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ jobs:
2929
run: "composer install"
3030
- name: "CS Check"
3131
run: "vendor/bin/php-cs-fixer fix --dry-run --diff"
32+
- name: "Code analyze"
33+
run: "vendor/bin/phpstan"
3234
- name: "Run test suite"
3335
run: "vendor/bin/phpunit"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"minimum-stability": "stable",
2727
"require-dev": {
2828
"codeigniter/coding-standard": "^1.8",
29-
"phpunit/phpunit": "^10.5"
29+
"phpunit/phpunit": "^10.5",
30+
"phpstan/phpstan": "^2.1"
3031
}
3132
}

phpstan.neon

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
paths:
3+
- src
4+
- tests
5+
level: 5
6+
bootstrapFiles:
7+
- vendor/codeigniter4/framework/system/Test/bootstrap.php
8+

src/PageRouter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
use CodeIgniter\Exceptions\PageNotFoundException;
1818
use CodeIgniter\HTTP\Exceptions\BadRequestException;
1919
use CodeIgniter\HTTP\ResponseInterface;
20+
use CodeIgniter\Router\RouteCollection;
2021
use CodeIgniter\Router\Router;
2122

2223
/**
2324
* Page based router.
2425
*
2526
* This class extends the CodeIgniter's Router class
2627
* to handle page based routes.
28+
*
29+
* @property-read RouteCollection $collection
2730
*/
2831
class PageRouter extends Router
2932
{

0 commit comments

Comments
 (0)