| Subject |
Details |
| Rector version |
0.6.10 |
| PHP version |
PHP 7.2 |
Current Behaviour
1) src/Email/Email.php
---------- begin diff ----------
--- Original
+++ New
@@ -42,7 +42,7 @@
* @throws \InvalidArgumentException
* @throws StringsException
*/
- public function __construct($value)
+ public function __construct(string $value)
{
$validator = new EmailValidator();
----------- end diff -----------
Applied rules:
* Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector
* Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector
* Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector
* Rector\Rector\Argument\ArgumentRemoverRector
* Rector\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector
* Rector\CodeQuality\Rector\If_\RemoveAlwaysTrueConditionSetInConstructorRector
* Rector\DeadCode\Rector\ClassMethod\RemoveOverriddenValuesRector
* Rector\DeadCode\Rector\FunctionLike\RemoveCodeAfterReturnRector
The class Email inherits from a generic interface with this signature:
interface SimpleValueObjectInterface extends ValueObjectInterface
{
/**
* Accepts a simple scalar value.
*
* @param mixed $value
*/
public function __construct($value);
}
Adding the type hint string causes the code to break.
I'm going to write a failing test case for this.
Current Behaviour
1) src/Email/Email.php ---------- begin diff ---------- --- Original +++ New @@ -42,7 +42,7 @@ * @throws \InvalidArgumentException * @throws StringsException */ - public function __construct($value) + public function __construct(string $value) { $validator = new EmailValidator(); ----------- end diff ----------- Applied rules: * Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector * Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector * Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector * Rector\Rector\Argument\ArgumentRemoverRector * Rector\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector * Rector\CodeQuality\Rector\If_\RemoveAlwaysTrueConditionSetInConstructorRector * Rector\DeadCode\Rector\ClassMethod\RemoveOverriddenValuesRector * Rector\DeadCode\Rector\FunctionLike\RemoveCodeAfterReturnRectorThe class
Emailinherits from a generic interface with this signature:Adding the type hint
stringcauses the code to break.I'm going to write a failing test case for this.