Skip to content

Commit

Permalink
Code Quality
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Feb 23, 2024
1 parent 4372827 commit 64f76e6
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
4 changes: 1 addition & 3 deletions src/EventListener/AbstractTableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ public function __construct(string $table)

/**
* Register necessary callbacks for this listener.
*
* @return void
*/
abstract public function register();
abstract public function register(): void;

/**
* Gets the table name for this listener.
Expand Down
8 changes: 4 additions & 4 deletions src/EventListener/BackendView/ParentChildViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class ParentChildViewListener extends AbstractViewListener
protected function isSupported()
{
return $this->getTable() === Input::get('table') && (
('news' === Input::get('do') && InstalledVersions::isInstalled('contao/news-bundle'))
|| ('calendar' === Input::get('do') && InstalledVersions::isInstalled('contao/calendar-bundle'))
|| ('faq' === Input::get('do') && InstalledVersions::isInstalled('contao/faq-bundle'))
);
('news' === Input::get('do') && InstalledVersions::isInstalled('contao/news-bundle'))
|| ('calendar' === Input::get('do') && InstalledVersions::isInstalled('contao/calendar-bundle'))
|| ('faq' === Input::get('do') && InstalledVersions::isInstalled('contao/faq-bundle'))
);
}

protected function getCurrentPage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ private function generateLabelWithWarning($label, $imgStyle = '')
);
}

private static function getCallbacks(): array {
private static function getCallbacks(): array
{
if (null !== self::$callbacks) {
return self::$callbacks;
}
Expand Down
11 changes: 2 additions & 9 deletions src/EventListener/DataContainer/PageFieldsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ class PageFieldsListener
/**
* Sets rootNodes when initializing the languageMain field.
*
* @param mixed $value
*
* @return mixed
*
* @Callback(table="tl_page", target="fields.languageMain.load")
*/
public function onLoadLanguageMain($value, DataContainer $dc)
Expand Down Expand Up @@ -55,15 +51,12 @@ public function onLoadLanguageMain($value, DataContainer $dc)
/**
* Validate input value when saving tl_page.languageMain field.
*
* @param mixed $value
*
* @return mixed
*
* @Callback(table="tl_page", target="fields.languageMain.save")
*/
public function onSaveLanguageMain($value, DataContainer $dc)
{
// Validate that there is no other page in the current page tree with the same languageMain assigned
// Validate that there is no other page in the current page tree with the same
// languageMain assigned
if ($value > 0) {
$currentPage = PageModel::findWithDetails($dc->id);
$childIds = Database::getInstance()->getChildRecords($currentPage->rootId, 'tl_page');
Expand Down
3 changes: 2 additions & 1 deletion src/EventListener/Navigation/AbstractNavigationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public function onChangelanguageNavigation(ChangelanguageNavigationEvent $event)
return;
}

// Remove the news/event/faq alias from the URL if there is no actual reader page assigned
// Remove the news/event/faq alias from the URL if there is no actual
// reader page assigned
if (!$navigationItem->isDirectFallback()) {
$event->getUrlParameterBag()->removeUrlAttribute($this->getUrlKey());
}
Expand Down
2 changes: 2 additions & 0 deletions src/Helper/LanguageText.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ static function (NavigationItem $a, NavigationItem $b) use ($languages) {

/**
* Create instance from serialized data of optionsWizard widget.
*
* @param string|array|null $config
*/
public static function createFromOptionWizard($config): self
{
Expand Down
2 changes: 0 additions & 2 deletions src/Navigation/UrlParameterBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ public function generateQueryString(): ?string

/**
* Makes sure the given value is scalar or an array of scalar values.
*
* @param mixed $value
*/
private function validateScalar($value): void
{
Expand Down

0 comments on commit 64f76e6

Please sign in to comment.