mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-18 14:06:39 +00:00
27be0e7157
* use spread syntax instead of array_merge()
* use type cast instead of function cast
* removed redundant returns
* removed redundant phpdoc - type is already inferred
* removed invalid phpdoc - type is already inferred
The PHPDoc return type hint was incomplete, it should have been `InvalidEmail|null`, however, it can be removed altogether as the return type is already inferred from the code.
* changed warnEscaping()'s return value from bool to void
This is not a breaking change as the method is private, and it's only used at one place, where the return value was not used anyway.
* made private class property local
`private $parser` was used in only one place, hence it can be local, there is no reason to put it into the class' scope.
* removed unnecessary type casting
Concatenation already casts `static::CODE` from `int` to `string`, no reason to do it explicitly.
* removed redundant initializers - constructor overwrites them immediately
* removed redundant else block
* simplified if-else statement
* wrapped if body in brackets to comply with PSR12
* fixed README formatting
- fixed numbering at the `Available validations` section
- fixed overall formatting
* Revert "removed redundant phpdoc - type is already inferred"
This reverts commit 68a9ae20bd.
* don't wrap long lines
* make properties typed
Also using constructor property promotion, see more info about it [here](https://php.watch/versions/8.0/constructor-property-promotion).
27 lines
503 B
PHP
27 lines
503 B
PHP
<?php
|
|
|
|
namespace Egulias\EmailValidator\Result\Reason;
|
|
|
|
class UnusualElements implements Reason
|
|
{
|
|
/**
|
|
* @var string $element
|
|
*/
|
|
private $element;
|
|
|
|
public function __construct(string $element)
|
|
{
|
|
$this->element = $element;
|
|
}
|
|
|
|
public function code() : int
|
|
{
|
|
return 201;
|
|
}
|
|
|
|
public function description() : string
|
|
{
|
|
return 'Unusual element found, wourld render invalid in majority of cases. Element found: ' . $this->element;
|
|
}
|
|
}
|