Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Dec 6, 2023
1 parent 7691d4f commit 507aff6
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"}
Expand Down
39 changes: 39 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
findUnusedPsalmSuppress="true"
findUnusedVariablesAndParams="true"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
</plugins>

<issueHandlers>
<UnusedClosureParam errorLevel="suppress" />
<PossiblyUnusedMethod errorLevel="suppress" />
<UnusedClass errorLevel="suppress" />
<PossiblyUnusedParam errorLevel="suppress" />
<PossiblyUnusedProperty errorLevel="suppress" />
<PossiblyUnusedReturnValue errorLevel="suppress" />
<MissingTemplateParam errorLevel="suppress" />
<UnsupportedPropertyReferenceUsage errorLevel="suppress" />
</issueHandlers>

<forbiddenFunctions>
<function name="var_dump" />
<function name="dd" />
<function name="dump" />
</forbiddenFunctions>
</psalm>
11 changes: 10 additions & 1 deletion src/ModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 507aff6

Please sign in to comment.