Skip to content

Commit

Permalink
better constant error naming
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Feb 22, 2019
1 parent 13cfb51 commit 4346ead
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Validator/Naming.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class Naming extends AbstractValidator
{
const SPECIAL = 'SPECIAL';
const SPECIAL_OR_NUMBER = 'SPECIAL_OR_NUMBER';
const SINGLE_DOT = 'SINGLE_DOT';
const SINGLE_HYPHEN = 'SINGLE_HYPHEN';
const SINGLE_APOSTROPHE = 'SINGLE_APOSTROPHE';
Expand All @@ -19,7 +19,7 @@ class Naming extends AbstractValidator
const DOT_TOBE_IN_LAST_WORD = 'DOT_TOBE_IN_LAST_WORD';

protected $messageTemplates = [
self::SPECIAL => 'Names can contain only letters, hyphens, apostrophe, spaces & full stops',
self::SPECIAL_OR_NUMBER => 'Names can contain only letters, hyphens, apostrophe, spaces & full stops',
self::SINGLE_DOT => 'Single "." character is not allowed',
self::SINGLE_HYPHEN => 'Single "-" character is not allowed',
self::SINGLE_APOSTROPHE => 'Single "\'" character is not allowed',
Expand All @@ -41,7 +41,7 @@ public function isValid($value)

$specs = \preg_match("/^[-. '\p{L}]+$/u", $value);
if (! $specs) {
$this->error(self::SPECIAL);
$this->error(self::SPECIAL_OR_NUMBER);
return false;
}

Expand Down

0 comments on commit 4346ead

Please sign in to comment.