Skip to content

Commit

Permalink
Add missing typehint
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Dec 21, 2020
1 parent 1c08c17 commit e919db5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/Admin/AdminInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
* @method void defineFormBuilder(FormBuilderInterface $formBuilder)
*
* @phpstan-template T of object
* @phpstan-extends TaggedAdminInterface<T>
* @phpstan-extends AccessRegistryInterface<T>
* @phpstan-extends UrlGeneratorInterface<T>
* @phpstan-extends LifecycleHookProviderInterface<T>
Expand Down
39 changes: 36 additions & 3 deletions src/DependencyInjection/Admin/AbstractTaggedAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

/**
* @phpstan-template T of object
* @phpstan-implements TaggedAdminInterface<T>
*/
abstract class AbstractTaggedAdmin implements TaggedAdminInterface
{
Expand Down Expand Up @@ -69,7 +68,7 @@ abstract class AbstractTaggedAdmin implements TaggedAdminInterface
/**
* @var array<string, array<string, string>>
*
* @phpstan-var array{list: array{class: string}, mosaic: array{class: string}}
* @phpstan-var array{list: array{class: string}, mosaic?: array{class: string}}
*/
protected $listModes = [
'list' => ['class' => 'fa fa-list fa-fw'],
Expand Down Expand Up @@ -248,6 +247,8 @@ public function setLabel($label)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return string|null
*/
public function getLabel()
{
Expand All @@ -257,14 +258,16 @@ public function getLabel()
final public function showMosaicButton($isShown)
{
if ($isShown) {
$this->listModes['mosaic'] = ['class' => static::MOSAIC_ICON_CLASS];
$this->listModes['mosaic'] = ['class' => self::MOSAIC_ICON_CLASS];
} else {
unset($this->listModes['mosaic']);
}
}

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return array<string, array<string, string>>
*/
public function getListModes()
{
Expand Down Expand Up @@ -299,6 +302,8 @@ public function setManagerType($type)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return string|null // NEXT_MAJOR: Remove null
*/
public function getManagerType()
{
Expand Down Expand Up @@ -372,6 +377,8 @@ public function setModelManager(ModelManagerInterface $modelManager)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return ModelManagerInterface|null // NEXT_MAJOR: Remove null
*/
public function getModelManager()
{
Expand Down Expand Up @@ -401,6 +408,8 @@ public function setDataSource(DataSourceInterface $dataSource)

/**
* NEXT_MAJOR: Change typehint for DataSourceInterface.
*
* @return DataSourceInterface|null // NEXT_MAJOR: Remove null
*/
public function getDataSource(): ?DataSourceInterface
{
Expand Down Expand Up @@ -430,6 +439,8 @@ public function setFormContractor(FormContractorInterface $formBuilder)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return FormContractorInterface|null // NEXT_MAJOR: Remove null
*/
public function getFormContractor()
{
Expand Down Expand Up @@ -459,6 +470,8 @@ public function setShowBuilder(ShowBuilderInterface $showBuilder)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return ShowBuilderInterface|null // NEXT_MAJOR: Remove null
*/
public function getShowBuilder()
{
Expand Down Expand Up @@ -488,6 +501,8 @@ public function setListBuilder(ListBuilderInterface $listBuilder)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return ListBuilderInterface|null // NEXT_MAJOR: Remove null
*/
public function getListBuilder()
{
Expand Down Expand Up @@ -517,6 +532,8 @@ public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return DatagridBuilderInterface|null // NEXT_MAJOR: Remove null
*/
public function getDatagridBuilder()
{
Expand Down Expand Up @@ -546,6 +563,8 @@ public function setTranslator(TranslatorInterface $translator)

/**
* @final since sonata-admin/admin-bundle 3.83
*
* @return TranslatorInterface|null // NEXT_MAJOR: Remove null
*/
public function getTranslator()
{
Expand Down Expand Up @@ -575,6 +594,8 @@ public function setConfigurationPool(Pool $configurationPool)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return Pool|null // NEXT_MAJOR: Remove null
*/
public function getConfigurationPool()
{
Expand Down Expand Up @@ -606,6 +627,8 @@ public function setRouteGenerator(RouteGeneratorInterface $routeGenerator)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return RouteGeneratorInterface|null // NEXT_MAJOR: Remove null
*/
public function getRouteGenerator()
{
Expand Down Expand Up @@ -647,6 +670,8 @@ public function setValidator($validator)
* NEXT_MAJOR: Remove this method.
*
* @deprecated since sonata-project/admin-bundle 3.83 and will be removed in 4.0
*
* @return ValidatorInterface|null // NEXT_MAJOR: Remove null
*/
public function getValidator()
{
Expand All @@ -668,6 +693,8 @@ public function setSecurityHandler(SecurityHandlerInterface $securityHandler)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return SecurityHandlerInterface|null // NEXT_MAJOR: Remove null
*/
public function getSecurityHandler()
{
Expand Down Expand Up @@ -697,6 +724,8 @@ public function setMenuFactory(FactoryInterface $menuFactory)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return FactoryInterface|null // NEXT_MAJOR: Remove null
*/
public function getMenuFactory()
{
Expand Down Expand Up @@ -726,6 +755,8 @@ public function setRouteBuilder(RouteBuilderInterface $routeBuilder)

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return RouteBuilderInterface|null // NEXT_MAJOR: Remove null
*/
public function getRouteBuilder()
{
Expand Down Expand Up @@ -755,6 +786,8 @@ public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $lab

/**
* @final since sonata-admin/admin-bundle 3.84
*
* @return LabelTranslatorStrategyInterface|null // NEXT_MAJOR: Remove null
*/
public function getLabelTranslatorStrategy()
{
Expand Down
2 changes: 0 additions & 2 deletions src/DependencyInjection/Admin/TaggedAdminInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
* - The first and third argument are automatically injected by the AddDependencyCallsCompilerPass.
* - The second one is used as a reference of the Admin in the Pool, with the `setAdminClasses` call.
*
* @phpstan-template T of object
*
* @method void initialize()
* @method void setLabel(?string $label)
* @method void showMosaicButton(bool $isShown)
Expand Down

0 comments on commit e919db5

Please sign in to comment.