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

ENH Add generic types #182

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Contract/StaticPublishingTrigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ interface StaticPublishingTrigger
* Provides an SS_List of StaticallyPublishable objects which need to be regenerated.
*
* @param array $context An associative array with extra engine-specific information.
* @return array|SS_List
* @return iterable
*/
public function objectsToUpdate($context);

/**
* Provides a SS_list of objects that need to be deleted.
*
* @param array $context An associative array with extra engine-specific information.
* @return array|SS_List
* @return iterable
*/
public function objectsToDelete($context);
}
4 changes: 2 additions & 2 deletions src/Extension/Engine/SiteTreePublishingEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* * action - name of the executed action: publish or unpublish
*
* @see PublishableSiteTree
*
* @extends DataExtension<SiteTree>
*/
class SiteTreePublishingEngine extends SiteTreeExtension implements Resettable
{
Expand Down Expand Up @@ -300,7 +302,6 @@ public function flushChanges()
$urlsToDelete = $this->getUrlsToDelete();

if ($urlsToUpdate) {
/** @var UrlBundleInterface $urlService */
$urlService = Injector::inst()->create(UrlBundleInterface::class);
$urlService->addUrls($urlsToUpdate);

Expand All @@ -314,7 +315,6 @@ public function flushChanges()
}

if ($urlsToDelete) {
/** @var UrlBundleInterface $urlService */
$urlService = Injector::inst()->create(UrlBundleInterface::class);
$urlService->addUrls($urlsToDelete);

Expand Down
6 changes: 4 additions & 2 deletions src/Extension/Publishable/PublishableSiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* an extension via the config system ordering (inject your extension "before" the PublishableSiteTree).
*
* @see SiteTreePublishingEngine
*
* @extends DataExtension<SiteTree>
*/
class PublishableSiteTree extends DataExtension implements StaticallyPublishable, StaticPublishingTrigger
{
Expand All @@ -36,7 +38,7 @@ public function getMyVirtualPages()
}

/**
* @return array|SS_List
* @return iterable<SiteTree>
Copy link
Member

Choose a reason for hiding this comment

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

Also update StaticPublishingTrigger return type

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Done

*/
public function objectsToUpdate($context)
{
Expand Down Expand Up @@ -92,7 +94,7 @@ public function objectsToUpdate($context)
/**
* This method controls which caches will be purged
*
* @return array|SS_List
* @return iterable<SiteTree>
Copy link
Member

Choose a reason for hiding this comment

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

Also update StaticPublishingTrigger return type

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

*/
public function objectsToDelete($context)
{
Expand Down