Skip to content

Commit 7234882

Browse files
committed
fix issues related to the latest core changes. phpstan level 4,5 fixes
1 parent ba48083 commit 7234882

29 files changed

+129
-62
lines changed

.semver

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
:major: 6
2+
:major: 8
33
:minor: 0
4-
:patch: 1
4+
:patch: 0
55
:special: ''

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"require": {
3030
"php": ">=7.2",
3131
"ext-json": "*",
32-
"cakephp/cakephp": "4.x-dev as 4.0.0",
33-
"cakedc/users": "9.next-dev",
32+
"cakephp/cakephp": "^4.0.0",
33+
"cakedc/users": "^9.0.0",
3434
"firebase/php-jwt": "^5.0"
3535
},
3636
"require-dev": {
@@ -72,8 +72,10 @@
7272
"stan": "phpstan analyse src/",
7373
"psalm": "php vendor/psalm/phar/psalm.phar --show-info=false src/ ",
7474
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11.18 psalm/phar:^3.5 && mv composer.backup composer.json",
75+
"stan-rebuild-baseline": "phpstan analyse --configuration phpstan.neon --error-format baselineNeon src/ > phpstan-baseline.neon",
76+
"psalm-rebuild-baseline": "php vendor/psalm/phar/psalm.phar --show-info=false --set-baseline=psalm-baseline.xml src/",
7577
"rector": "rector process src/",
76-
"rector-setup": "cp composer.json composer.backup && composer require --dev rector/rector:^0.4.11 && mv composer.backup composer.json",
78+
"rector-setup": "cp composer.json composer.backup && composer require --dev rector/rector:^0.4.11 && mv composer.backup composer.json",
7779
"coverage-test": "phpunit --stderr --coverage-clover=clover.xml"
7880
}
7981
}

phpcs.xml.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="CakePHP Core">
3+
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer" />
4+
5+
<rule ref="CakePHP" />
6+
</ruleset>

phpstan-baseline.neon

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
3+
parameters:
4+
ignoreErrors:
5+
-
6+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:getRegisterValidators\\(\\)\\.$#"
7+
count: 1
8+
path: src\Service\Action\Auth\RegisterAction.php
9+
10+
-
11+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:register\\(\\)\\.$#"
12+
count: 2
13+
path: src\Service\Action\Auth\RegisterAction.php
14+
15+
-
16+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:validate\\(\\)\\.$#"
17+
count: 1
18+
path: src\Service\Action\Auth\ResetPasswordAction.php
19+
20+
-
21+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:validationPasswordConfirm\\(\\)\\.$#"
22+
count: 1
23+
path: src\Service\Action\Auth\ResetPasswordAction.php
24+
25+
-
26+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:changePassword\\(\\)\\.$#"
27+
count: 1
28+
path: src\Service\Action\Auth\ResetPasswordAction.php
29+
30+
-
31+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:resetToken\\(\\)\\.$#"
32+
count: 1
33+
path: src\Service\Action\Auth\ResetPasswordRequestAction.php
34+
35+
-
36+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:socialLogin\\(\\)\\.$#"
37+
count: 1
38+
path: src\Service\Action\Auth\SocialLoginAction.php
39+
40+
-
41+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:validate\\(\\)\\.$#"
42+
count: 1
43+
path: src\Service\Action\Auth\ValidateAccountAction.php
44+
45+
-
46+
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:resetToken\\(\\)\\.$#"
47+
count: 1
48+
path: src\Service\Action\Auth\ValidateAccountRequestAction.php
49+
50+

phpstan.neon

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
14
parameters:
25
level: 4
36
autoload_files:
47
- tests/bootstrap.php
58
ignoreErrors:
6-
-
7-
message: '#Call to an undefined method Cake\\ORM\\Table.*#'
8-
path: 'src/Service/Action/Auth/RegisterAction.php'
9-
-
10-
message: '#Call to an undefined method Cake\\ORM\\Table.*#'
11-
path: 'src/Service/Action/Auth/ResetPasswordAction.php'
12-
-
13-
message: '#Call to an undefined method Cake\\ORM\\Table.*#'
14-
path: 'src/Service/Action/Auth/ResetPasswordRequestAction.php'
15-
-
16-
message: '#Call to an undefined method Cake\\ORM\\Table.*#'
17-
path: 'src/Service/Action/Auth/SocialLoginAction.php'
18-
-
19-
message: '#Call to an undefined method Cake\\ORM\\Table.*#'
20-
path: 'src/Service/Action/Auth/ValidateAccountAction.php'
21-
-
22-
message: '#Call to an undefined method Cake\\ORM\\Table.*#'
23-
path: 'src/Service/Action/Auth/ValidateAccountRequestAction.php'
24-
-
25-
message: '#PHPDoc tag @throws with type PHPUnit.*#'
26-
path: 'src/TestSuite/IntegrationTestCase.php'
9+
10+
services:

src/Service/Action/Auth/LoginAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function validates(): bool
6464
$validator
6565
->requirePresence($this->_passwordField, 'create')
6666
->notBlank($this->_passwordField);
67-
$errors = $validator->errors($this->getData());
67+
$errors = $validator->validate($this->getData());
6868
if (!empty($errors)) {
6969
throw new ValidationException(__('Validation failed'), 0, null, $errors);
7070
}

src/Service/Action/Auth/RegisterAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function validates(): bool
5353
{
5454
$validator = $this->getUsersTable()->getRegisterValidators($this->_registerOptions());
5555

56-
$errors = $validator->errors($this->getData());
56+
$errors = $validator->validate($this->getData());
5757
if (!empty($errors)) {
5858
throw new ValidationException(__('Validation failed'), 0, null, $errors);
5959
}

src/Service/Action/Auth/ResetPasswordAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function validates(): bool
5656
$validator
5757
->requirePresence('token', 'create')
5858
->notBlank('token');
59-
$errors = $validator->errors($this->getData());
59+
$errors = $validator->validate($this->getData());
6060
if (!empty($errors)) {
6161
throw new ValidationException(__('Validation failed'), 0, null, $errors);
6262
}

src/Service/Action/Auth/ResetPasswordRequestAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function validates(): bool
5555
$validator
5656
->requirePresence('reference', 'create')
5757
->notBlank('reference');
58-
$errors = $validator->errors($this->getData());
58+
$errors = $validator->validate($this->getData());
5959
if (!empty($errors)) {
6060
throw new ValidationException(__('Validation failed'), 0, null, $errors);
6161
}

src/Service/Action/Auth/SocialLoginAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function validates(): bool
5959
->requirePresence('data', 'create');
6060
$validator
6161
->requirePresence('options', 'create');
62-
$errors = $validator->errors($this->getData());
62+
$errors = $validator->validate($this->getData());
6363
if (!empty($errors)) {
6464
throw new ValidationException(__('Validation failed'), 0, null, $errors);
6565
}

0 commit comments

Comments
 (0)