Skip to content

Commit

Permalink
feat: Add some new phpstan rules and prohibit errors in chaotic Nette…
Browse files Browse the repository at this point in the history
… structure
  • Loading branch information
KminekMatej committed Sep 7, 2024
1 parent c559a74 commit e3c94d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/module/sign/form/SignUpFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public function create(callable $onSuccess, ?Invitation $invitation = null): \Ne
return;
} catch (UniqueConstraintViolationException $exc) {
if (preg_match("/SQLSTATE\[23000\]: Integrity constraint violation: 1062 Duplicate entry \'(.*?)\' for key \'(.*?)\'/m", $exc->getMessage(), $matches)) {
$form[$exc->getMessage()]->addError("Cannot create user. Field '" . StringHelper::toCamelCase($matches[2]) . " is already used'");
$form[$exc->getMessage()]->addError("Cannot create user. Field '" . StringHelper::toCamelCase($matches[2]) . " is already used'"); /* @phpstan-ignore-line */
} else {
$form[$exc->getMessage()]->addError("Cannot create user. Already exists'");
$form[$exc->getMessage()]->addError("Cannot create user. Already exists'"); /* @phpstan-ignore-line */
}
return;
}
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
"nette/tester": "^2.0",
"squizlabs/php_codesniffer": "^3",
"phpstan/phpstan": "^1",
"rector/rector": "^0",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-nette": "^1",
"phpstan/phpstan-strict-rules": "^1.5",
"rector/rector": "^0",
"roave/security-advisories": "dev-latest",
"slevomat/coding-standard": "^8"
},
Expand Down

0 comments on commit e3c94d5

Please sign in to comment.