Skip to content

Commit

Permalink
ENH Add generic types (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 19, 2024
1 parent d7dcffe commit 192ea76
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Contract/StaticPublishingTrigger.php
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
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
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>
*/
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>
*/
public function objectsToDelete($context)
{
Expand Down

0 comments on commit 192ea76

Please sign in to comment.