Skip to content
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

Add final for every method of abstract classes #7108

Merged
merged 2 commits into from
May 2, 2021
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
11 changes: 11 additions & 0 deletions src/Builder/AbstractFormContractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public function __construct(FormFactoryInterface $formFactory)
$this->formFactory = $formFactory;
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription)
{
$fieldDescription->setOption('edit', $fieldDescription->getOption('edit', 'standard'));
Expand All @@ -49,18 +52,26 @@ public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInter
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @return FormFactoryInterface
*/
public function getFormFactory()
{
return $this->formFactory;
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function getFormBuilder($name, array $formOptions = [])
{
return $this->getFormFactory()->createNamedBuilder($name, FormType::class, null, $formOptions);
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function getDefaultOptions($type, FieldDescriptionInterface $fieldDescription)
{
// NEXT_MAJOR: Remove this line and update the function signature.
Expand Down
40 changes: 40 additions & 0 deletions src/Datagrid/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ public function setMaxRecordLimit($limit)
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* Returns an array of page numbers to use in pagination links.
*
* @param int $nbLinks The maximum number of page numbers to return
Expand Down Expand Up @@ -225,6 +227,8 @@ public function getLinks($nbLinks = null)
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* Returns true if the current query requires pagination.
*
* @return bool
Expand Down Expand Up @@ -479,6 +483,8 @@ public function getNbResults()
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @return int
*/
public function getFirstPage()
Expand All @@ -487,6 +493,8 @@ public function getFirstPage()
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @return int
*/
public function getLastPage()
Expand All @@ -495,6 +503,8 @@ public function getLastPage()
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @return int
*/
public function getPage()
Expand All @@ -503,6 +513,8 @@ public function getPage()
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @return int
*/
public function getNextPage()
Expand All @@ -511,13 +523,18 @@ public function getNextPage()
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @return int
*/
public function getPreviousPage()
{
return max($this->getPage() - 1, $this->getFirstPage());
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function setPage($page)
{
$this->page = (int) $page;
Expand All @@ -528,11 +545,17 @@ public function setPage($page)
}
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function getMaxPerPage()
{
return $this->maxPerPage;
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function setMaxPerPage($max)
{
if ($max > 0) {
Expand All @@ -553,17 +576,25 @@ public function setMaxPerPage($max)
}
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function getMaxPageLinks()
{
return $this->maxPageLinks;
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function setMaxPageLinks($maxPageLinks)
{
$this->maxPageLinks = $maxPageLinks;
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* Returns true if on the first page.
*
* @return bool
Expand All @@ -574,6 +605,8 @@ public function isFirstPage()
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* Returns true if on the last page.
*
* @return bool
Expand Down Expand Up @@ -854,12 +887,17 @@ public function setCountColumn(array $countColumn)
return $this->countColumn = $countColumn;
}

/**
* @final since sonata-project/admin-bundle 3.x.
*/
public function setQuery($query)
{
$this->query = $query;
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @return ProxyQueryInterface|null
*
* @phpstan-return T|null $query
Expand Down Expand Up @@ -889,6 +927,8 @@ protected function setNbResults($nb)
}

/**
* @final since sonata-project/admin-bundle 3.x.
*
* @param int $page
*
* @return void
Expand Down
9 changes: 4 additions & 5 deletions src/Datagrid/SimplePager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class SimplePager extends Pager
protected $results;

/**
* NEXT_MAJOR: Remove this property.
*
* @deprecated since sonata-project/admin-bundle 3.x
*
* @var bool
*/
protected $haveToPaginate;
Expand Down Expand Up @@ -146,11 +150,6 @@ public function getResults($hydrationMode = null)
return $this->results;
}

public function haveToPaginate()
{
return $this->haveToPaginate || $this->getPage() > 1;
}

/**
* {@inheritdoc}
*
Expand Down
Loading