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

close API: make classes final #1295

Merged
merged 6 commits into from
Feb 8, 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
5 changes: 1 addition & 4 deletions src/Admin/FieldDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

use Sonata\AdminBundle\Admin\BaseFieldDescription;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class FieldDescription extends BaseFieldDescription
final class FieldDescription extends BaseFieldDescription
{
public function getTargetModel(): ?string
{
Expand Down
4 changes: 1 addition & 3 deletions src/Block/AuditBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
use Twig\Environment;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.22
*
* @author Thomas Rabaix <[email protected]>
*/
class AuditBlockService extends AbstractBlockService
final class AuditBlockService extends AbstractBlockService
{
/**
* @var AuditReader
Expand Down
15 changes: 6 additions & 9 deletions src/Builder/DatagridBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,27 @@
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormFactoryInterface;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class DatagridBuilder implements DatagridBuilderInterface
final class DatagridBuilder implements DatagridBuilderInterface
{
/**
* @var FilterFactoryInterface
*/
protected $filterFactory;
private $filterFactory;

/**
* @var FormFactoryInterface
*/
protected $formFactory;
private $formFactory;

/**
* @var TypeGuesserInterface
*/
protected $guesser;
private $guesser;

/**
* @var bool
*/
protected $csrfTokenEnabled;
private $csrfTokenEnabled;

public function __construct(
FormFactoryInterface $formFactory,
Expand Down Expand Up @@ -164,7 +161,7 @@ public function getBaseDatagrid(AdminInterface $admin, array $values = []): Data
*
* @throws \RuntimeException If invalid pager type is set
*/
protected function getPager(string $pagerType): PagerInterface
private function getPager(string $pagerType): PagerInterface
{
switch ($pagerType) {
case Pager::TYPE_DEFAULT:
Expand Down
9 changes: 3 additions & 6 deletions src/Builder/ListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,17 @@
use Sonata\AdminBundle\Builder\ListBuilderInterface;
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class ListBuilder implements ListBuilderInterface
final class ListBuilder implements ListBuilderInterface
{
/**
* @var TypeGuesserInterface
*/
protected $guesser;
private $guesser;

/**
* @var string[]
*/
protected $templates = [];
private $templates = [];

/**
* @param string[] $templates
Expand Down
9 changes: 3 additions & 6 deletions src/Builder/ShowBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,17 @@
use Sonata\AdminBundle\Builder\ShowBuilderInterface;
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class ShowBuilder implements ShowBuilderInterface
final class ShowBuilder implements ShowBuilderInterface
{
/**
* @var TypeGuesserInterface
*/
protected $guesser;
private $guesser;

/**
* @var string[]
*/
protected $templates;
private $templates;

/**
* @param string[] $templates
Expand Down
2 changes: 0 additions & 2 deletions src/Datagrid/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
*
* @author Jonathan H. Wage <[email protected]>
*
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*
* @phpstan-extends BasePager<ProxyQueryInterface>
*/
final class Pager extends BasePager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*
* @author Thomas Rabaix <[email protected]>
*/
class AddAuditEntityCompilerPass implements CompilerPassInterface
final class AddAuditEntityCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Compiler/AddGuesserCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
use Symfony\Component\DependencyInjection\Reference;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*
* @author Thomas Rabaix <[email protected]>
*/
class AddGuesserCompilerPass implements CompilerPassInterface
final class AddGuesserCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
use Symfony\Component\DependencyInjection\Definition;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*
* @author Thomas Rabaix <[email protected]>
*/
class AddTemplatesCompilerPass implements CompilerPassInterface
final class AddTemplatesCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*
* This class contains the configuration information for the bundle.
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
*
* @author Michael Williams <[email protected]>
*/
class Configuration implements ConfigurationInterface
final class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree.
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/SonataDoctrineORMAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*
* @author Thomas Rabaix <[email protected]>
* @author Michael Williams <[email protected]>
*/
class SonataDoctrineORMAdminExtension extends AbstractSonataAdminExtension
final class SonataDoctrineORMAdminExtension extends AbstractSonataAdminExtension
{
public function load(array $configs, ContainerBuilder $container): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/BooleanFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
use Sonata\Form\Type\BooleanType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class BooleanFilter extends Filter
final class BooleanFilter extends Filter
{
public function filter(ProxyQueryInterface $query, string $alias, string $field, array $data): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/CallbackFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class CallbackFilter extends Filter
final class CallbackFilter extends Filter
{
public function filter(ProxyQueryInterface $query, string $alias, string $field, array $data): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/ChoiceFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
use Sonata\AdminBundle\Form\Type\Operator\EqualOperatorType;
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQueryInterface;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class ChoiceFilter extends Filter
final class ChoiceFilter extends Filter
{
public function filter(ProxyQueryInterface $query, string $alias, string $field, array $data): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/ClassFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQueryInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class ClassFilter extends Filter
final class ClassFilter extends Filter
{
public const CHOICES = [
EqualOperatorType::TYPE_EQUAL => 'INSTANCE OF',
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/DateFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

use Symfony\Component\Form\Extension\Core\Type\DateType;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class DateFilter extends AbstractDateFilter
final class DateFilter extends AbstractDateFilter
{
/**
* This filter has no range.
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/DateRangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

use Sonata\Form\Type\DateRangeType;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class DateRangeFilter extends AbstractDateFilter
final class DateRangeFilter extends AbstractDateFilter
{
/**
* This is a range filter.
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/DateTimeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

use Symfony\Component\Form\Extension\Core\Type\DateTimeType;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class DateTimeFilter extends AbstractDateFilter
final class DateTimeFilter extends AbstractDateFilter
{
/**
* This filter has time.
Expand Down
8 changes: 4 additions & 4 deletions src/Model/ModelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@
/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class ModelManager implements ModelManagerInterface, LockInterface
final class ModelManager implements ModelManagerInterface, LockInterface
{
public const ID_SEPARATOR = '~';

/**
* @var ManagerRegistry
*/
protected $registry;
private $registry;

/**
* @var PropertyAccessorInterface
*/
protected $propertyAccessor;
private $propertyAccessor;

/**
* @var EntityManagerInterface[]
*/
protected $cache = [];
private $cache = [];

/**
* NEXT_MAJOR: Make $propertyAccessor mandatory.
Expand Down
5 changes: 1 addition & 4 deletions src/SonataDoctrineORMAdminBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class SonataDoctrineORMAdminBundle extends Bundle
final class SonataDoctrineORMAdminBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/Util/ObjectAclManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.24
*/
class ObjectAclManipulator extends BaseObjectAclManipulator
final class ObjectAclManipulator extends BaseObjectAclManipulator
{
public function batchConfigureAcls(OutputInterface $output, AdminInterface $admin, ?UserSecurityIdentity $securityIdentity = null): void
{
Expand Down
5 changes: 2 additions & 3 deletions tests/Builder/DatagridBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
use Sonata\AdminBundle\Datagrid\SimplePager;
use Sonata\AdminBundle\Filter\FilterFactoryInterface;
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;
use Sonata\AdminBundle\Model\ModelManagerInterface;
use Sonata\AdminBundle\Translator\FormLabelTranslatorStrategy;
use Sonata\DoctrineORMAdminBundle\Admin\FieldDescription;
use Sonata\DoctrineORMAdminBundle\Builder\DatagridBuilder;
use Sonata\DoctrineORMAdminBundle\Filter\ModelAutocompleteFilter;
use Sonata\DoctrineORMAdminBundle\Model\ModelManager;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\Guess\TypeGuess;
Expand Down Expand Up @@ -62,8 +62,7 @@ protected function setUp(): void
);

$this->admin = $this->createMock(AdminInterface::class);
$this->modelManager = $this->createMock(ModelManager::class);

$this->modelManager = $this->createMock(ModelManagerInterface::class);
$this->admin->method('getClass')->willReturn('FakeClass');
$this->admin->method('getModelManager')->willReturn($this->modelManager);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Builder/ListBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
use PHPUnit\Framework\TestCase;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;
use Sonata\AdminBundle\Model\ModelManagerInterface;
use Sonata\DoctrineORMAdminBundle\Admin\FieldDescription;
use Sonata\DoctrineORMAdminBundle\Builder\ListBuilder;
use Sonata\DoctrineORMAdminBundle\Model\ModelManager;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;

Expand All @@ -37,7 +37,7 @@ class ListBuilderTest extends TestCase
protected function setUp(): void
{
$this->typeGuesser = $this->createStub(TypeGuesserInterface::class);
$this->modelManager = $this->createStub(ModelManager::class);
$this->modelManager = $this->createStub(ModelManagerInterface::class);
$this->admin = $this->createMock(AdminInterface::class);

$this->admin->method('getClass')->willReturn('Foo');
Expand Down
4 changes: 2 additions & 2 deletions tests/Builder/ShowBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
use Sonata\AdminBundle\Admin\FieldDescriptionCollection;
use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;
use Sonata\AdminBundle\Model\ModelManagerInterface;
use Sonata\DoctrineORMAdminBundle\Admin\FieldDescription;
use Sonata\DoctrineORMAdminBundle\Builder\ShowBuilder;
use Sonata\DoctrineORMAdminBundle\Model\ModelManager;
use Symfony\Component\Form\Guess\TypeGuess;

/**
Expand Down Expand Up @@ -50,7 +50,7 @@ protected function setUp(): void
);

$this->admin = $this->createMock(AdminInterface::class);
$this->modelManager = $this->createStub(ModelManager::class);
$this->modelManager = $this->createStub(ModelManagerInterface::class);

$this->admin->method('getClass')->willReturn('FakeClass');
$this->admin->method('getModelManager')->willReturn($this->modelManager);
Expand Down
Loading