Рефакторинг с учётом обновлений typhoon/type #128
continuous-integration.yml
on: push
Matrix: composer-normalize
Matrix: composer-validate
Matrix: infection
Matrix: php-cs-fixer
Matrix: psalm
Matrix: test
Annotations
10 warnings
infection (8.1):
src/ClassReflection.php#L445
Escaped Mutant for Mutator "LogicalOrAllSubExprNegation":
--- Original
+++ New
@@ @@
}
public function isInstance(object $object) : bool
{
- return $this->metadata->name === $object::class || $this->reflectClass($object::class)->isSubclassOf($this);
+ return !($this->metadata->name === $object::class) || !$this->reflectClass($object::class)->isSubclassOf($this);
}
public function isInstantiable() : bool
{
|
infection (8.1):
src/NameContext/NameContext.php#L83
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
}
public function enterNamespace(?string $namespace = null) : void
{
- $this->leaveNamespace();
+
if ($namespace !== null) {
$this->namespace = self::parse($namespace)->resolve();
}
|
infection (8.1):
src/NameContext/NameContext.php#L109
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
public function addConstantUse(string $name, ?string $alias = null) : void
{
$resolvedName = self::parse($name)->resolve();
- $resolvedAlias = ($alias === null ? $resolvedName->lastSegment() : new UnqualifiedName($alias))->toString();
+ $resolvedAlias = ($alias !== null ? $resolvedName->lastSegment() : new UnqualifiedName($alias))->toString();
if (isset($this->constantImportTable[$resolvedAlias])) {
throw new DefaultReflectionException(sprintf('Cannot use constant %s as %s because the name is already in use.', $name, $resolvedAlias));
}
|
infection (8.1):
src/NameContext/NameContext.php#L109
Escaped Mutant for Mutator "Ternary":
--- Original
+++ New
@@ @@
public function addConstantUse(string $name, ?string $alias = null) : void
{
$resolvedName = self::parse($name)->resolve();
- $resolvedAlias = ($alias === null ? $resolvedName->lastSegment() : new UnqualifiedName($alias))->toString();
+ $resolvedAlias = ($alias === null ? new UnqualifiedName($alias) : $resolvedName->lastSegment())->toString();
if (isset($this->constantImportTable[$resolvedAlias])) {
throw new DefaultReflectionException(sprintf('Cannot use constant %s as %s because the name is already in use.', $name, $resolvedAlias));
}
|
infection (8.1):
src/NameContext/NameContext.php#L125
Escaped Mutant for Mutator "Ternary":
--- Original
+++ New
@@ @@
public function addFunctionUse(string $name, ?string $alias = null) : void
{
$resolvedName = self::parse($name)->resolve();
- $resolvedAlias = ($alias === null ? $resolvedName->lastSegment() : new UnqualifiedName($alias))->toString();
+ $resolvedAlias = ($alias === null ? new UnqualifiedName($alias) : $resolvedName->lastSegment())->toString();
if (isset($this->functionImportTable[$resolvedAlias])) {
throw new DefaultReflectionException(sprintf('Cannot use constant %s as %s because the name is already in use.', $name, $resolvedAlias));
}
|
infection (8.1):
src/NameContext/NameContext.php#L125
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
public function addFunctionUse(string $name, ?string $alias = null) : void
{
$resolvedName = self::parse($name)->resolve();
- $resolvedAlias = ($alias === null ? $resolvedName->lastSegment() : new UnqualifiedName($alias))->toString();
+ $resolvedAlias = ($alias !== null ? $resolvedName->lastSegment() : new UnqualifiedName($alias))->toString();
if (isset($this->functionImportTable[$resolvedAlias])) {
throw new DefaultReflectionException(sprintf('Cannot use constant %s as %s because the name is already in use.', $name, $resolvedAlias));
}
|
infection (8.1):
src/NameContext/NameContext.php#L140
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
}
public function enterClass(string $unresolvedName, ?string $unresolvedParentName, bool $trait, bool $final) : void
{
- $this->leaveClass();
+
$this->inClass = true;
if ($trait) {
return;
|
infection (8.1):
src/NameContext/NameContext.php#L154
Escaped Mutant for Mutator "IfNegation":
--- Original
+++ New
@@ @@
if ($unresolvedParentName !== null) {
$this->namespaceImportTable[self::PARENT] = self::parse($unresolvedParentName)->resolve($this->namespace, $this->namespaceImportTable);
}
- if ($final) {
+ if (!$final) {
$this->namespaceImportTable[self::STATIC] = $this->namespaceImportTable[self::SELF];
}
}
|
infection (8.1):
src/NameContext/NameContext.php#L161
Escaped Mutant for Mutator "FalseValue":
--- Original
+++ New
@@ @@
}
public function leaveClass() : void
{
- $this->inClass = false;
+ $this->inClass = true;
unset($this->namespaceImportTable[self::SELF], $this->namespaceImportTable[self::PARENT], $this->namespaceImportTable[self::STATIC]);
}
public function leaveNamespace() : void
|
infection (8.1):
src/NameContext/NameContext.php#L167
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
}
public function leaveNamespace() : void
{
- $this->leaveClass();
+
$this->namespace = null;
$this->namespaceImportTable = [];
$this->constantImportTable = [];
|