From 507aff666f12d9fe95c7f96aa054c4b6f4b4e728 Mon Sep 17 00:00:00 2001 From: Nikolay Novikov Date: Wed, 6 Dec 2023 17:16:09 +0300 Subject: [PATCH] patch --- composer.json | 3 ++- psalm.xml | 39 +++++++++++++++++++++++++++++++++++++++ src/ModelTrait.php | 11 ++++++++++- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 psalm.xml diff --git a/composer.json b/composer.json index 9cad152..eb8e43c 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "require-dev": { "phpstan/phpstan": "^1.10", "friendsofphp/php-cs-fixer": "^3.26", - "squizlabs/php_codesniffer": "^3.7" + "squizlabs/php_codesniffer": "^3.7", + "psalm/plugin-laravel": "^2.8" }, "autoload": { "psr-4": {"AnourValar\\EloquentValidation\\": "src/"} diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..b7c620b --- /dev/null +++ b/psalm.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ModelTrait.php b/src/ModelTrait.php index 6ba5c99..03ce60b 100644 --- a/src/ModelTrait.php +++ b/src/ModelTrait.php @@ -213,6 +213,15 @@ public function validate($prefix = null, array $additionalRules = null, array $a if ($passes && $validator->getRules()) { $passes = $validator->passes(); } + + /*if ($passes && method_exists($this, 'saveActionValidation')) { + try { + $this->saveActionValidation(); + } catch (\Illuminate\Validation\ValidationException $e) { + $passes = false; + $validator = $e->validator; + } + }*/ } if ($additionalAttributeNames) { @@ -447,7 +456,7 @@ public function getAttributeNames(): array // handler lang if (method_exists($this, 'getAttributeNamesFromHandler')) { - $value[$locale] = array_replace($this->getAttributeNamesFromHandler(), $value[$locale]); + $value[$locale] = array_replace($value[$locale], $this->getAttributeNamesFromHandler()); } static::$attributeNames = &$value;