Skip to content

Commit

Permalink
Fix "Validation rule 'url' not found" issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakvGhost committed Nov 18, 2023
1 parent 1156fd9 commit 61124ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Rules/UrlRule.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* URLRule - A validation rule implementation for checking if a value is a valid url.
* UrlRule - A validation rule implementation for checking if a value is a valid url.
*
* @package BlakvGhost\PHPValidator\Rules
* @author Fortunatus KIDJE (v1p3r75)
Expand All @@ -12,7 +12,7 @@

use BlakvGhost\PHPValidator\LangManager;

class URLRule implements RuleInterface
class UrlRule implements RuleInterface
{
/**
* Name of the field being validated.
Expand All @@ -22,7 +22,7 @@ class URLRule implements RuleInterface
protected $field;

/**
* Constructor of the URLRule class.
* Constructor of the UrlRule class.
*
* @param array $parameters Parameters for the rule, specifying the list of valid values.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/RulesMaped.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
use BlakvGhost\PHPValidator\Rules\SizeRule;
use BlakvGhost\PHPValidator\Rules\StringRule;
use BlakvGhost\PHPValidator\Rules\UpperCaseRule;
use BlakvGhost\PHPValidator\Rules\URLRule;
use BlakvGhost\PHPValidator\Rules\UrlRule;
use BlakvGhost\PHPValidator\Rules\ValidIpRule;

class RulesMaped
Expand Down Expand Up @@ -71,7 +71,7 @@ class RulesMaped
'password' => PasswordRule::class,
'same' => SameRule::class,
'size' => SizeRule::class,
'url' => URLRule::class,
'url' => UrlRule::class,
'ip' => ValidIpRule::class,
];

Expand All @@ -94,7 +94,7 @@ protected static function getRules(): array
*/
protected static function getRule(string $alias): string
{
if (isset(self::$rules[$alias])) {
if (isset(self::$rules[$alias]) && class_exists(self::$rules[$alias])) {
return self::$rules[$alias];
}

Expand Down

0 comments on commit 61124ca

Please sign in to comment.