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

Migrate collections to PHP 8 syntax #10084

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

greg0ire
Copy link
Member

No description provided.

* {@inheritDoc}
*/
public function matching(Criteria $criteria)
public function matching(Criteria $criteria): ReadableCollection&Selectable
Copy link
Member Author

Choose a reason for hiding this comment

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

@greg0ire greg0ire force-pushed the drop-collections-1 branch 3 times, most recently from 437574b to 1f8af96 Compare October 5, 2022 20:55
*/
public function matching(Criteria $criteria)
/** @return ReadableCollection<TKey, TValue>&Selectable<TKey, TValue> */
public function matching(Criteria $criteria): ReadableCollection
Copy link
Member

Choose a reason for hiding this comment

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

Can we add Selectable to the native return type?

Suggested change
public function matching(Criteria $criteria): ReadableCollection
public function matching(Criteria $criteria): ReadableCollection&Selectable

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't found how to do so, see #10084 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

So we're not adding the correct native return type because it'll make Psalm sad? Shall we rather ignore the error?

Copy link
Member Author

Choose a reason for hiding this comment

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

It haven't found how to ignore it: it's a crash, not a simple error.

Copy link
Member

Choose a reason for hiding this comment

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

😭

Copy link
Member Author

Choose a reason for hiding this comment

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

@derrabus I've discussed this here: https://symfony-devs.slack.com/archives/C8SFXTD2M/p1665220038738889

I see 4 options:

  1. wait for Psalm 5 before merging this;
  2. merge without the intersection type, wait for a merge up between Psalm 4.x and master and switch all branches to Psalm master branch, and add the type;
  3. merge without the intersection type, wait for Psalm 5 to be released and add the type then
  4. switch to Psalm master branch now and add the type.

I don't see switching only 3.0.x to another version of Psalm as a reasonable option.

2 and 3 have my preference, what about you?

Copy link
Member

Choose a reason for hiding this comment

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

2 sounds good.

Copy link
Member Author

Choose a reason for hiding this comment

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

Extracted that into a new issue: #10118

* @var EntityManagerInterface|null
*/
private $em;
private array|null $association;
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 array|null $association;
private array|null $association = null;

@greg0ire greg0ire force-pushed the drop-collections-1 branch from 1f8af96 to dc2bd9e Compare October 9, 2022 21:29
@greg0ire
Copy link
Member Author

greg0ire commented Oct 9, 2022

Blocked by #10116 and a merge up

@derrabus derrabus added this to the 3.0.0 milestone Oct 10, 2022
@greg0ire greg0ire merged commit 5367ce8 into doctrine:3.0.x Oct 10, 2022
@greg0ire greg0ire deleted the drop-collections-1 branch October 10, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants