Skip to content

Conversation

@sicet7
Copy link
Contributor

@sicet7 sicet7 commented Jan 14, 2025

🔍 What was changed

This PR removes the of object from the Cycle\ORM\RepositoryInterface class generic type.

🤔 Why?

This is to prevent the following psalm error from occoring when extending the Cycle\ORM\RepositoryInterface and then using it for the repository parameter in the Cycle\Annotated\Annotation\Entity attribute.

Error:

ERROR: InvalidArgument - FailedQueueJob.php:18:21 - Argument 1 of Cycle\Annotated\Annotation\Entity::__construct expects class-string<Cycle\ORM\RepositoryInterface<object>>|null, but FailedQueueJobRepository::class provided (see https://psalm.dev/004)
        repository: FailedQueueJobRepository::class

This PR has its origins here: https://github.com/orgs/cycle/discussions/507

📝 Checklist

  • How was this tested:
    • Tested manually

@roxblnfk
Copy link
Member

roxblnfk commented Jan 14, 2025

CI was not started :/
image

Could you force push the commit?

@roxblnfk roxblnfk self-requested a review January 14, 2025 10:07
@roxblnfk
Copy link
Member

Ok. It just requires approval but the button is not exist here :) Found it in Actions tab

@roxblnfk
Copy link
Member

roxblnfk commented Jan 14, 2025

Could you fix other psalm issues or run composer psalm:baseline?

<file name="src/Service/Implementation/EntityProvider.php">
 <error line="21" column="73" severity="error" message="MixedInferredReturnType: Could not verify return type &apos;TEntity|null|object&apos; for Cycle\ORM\Service\Implementation\EntityProvider::get"/>
</file>
<file name="src/Service/Implementation/EntityProvider.php">
 <error line="33" column="16" severity="error" message="MixedReturnStatement: Could not infer a return type"/>
</file>

@sicet7
Copy link
Contributor Author

sicet7 commented Jan 14, 2025

Could you fix other psalm issues or run psalm:baseline?

<file name="src/Service/Implementation/EntityProvider.php">
 <error line="21" column="73" severity="error" message="MixedInferredReturnType: Could not verify return type &apos;TEntity|null|object&apos; for Cycle\ORM\Service\Implementation\EntityProvider::get"/>
</file>
<file name="src/Service/Implementation/EntityProvider.php">
 <error line="33" column="16" severity="error" message="MixedReturnStatement: Could not infer a return type"/>
</file>

Will give it a try :-)

@roxblnfk
Copy link
Member

Looks good 👍

@roxblnfk roxblnfk merged commit a366d01 into cycle:2.x Jan 14, 2025
1 of 2 checks passed
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.

2 participants