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

Change SourceManager implementation #606

Merged
merged 2 commits into from
Oct 4, 2021
Merged

Conversation

core23
Copy link
Member

@core23 core23 commented Sep 29, 2021

Subject

Fixes the build by changing the SourceManager implementation. The class has nothing to do with the exporter, so there is no need to implement the interface.

I am targeting this branch, because this is a breaking change.

Changelog

### Changed
- Change `SourceManager` implementation

@core23 core23 added the major label Sep 29, 2021
@core23 core23 requested a review from a team September 29, 2021 17:11
src/Sitemap/SourceManager.php Outdated Show resolved Hide resolved
src/Sitemap/SourceManager.php Show resolved Hide resolved
VincentLanglet
VincentLanglet previously approved these changes Sep 30, 2021
@VincentLanglet VincentLanglet requested a review from a team September 30, 2021 13:17
@VincentLanglet VincentLanglet mentioned this pull request Sep 30, 2021
@core23 core23 force-pushed the fix-build branch 2 times, most recently from 52a8b64 to 020a0bc Compare September 30, 2021 14:46
src/Sitemap/SourceManager.php Outdated Show resolved Hide resolved
psalm-baseline.xml Outdated Show resolved Hide resolved
Copy link
Member

@VincentLanglet VincentLanglet left a comment

Choose a reason for hiding this comment

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

/**
* @param mixed[] $types
*/
public function addType(array $types): void
Copy link
Member

Choose a reason for hiding this comment

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

addTypes maybe ?

Or the addType should just add one type, and we should have the array_diff logic somewhere else.

Also the only usage of addSource is here:

$source->addMethodCall('addSource', [$sitemap['group'], new Reference($sitemapIteratorId), $sitemap['types']]);

Can't we know what is a type to give a more specific typehint than mixed ? (never used this bundle but I assume it's a string in https://docs.sonata-project.org/projects/SonataSeoBundle/en/3.x/reference/sitemap/#configuration-example)

Then having unique values are kinda easy with strings...

Copy link
Member Author

Choose a reason for hiding this comment

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

addTypes maybe ?

Renamed the method.

Also the only usage of addSource is here:

$source->addMethodCall('addSource', [$sitemap['group'], new Reference($sitemapIteratorId), $sitemap['types']]);

That's not correct. The addSource method here calls the method on SourceIteratorInterface.

Can't we know what is a type to give a more specific typehint than mixed ? (never used this bundle but I assume it's a string in https://docs.sonata-project.org/projects/SonataSeoBundle/en/3.x/reference/sitemap/#configuration-example)

Never used this part either. For what I know, the type is just an array with an unknown signature. I would keep it as it is.

This PR started to just fix the broken 3.x build.

@core23
Copy link
Member Author

core23 commented Sep 30, 2021

Doc need to be updated too https://docs.sonata-project.org/projects/SonataSeoBundle/en/3.x/reference/sitemap/#service-definition

Why? Only the container for all SourceIteratorInterface was refactored.

The docs need to be updated when using the next exporter major version which will remove the SourceIteratorInterface.

@VincentLanglet
Copy link
Member

Doc need to be updated too https://docs.sonata-project.org/projects/SonataSeoBundle/en/3.x/reference/sitemap/#service-definition

Why? Only the container for all SourceIteratorInterface was refactored.

The docs need to be updated when using the next exporter major version which will remove the SourceIteratorInterface.

My bad. I thought it wasnt needed to implement the interface and Iterator was only needed. Indeed it will only be changed in the next major.

@core23 core23 requested a review from a team October 2, 2021 09:33
@core23
Copy link
Member Author

core23 commented Oct 3, 2021

Please review @sonata-project/contributors so we can fix the broken 3.x branch. I would like to release a new major version soon.

@VincentLanglet VincentLanglet requested a review from a team October 3, 2021 19:22
@core23 core23 merged commit 0f06790 into sonata-project:3.x Oct 4, 2021
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.

3 participants