Skip to content

Commit

Permalink
TypeHintDeclarationSniff: fixed object type variance
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Jan 21, 2018
1 parent 60eee4e commit 823ba04
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,6 @@ private function getFunctionParameterTypeHintsDefinitions(\PHP_CodeSniffer\Files

private function typeHintEqualsAnnotation(\PHP_CodeSniffer\Files\File $phpcsFile, int $functionPointer, string $typeHint, string $typeHintInAnnotation): bool
{
if (TypeHintHelper::isSimpleTypeHint($typeHint)) {
return true;
}

if ($typeHint === 'object') {
return $this->enableObjectTypeHint;
}

return TypeHintHelper::getFullyQualifiedTypeHint($phpcsFile, $functionPointer, $typeHint) === TypeHintHelper::getFullyQualifiedTypeHint($phpcsFile, $functionPointer, $typeHintInAnnotation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,36 @@ public function returnsNullableArrayOfObjects(): ?array
return [];
}

/**
* @param \DateTimeImmutable $object
*/
public function parameterObjectTypeVariance(object $object)
{

}

/**
* @param \DateTimeImmutable|null $object
*/
public function parameterNullableObjectTypeVariance(?object $object)
{

}

/**
* @return \DateTimeImmutable
*/
public function returnsObjectTypeVariance(): object
{

}

/**
* @return \DateTimeImmutable|null
*/
public function returnsNullableObjectTypeVariance(): ?object
{

}

}

0 comments on commit 823ba04

Please sign in to comment.