Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-9727: Added missing type hints #89

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

IBX-9727: Added missing type hints #89

wants to merge 1 commit into from

Conversation

alongosz
Copy link
Member

Caution

These changes are volatile and - in some repositories - extensive, so they need to be carefully reviewed before merging.

🎫 Issue IBX-9727

Description:

Added missing strict type hints using \Rector\Set\ValueObject\SetList::TYPE_DECLARATION set.
Additionally FQCNs have been imported for every affected file using PHP CS Fixer, in some cases they might override unrelated lines.

For QA:

Regression tests.

Applied Rectors:
  * Rector\TypeDeclaration\Rector\Class_\AddTestsVoidReturnTypeWhereNoReturnRector
  * Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector
  * Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector
  * Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector
  * Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanConstReturnsRector
  * Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector
  * Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector
  * Rector\TypeDeclaration\Rector\ClassMethod\ReturnNullableTypeRector
  * Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector
  * Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector
  * Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector
  * Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector
  * Rector\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector
  * Rector\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector
  * Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector
  * Rector\TypeDeclaration\Rector\ClassMethod\StringReturnTypeFromStrictScalarReturnsRector
  * Rector\TypeDeclaration\Rector\ClassMethod\StringReturnTypeFromStrictStringReturnsRector
  * Rector\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector
  * Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector
  * Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector
  * Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector
  * Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector
@@ -923,12 +923,12 @@ public function providerForTestGetSearchTargetsThrowsRuntimeException()
* @param string $message
*/
public function testGetSearchTargetsThrowsRuntimeException(
$endpointMap,
array $endpointMap,
$defaultEndpoint,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are missing typehint

@@ -22,7 +23,7 @@ abstract class AbstractAggregationVisitorTest extends TestCase
protected $visitor;

/** @var \Ibexa\Contracts\Solr\Query\AggregationVisitor|\PHPUnit\Framework\MockObject\MockObject */
protected $dispatcherVisitor;
protected MockObject $dispatcherVisitor;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
protected MockObject $dispatcherVisitor;
protected AggregationVisitor&MockObject $dispatcherVisitor;


final class RangeAggregationVisitorTest extends AbstractAggregationVisitorTest
{
/** @var \Ibexa\Contracts\Solr\Query\Common\AggregationVisitor\AggregationFieldResolver|\PHPUnit\Framework\MockObject\MockObject */
private $aggregationFieldResolver;
private MockObject $aggregationFieldResolver;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $aggregationFieldResolver;
private AggregationFieldResolver&MockObject $aggregationFieldResolver;


final class StatsAggregationVisitorTest extends AbstractAggregationVisitorTest
{
/** @var \Ibexa\Contracts\Solr\Query\Common\AggregationVisitor\AggregationFieldResolver|\PHPUnit\Framework\MockObject\MockObject */
private $aggregationFieldResolver;
private MockObject $aggregationFieldResolver;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $aggregationFieldResolver;
private AggregationFieldResolver&MockObject $aggregationFieldResolver;


final class TermAggregationVisitorTest extends AbstractAggregationVisitorTest
{
/** @var \Ibexa\Contracts\Solr\Query\Common\AggregationVisitor\AggregationFieldResolver|\PHPUnit\Framework\MockObject\MockObject */
private $aggregationFieldResolver;
private MockObject $aggregationFieldResolver;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $aggregationFieldResolver;
private AggregationFieldResolver&MockObject $aggregationFieldResolver;

use PHPUnit\Framework\TestCase;

final class ObjectStateAggregationKeyMapperTest extends TestCase
{
/** @var \Ibexa\Contracts\Core\Repository\ObjectStateService|\PHPUnit\Framework\MockObject\MockObject */
private $objectStateService;
private MockObject $objectStateService;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $objectStateService;
private ObjectStateService&MockObject $objectStateService;

use PHPUnit\Framework\TestCase;

final class SectionAggregationKeyMapperTest extends TestCase
{
private const EXAMPLE_SECTION_IDS = [1, 2, 3];

/** @var \Ibexa\Contracts\Core\Repository\SectionService|\PHPUnit\Framework\MockObject\MockObject */
private $sectionService;
private MockObject $sectionService;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $sectionService;
private SectionService&MockObject $sectionService;

use PHPUnit\Framework\TestCase;

final class SubtreeAggregationKeyMapperTest extends TestCase
{
private const EXAMPLE_PATH_STRING = '/1/2/54/';

/** @var \Ibexa\Contracts\Solr\ResultExtractor\AggregationResultExtractor\TermAggregationKeyMapper|\PHPUnit\Framework\MockObject\MockObject */
private $locationAggregationKeyMapper;
private MockObject $locationAggregationKeyMapper;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $locationAggregationKeyMapper;
private TermAggregationKeyMapper&MockObject $locationAggregationKeyMapper;

@@ -23,10 +24,10 @@ final class UserMetadataAggregationKeyMapperTest extends TestCase
private const EXAMPLE_USER_GROUP_IDS = [1, 2, 3];

/** @var \Ibexa\Contracts\Core\Repository\UserService|\PHPUnit\Framework\MockObject\MockObject */
private $userService;
private MockObject $userService;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $userService;
private UserService&MockObject $userService;

use stdClass;

final class TermAggregationResultExtractorTest extends AbstractAggregationResultExtractorTest
{
/** @var \Ibexa\Contracts\Solr\ResultExtractor\AggregationResultExtractor\TermAggregationKeyMapper|\PHPUnit\Framework\MockObject\MockObject */
private $keyMapper;
private MockObject $keyMapper;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MockObject $keyMapper;
private TermAggregationKeyMapper&MockObject $keyMapper;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants