Increase Mutation Score Indicator (MSI) by removing "src/Exception/Reflection/CannotResolveClassNameException.php:29 [M] TrueValue" mutant

This commit is contained in:
Meritoo
2019-08-10 21:32:40 +02:00
parent a5148de31c
commit a86a10c51e
4 changed files with 26 additions and 28 deletions

View File

@@ -21,13 +21,12 @@ class CannotResolveClassNameException extends Exception
/**
* Creates exception
*
* @param array|object|string $source Source of the class's / trait's name. It can be an array of objects,
* namespaces, object or namespace.
* @param bool $forClass (optional) If is set to true, message of this exception for class is
* prepared. Otherwise - for trait.
* @param string $source Source of name of the class or trait
* @param bool $forClass (optional) If is set to true, message of this exception for class is prepared. Otherwise
* - for trait.
* @return CannotResolveClassNameException
*/
public static function create($source, bool $forClass = true): CannotResolveClassNameException
public static function create(string $source, bool $forClass = true): CannotResolveClassNameException
{
$forWho = 'trait';
$value = '';
@@ -37,7 +36,7 @@ class CannotResolveClassNameException extends Exception
}
if (is_scalar($source)) {
$value = sprintf(' %s', (string)$source);
$value = sprintf(' %s', $source);
}
$template = 'Name of %s from given \'%s\'%s cannot be resolved. Is there everything ok?';

View File

@@ -437,7 +437,7 @@ class Reflection
// Oops, cannot resolve class
if (null === $className) {
throw CannotResolveClassNameException::create($class);
throw CannotResolveClassNameException::create('');
}
$childClasses = [];
@@ -541,12 +541,12 @@ class Reflection
// Oops, cannot resolve class
if (null === $className || '' === $className) {
throw CannotResolveClassNameException::create($class);
throw CannotResolveClassNameException::create('');
}
// Oops, cannot resolve trait
if (null === $traitName || '' === $traitName) {
throw new CannotResolveClassNameException($class, false);
throw CannotResolveClassNameException::create('', false);
}
$reflection = new ReflectionClass($className);