Skip to content

Commit

Permalink
Merge pull request #18 from stefandoorn/interface-improvements
Browse files Browse the repository at this point in the history
Be more strict on alternative URLs input (demand string) and less strict on return type of alternatives (iterable now, instead of array)
  • Loading branch information
stefandoorn authored Oct 14, 2017
2 parents 3adc13a + f56df39 commit bce3aa4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Model/SitemapUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class SitemapUrl implements SitemapUrlInterface
/**
* {@inheritdoc}
*/
public function addAlternative($location, $locale): void
public function addAlternative(string $location, string $locale): void
{
$this->alternatives[$locale] = $location;
}

/**
* {@inheritdoc}
*/
public function setAlternatives(array $alternatives): void
public function setAlternatives(iterable $alternatives): void
{
$this->alternatives = $alternatives;
}
Expand Down
13 changes: 7 additions & 6 deletions src/Model/SitemapUrlInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ public function getLocalization(): ?string;
public function setLocalization(string $localization): void;

/**
* {@inheritdoc}
* @param string $location
* @param string $locale
*/
public function addAlternative($location, $locale): void;
public function addAlternative(string $location, string $locale): void;

/**
* {@inheritdoc}
* @param iterable $alternatives
*/
public function setAlternatives(array $alternatives): void;
public function setAlternatives(iterable $alternatives): void;

/**
* {@inheritdoc}
* @return iterable
*/
public function getAlternatives(): iterable;

Expand All @@ -46,7 +47,7 @@ public function getLastModification(): ?DateTimeInterface;
public function setLastModification(DateTimeInterface $lastModification): void;

/**
* @return ChangeFrequency
* @return string
*/
public function getChangeFrequency(): string;

Expand Down

0 comments on commit bce3aa4

Please sign in to comment.