Skip to content

Commit

Permalink
refactor: Clean up types
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jul 19, 2024
1 parent 47d6af5 commit 7276fb1
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/helpers/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,11 @@ public static function generateSitemap(array $params): ?string
/**
* Return the total number of elements in a sitemap, respecting metabundle settings.
*
* @param SeoElementInterface $seoElementClass
* @param class-string<SeoElementInterface> $seoElementClass
* @param MetaBundle $metaBundle
* @return int|null
*/
public static function getTotalElementsInSitemap(SeoElementInterface $seoElementClass, MetaBundle $metaBundle)
public static function getTotalElementsInSitemap(string $seoElementClass, MetaBundle $metaBundle)
{
$totalElements = $seoElementClass::sitemapElementsQuery($metaBundle)->count();

Expand Down
1 change: 0 additions & 1 deletion src/seoelements/SeoCampaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ public static function createContentMetaBundle(Model $sourceModel)
/** @var Site $site */
foreach ($sites as $site) {
$seoElement = self::class;
/** @var SeoElementInterface $seoElement */
Seomatic::$plugin->metaBundles->createMetaBundleFromSeoElement($seoElement, $sourceModel, $site->id);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/seoelements/SeoCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ public static function createContentMetaBundle(Model $sourceModel)
/** @var Site $site */
foreach ($sites as $site) {
$seoElement = self::class;
/** @var SeoElementInterface $seoElement */
Seomatic::$plugin->metaBundles->createMetaBundleFromSeoElement($seoElement, $sourceModel, $site->id);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/seoelements/SeoDigitalProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ public static function createContentMetaBundle(Model $sourceModel)
/** @var Site $site */
foreach ($sites as $site) {
$seoElement = self::class;
/** @var SeoElementInterface $seoElement */
Seomatic::$plugin->metaBundles->createMetaBundleFromSeoElement($seoElement, $sourceModel, $site->id);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/seoelements/SeoEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ public static function createContentMetaBundle(Model $sourceModel)
/** @var Site $site */
foreach ($sites as $site) {
$seoElement = self::class;
/** @var SeoElementInterface $seoElement */
Seomatic::$plugin->metaBundles->createMetaBundleFromSeoElement($seoElement, $sourceModel, $site->id);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/seoelements/SeoEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ public static function createContentMetaBundle(Model $sourceModel)
/** @var Site $site */
foreach ($sites as $site) {
$seoElement = self::class;
/** @var SeoElementInterface $seoElement */
Seomatic::$plugin->metaBundles->createMetaBundleFromSeoElement($seoElement, $sourceModel, $site->id);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/seoelements/SeoProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ public static function createContentMetaBundle(Model $sourceModel)
/** @var Site $site */
foreach ($sites as $site) {
$seoElement = self::class;
/** @var SeoElementInterface $seoElement */
Seomatic::$plugin->metaBundles->createMetaBundleFromSeoElement($seoElement, $sourceModel, $site->id);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/MetaBundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function updateMetaBundle(MetaBundle $metaBundle, int $siteId)
}

/**
* @param SeoElementInterface $seoElement
* @param class-string<SeoElementInterface> $seoElement
* @param Model $sourceModel
* @param int $sourceSiteId
* @param MetaBundle|null $baseConfig
Expand Down
5 changes: 2 additions & 3 deletions src/services/SeoElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ class SeoElements extends Component
/**
* @param null|string $metaBundleType
*
* @return SeoElementInterface|null
* @return class-string<SeoElementInterface>|null
*/
public function getSeoElementByMetaBundleType($metaBundleType)
{
if ($metaBundleType === null) {
return null;
}
/** @var SeoElementInterface[] $seoElements */
$seoElements = $this->getAllSeoElementTypes();

return $seoElements[$metaBundleType] ?? null;
Expand All @@ -95,7 +94,7 @@ public function getSeoElementByMetaBundleType($metaBundleType)
/**
* Returns all available field type classes.
*
* @return string[] The available field type classes
* @return class-string<SeoElementInterface>[] The available field type classes
*/
public function getAllSeoElementTypes(bool $useCache = true): array
{
Expand Down

0 comments on commit 7276fb1

Please sign in to comment.