Skip to content

Commit ef0be24

Browse files
committed
Fixed conflict
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
2 parents 2c3bf59 + 3b93b12 commit ef0be24

File tree

15 files changed

+108
-66
lines changed

15 files changed

+108
-66
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
on:
2+
- push
3+
4+
name: Run PHPStan checks
5+
6+
jobs:
7+
mutation:
8+
name: PHPStan ${{ matrix.php }}-${{ matrix.os }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.2"
19+
- "8.3"
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: "${{ matrix.php }}"
29+
coverage: pcov
30+
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
31+
tools: composer:v2, cs2pr
32+
33+
- name: Determine composer cache directory
34+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
35+
36+
- name: Cache dependencies installed with composer
37+
uses: actions/cache@v4
38+
with:
39+
path: ${{ env.COMPOSER_CACHE_DIR }}
40+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
41+
restore-keys: |
42+
php${{ matrix.php }}-composer-
43+
44+
- name: Install dependencies with composer
45+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
46+
47+
- name: Setup project
48+
run: |
49+
mv config/autoload/local.php.dist config/autoload/local.php
50+
mv config/autoload/mail.local.php.dist config/autoload/mail.local.php
51+
mv config/autoload/local.test.php.dist config/autoload/local.test.php
52+
53+
- name: Run static analysis with PHPStan
54+
run: vendor/bin/phpstan analyse

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ DotKernel web starter package suitable for admin applications.
1313
[![Build Static](https://github.com/dotkernel/admin/actions/workflows/continuous-integration.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/admin/actions/workflows/continuous-integration.yml)
1414
[![codecov](https://codecov.io/gh/dotkernel/admin/graph/badge.svg?token=BQS43UWAM4)](https://codecov.io/gh/dotkernel/admin)
1515
[![Qodana](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml)
16-
17-
[![SymfonyInsight](https://insight.symfony.com/projects/6a7ecfc1-a0ed-4901-96ac-d0ff61f7b55f/big.svg)](https://insight.symfony.com/projects/6a7ecfc1-a0ed-4901-96ac-d0ff61f7b55f)
16+
[![PHPStan](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml)
1817

1918
## Installing DotKernel `admin`
2019

composer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@
6363
"mezzio/mezzio-tooling": "^2.9.0",
6464
"phpunit/phpunit": "^10.5.9",
6565
"roave/security-advisories": "dev-latest",
66-
"vimeo/psalm": "^5.20.0",
67-
"vincentlanglet/twig-cs-fixer": "^3.0"
66+
"vincentlanglet/twig-cs-fixer": "^3.0",
67+
"phpstan/phpstan": "^2.0",
68+
"phpstan/phpstan-doctrine": "^2.0",
69+
"phpstan/phpstan-phpunit": "^2.0",
70+
"symfony/var-dumper": "^7.1"
6871
},
6972
"autoload": {
7073
"psr-4": {
@@ -91,13 +94,14 @@
9194
"mezzio": "mezzio --ansi",
9295
"check": [
9396
"@cs-check",
94-
"@test"
97+
"@test",
98+
"@static-analysis"
9599
],
96100
"clear-config-cache": "php bin/clear-config-cache.php",
97101
"cs-check": "phpcs",
98102
"cs-fix": "phpcbf",
99103
"serve": "php -S 0.0.0.0:8080 -t public/",
100-
"static-analysis": "psalm --shepherd --stats",
104+
"static-analysis": "phpstan analyse",
101105
"test": "phpunit --colors=always",
102106
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
103107
"twig-cs-check": "vendor/bin/twig-cs-fixer lint --config=config/twig-cs-fixer.php",

phpstan.neon

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
includes:
2+
- vendor/phpstan/phpstan-doctrine/extension.neon
3+
- vendor/phpstan/phpstan-phpunit/extension.neon
4+
parameters:
5+
level: 5
6+
paths:
7+
- src
8+
- test
9+
treatPhpDocTypesAsCertain: false
10+
ignoreErrors:
11+
- '/Parameter #1 \$inputFilter of method .*::setInputFilter\(\) expects Laminas\\InputFilter\\InputFilterInterface<[^>]+>, [^ ]+ given\./'
12+
- '/Parameter #1 \$expected of method PHPUnit\\Framework\\Assert::assertSame\(\) contains unresolvable type\./'
13+
-
14+
message: '#Call to method PHPUnit\\Framework\\Assert::assertInstanceOf\(\) with .* will always evaluate to true.#'
15+
path: test
16+
-
17+
message: '#Call to an undefined method Laminas\\InputFilter\\InputFilterInterface::getInputs\(\)#'
18+
path: test
19+
-
20+
message: '#Call to an undefined method Laminas\\InputFilter\\InputFilterInterface<Laminas\\Form\\FormInterface>::init\(\)#'
21+
path: src
22+
-
23+
message: '#Call to an undefined method Laminas\\Authentication\\AuthenticationServiceInterface::getAdapter\(\)#'
24+
path: src/Admin/src/Controller/AdminController.php
25+
-
26+
message: '#Call to an undefined method Laminas\\Authentication\\AuthenticationServiceInterface::getStorage\(\)#'
27+
path: src/Admin/src/Controller/AdminController.php
28+

psalm-baseline.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.

psalm.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Admin/src/Form/AdminDeleteForm.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ public function getInputFilter(): InputFilterInterface
8181
return $this->inputFilter;
8282
}
8383

84-
public function setInputFilter(InputFilterInterface $inputFilter): void
84+
public function setInputFilter(InputFilterInterface $inputFilter): FormInterface
8585
{
8686
$this->inputFilter = $inputFilter;
8787
$this->inputFilter->init();
88+
89+
return $this;
8890
}
8991
}

src/Admin/src/Form/AdminForm.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ public function getInputFilter(): InputFilterInterface
127127
return $this->inputFilter;
128128
}
129129

130-
public function setInputFilter(InputFilterInterface $inputFilter): void
130+
public function setInputFilter(InputFilterInterface $inputFilter): FormInterface
131131
{
132132
$this->inputFilter = $inputFilter;
133133
$this->inputFilter->init();
134+
135+
return $this;
134136
}
135137
}

src/Admin/src/Form/LoginForm.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ class LoginForm extends Form
1919
{
2020
protected InputFilterInterface $inputFilter;
2121

22-
/**
23-
* @param null $name
24-
* @param array $options
25-
*/
26-
public function __construct($name = null, array $options = [])
22+
public function __construct(?string $name = null, array $options = [])
2723
{
2824
parent::__construct($name, $options);
2925

src/Admin/src/Service/AdminService.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Admin\App\Exception\IdentityException;
1717
use Admin\App\Service\IpService;
1818
use Doctrine\Common\Collections\ArrayCollection;
19-
use Doctrine\ORM\EntityRepository;
2019
use Doctrine\ORM\NonUniqueResultException;
2120
use Dot\DependencyInjection\Attribute\Inject;
2221
use Dot\GeoIP\Service\LocationServiceInterface;
@@ -44,7 +43,7 @@ public function __construct(
4443
) {
4544
}
4645

47-
public function getAdminRepository(): AdminRepository|EntityRepository
46+
public function getAdminRepository(): AdminRepository
4847
{
4948
return $this->adminRepository;
5049
}

0 commit comments

Comments
 (0)