Skip to content

Improved Tab API phpdoc #986

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

Merged
merged 2 commits into from
Nov 15, 2023
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
70 changes: 0 additions & 70 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1560,51 +1560,6 @@ parameters:
count: 1
path: src/contracts/Permission/PermissionCheckerInterface.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\AbstractControllerBasedTab\\:\\:getControllerReference\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/AbstractControllerBasedTab.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\AbstractControllerBasedTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/AbstractControllerBasedTab.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\AbstractEventDispatchingTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/AbstractEventDispatchingTab.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\AbstractRouteBasedTab\\:\\:getRouteName\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/AbstractRouteBasedTab.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\AbstractRouteBasedTab\\:\\:getRouteParameters\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/AbstractRouteBasedTab.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\AbstractRouteBasedTab\\:\\:getRouteParameters\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/AbstractRouteBasedTab.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\AbstractRouteBasedTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/AbstractRouteBasedTab.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\ConditionalTabInterface\\:\\:evaluate\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/ConditionalTabInterface.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Tab\\\\TabInterface\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Tab/TabInterface.php

-
message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\UniversalDiscovery\\\\Provider\\:\\:getBreadcrumbLocations\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -8835,31 +8790,16 @@ parameters:
count: 1
path: src/lib/Tab/Dashboard/AbstractMediaTab.php

-
message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\Dashboard\\\\EveryoneContentTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Tab/Dashboard/EveryoneContentTab.php

-
message: "#^Parameter \\#1 \\$query of class Ibexa\\\\Core\\\\Pagination\\\\Pagerfanta\\\\LocationSearchAdapter constructor expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\LocationQuery, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query given\\.$#"
count: 1
path: src/lib/Tab/Dashboard/EveryoneContentTab.php

-
message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\Dashboard\\\\EveryoneMediaTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Tab/Dashboard/EveryoneMediaTab.php

-
message: "#^Parameter \\#1 \\$query of class Ibexa\\\\Core\\\\Pagination\\\\Pagerfanta\\\\LocationSearchAdapter constructor expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\LocationQuery, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query given\\.$#"
count: 1
path: src/lib/Tab/Dashboard/EveryoneMediaTab.php

-
message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\Dashboard\\\\MyContentTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Tab/Dashboard/MyContentTab.php

-
message: "#^Parameter \\#1 \\$query of class Ibexa\\\\Core\\\\Pagination\\\\Pagerfanta\\\\LocationSearchAdapter constructor expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\LocationQuery, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query given\\.$#"
count: 1
Expand All @@ -8880,11 +8820,6 @@ parameters:
count: 1
path: src/lib/Tab/Dashboard/MyDraftsTab.php

-
message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\Dashboard\\\\MyMediaTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Tab/Dashboard/MyMediaTab.php

-
message: "#^Parameter \\#1 \\$query of class Ibexa\\\\Core\\\\Pagination\\\\Pagerfanta\\\\LocationSearchAdapter constructor expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\LocationQuery, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query given\\.$#"
count: 1
Expand Down Expand Up @@ -9180,11 +9115,6 @@ parameters:
count: 1
path: src/lib/Tab/URLManagement/LinkManagerTab.php

-
message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\URLManagement\\\\LinkManagerTab\\:\\:renderView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Tab/URLManagement/LinkManagerTab.php

-
message: "#^Property Ibexa\\\\AdminUi\\\\Tab\\\\URLManagement\\\\LinkManagerTab\\:\\:\\$notificationHandler is never read, only written\\.$#"
count: 1
Expand Down
9 changes: 1 addition & 8 deletions src/contracts/Tab/AbstractControllerBasedTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ abstract class AbstractControllerBasedTab extends AbstractTab
/** @var \Symfony\Bridge\Twig\Extension\HttpKernelRuntime */
protected $httpKernelRuntime;

/**
* @param \Twig\Environment $twig
* @param \Symfony\Contracts\Translation\TranslatorInterface $translator
* @param \Symfony\Bridge\Twig\Extension\HttpKernelRuntime $httpKernelRuntime
*/
public function __construct(
Environment $twig,
TranslatorInterface $translator,
Expand All @@ -44,9 +39,7 @@ public function renderView(array $parameters): string
/**
* Returns ControllerReference used to render the tab.
*
* @param array $parameters
*
* @return \Symfony\Component\HttpKernel\Controller\ControllerReference
* @param array<string, mixed> $parameters
*/
abstract public function getControllerReference(array $parameters): ControllerReference;
}
Expand Down
17 changes: 3 additions & 14 deletions src/contracts/Tab/AbstractEventDispatchingTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Twig\Environment;

/**
* Base class representing Tab using EventDisaptcher for extensibility.
* Base class representing Tab using EventDispatcher for extensibility.
*
* It extends AbstractTab by adding Event Dispatching before rendering view.
*/
Expand All @@ -24,11 +24,6 @@ abstract class AbstractEventDispatchingTab extends AbstractTab
/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */
protected $eventDispatcher;

/**
* @param \Twig\Environment $twig
* @param \Symfony\Contracts\Translation\TranslatorInterface $translator
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
*/
public function __construct(
Environment $twig,
TranslatorInterface $translator,
Expand All @@ -39,9 +34,6 @@ public function __construct(
$this->eventDispatcher = $eventDispatcher;
}

/**
* {@inheritdoc}
*/
public function renderView(array $parameters): string
{
$event = new TabViewRenderEvent(
Expand All @@ -57,15 +49,12 @@ public function renderView(array $parameters): string
);
}

/**
* @return string
*/
abstract public function getTemplate(): string;

/**
* @param mixed[] $contextParameters
* @param array<string, mixed> $contextParameters
*
* @return mixed[]
* @return array<string, mixed>
*/
abstract public function getTemplateParameters(array $contextParameters = []): array;
}
Expand Down
14 changes: 3 additions & 11 deletions src/contracts/Tab/AbstractRouteBasedTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ abstract class AbstractRouteBasedTab extends AbstractTab
/** @var \Symfony\Bridge\Twig\Extension\HttpKernelRuntime */
private $httpKernelRuntime;

/**
* @param \Twig\Environment $twig
* @param \Symfony\Contracts\Translation\TranslatorInterface $translator
* @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator
* @param \Symfony\Bridge\Twig\Extension\HttpKernelRuntime $httpKernelRuntime
*/
public function __construct(
Environment $twig,
TranslatorInterface $translator,
Expand All @@ -55,18 +49,16 @@ public function renderView(array $parameters): string
/**
* Returns route name used to generate path to the resource.
*
* @param array $parameters
*
* @return string
* @param array<string, mixed> $parameters
*/
abstract public function getRouteName(array $parameters): string;

/**
* Returns parameters array required to generate path using the router.
*
* @param array $parameters
* @param array<string, mixed> $parameters
*
* @return array
* @return array<string, mixed>
*/
abstract public function getRouteParameters(array $parameters): array;
}
Expand Down
4 changes: 0 additions & 4 deletions src/contracts/Tab/AbstractTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ abstract class AbstractTab implements TabInterface
/** @var \Symfony\Contracts\Translation\TranslatorInterface */
protected $translator;

/**
* @param \Twig\Environment $twig
* @param \Symfony\Contracts\Translation\TranslatorInterface $translator
*/
public function __construct(Environment $twig, TranslatorInterface $translator)
{
$this->twig = $twig;
Expand Down
6 changes: 2 additions & 4 deletions src/contracts/Tab/ConditionalTabInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@

/**
* Conditional Tab interface needs to be implemented by tabs,
* which needs to be evaluate depends on context.
* which needs to be evaluated depending on the context.
*/
interface ConditionalTabInterface
{
/**
* Get information about tab presence.
*
* @param array $parameters
*
* @return bool
* @param array<string, mixed> $parameters
*/
public function evaluate(array $parameters): bool;
}
Expand Down
2 changes: 0 additions & 2 deletions src/contracts/Tab/OrderedTabInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ interface OrderedTabInterface
{
/**
* Get the order of this tab.
*
* @return int
*/
public function getOrder(): int;
}
Expand Down
8 changes: 1 addition & 7 deletions src/contracts/Tab/TabInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,18 @@ interface TabInterface
{
/**
* Returns identifier of the tab.
*
* @return string
*/
public function getIdentifier(): string;

/**
* Returns name of the tab which is displayed as a tab's title in the UI.
*
* @return string
*/
public function getName(): string;

/**
* Returns HTML body of the tab.
*
* @param array $parameters
*
* @return string
* @param array<string, mixed> $parameters
*/
public function renderView(array $parameters): string;
}
Expand Down