Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Closing API by marking some classes with "@Final" annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Wojciech Błoszyk <wbloszyk@gmail.com>
  • Loading branch information
wbloszyk authored and phansys committed Sep 21, 2021
1 parent 7995c3d commit 0b9e10d
Show file tree
Hide file tree
Showing 36 changed files with 128 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/Block/Breadcrumb/NewsArchiveBreadcrumbBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @final since sonata-project/news-bundle 3.x
*
* BlockService for archive breadcrumb.
*
* @author Sylvain Deloux <sylvain.deloux@ekino.com>
Expand Down
2 changes: 2 additions & 0 deletions src/Block/Breadcrumb/NewsPostBreadcrumbBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @final since sonata-project/news-bundle 3.x
*
* BlockService for post breadcrumb.
*
* @author Sylvain Deloux <sylvain.deloux@ekino.com>
Expand Down
2 changes: 2 additions & 0 deletions src/Block/RecentCommentsBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @final since sonata-project/news-bundle 3.x
*
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
class RecentCommentsBlockService extends AbstractAdminBlockService
Expand Down
2 changes: 2 additions & 0 deletions src/Block/RecentPostsBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @final since sonata-project/news-bundle 3.x
*
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
class RecentPostsBlockService extends AbstractAdminBlockService
Expand Down
3 changes: 3 additions & 0 deletions src/Command/SynchronizeCommentsCountCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* @final since sonata-project/news-bundle 3.x
*/
class SynchronizeCommentsCountCommand extends ContainerAwareCommand
{
public function configure()
Expand Down
5 changes: 5 additions & 0 deletions src/Controller/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

/**
* NEXT_MAJOR: remove this method.
*
* @deprecated since sonata-project/news-bundle 3.x, to be removed in 4.0.
*/
class PostController extends Controller
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* @final since sonata-project/news-bundle 3.x
*
* This is the class that validates and merges configuration from your app/config files.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/SonataNewsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* @final since sonata-project/news-bundle 3.x
*
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
class SonataNewsExtension extends Extension
Expand Down
5 changes: 5 additions & 0 deletions src/Entity/CommentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public function delete($comment, $andFlush = true)
$this->updateCommentsCount($post);
}

/**
* NEXT_MAJOR: remove this method.
*
* @deprecated since sonata-project/news-bundle 3.x, to be removed in 4.0.
*/
public function getPager(array $criteria, $page, $limit = 10, array $sort = [])
{
if (!isset($criteria['mode'])) {
Expand Down
4 changes: 4 additions & 0 deletions src/Entity/PostManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public function findOneByPermalink($permalink, BlogInterface $blog)
}

/**
* NEXT_MAJOR: remove this method.
*
* @deprecated since sonata-project/news-bundle 3.x, to be removed in 4.0.
*
* Valid criteria are:
* enabled - boolean
* date - query
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/NoDriverException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
namespace Sonata\NewsBundle\Exception;

/**
* @final since sonata-project/news-bundle 3.x
*
* @author Christian Gripp <mail@core23.de>
*/
class NoDriverException extends \RuntimeException
Expand Down
3 changes: 3 additions & 0 deletions src/Form/Type/CommentStatusType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use Sonata\Form\Type\BaseStatusType;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @final since sonata-project/news-bundle 3.x
*/
class CommentStatusType extends BaseStatusType
{
public function configureOptions(OptionsResolver $resolver)
Expand Down
3 changes: 3 additions & 0 deletions src/Form/Type/CommentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @final since sonata-project/news-bundle 3.x
*/
class CommentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
Expand Down
3 changes: 3 additions & 0 deletions src/Mailer/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Templating\EngineInterface;

/**
* @final since sonata-project/news-bundle 3.x
*/
class Mailer implements MailerInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Permalink/CollectionPermalink.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

use Sonata\NewsBundle\Model\PostInterface;

/**
* @final since sonata-project/news-bundle 3.x
*/
class CollectionPermalink implements PermalinkInterface
{
public function generate(PostInterface $post)
Expand Down
3 changes: 3 additions & 0 deletions src/Permalink/DatePermalink.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

use Sonata\NewsBundle\Model\PostInterface;

/**
* @final since sonata-project/news-bundle 3.x
*/
class DatePermalink implements PermalinkInterface
{
/**
Expand Down
7 changes: 7 additions & 0 deletions src/SonataNewsBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* @final since sonata-project/news-bundle 3.x
*/
class SonataNewsBundle extends Bundle
{
public function build(ContainerBuilder $container)
Expand All @@ -34,7 +37,11 @@ public function boot()
}

/**
* NEXT_MAJOR: remove this method.
*
* Register form mapping information.
*
* @deprecated since sonata-project/news-bundle 3.x, to be removed in 4.0.
*/
public function registerFormMapping()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Status/CommentStatusRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Sonata\Twig\Status\StatusClassRendererInterface;

/**
* @final since sonata-project/news-bundle 3.x
*
* @author Hugo Briand <briand@ekino.com>
*/
class CommentStatusRenderer implements StatusClassRendererInterface
Expand Down
3 changes: 3 additions & 0 deletions src/Twig/Extension/NewsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
use Twig\Extension\InitRuntimeInterface;
use Twig\TwigFunction;

/**
* @final since sonata-project/news-bundle 3.x
*/
class NewsExtension extends AbstractExtension implements InitRuntimeInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Util/HashGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

use Sonata\NewsBundle\Model\CommentInterface;

/**
* @final since sonata-project/news-bundle 3.x
*/
class HashGenerator implements HashGeneratorInterface
{
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Action/DailyPostArchiveActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment;

class DailyPostArchiveActionTest extends TestCase
final class DailyPostArchiveActionTest extends TestCase
{
public function testInvoke()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/Api/CommentControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @group legacy
*/
class CommentControllerTest extends TestCase
final class CommentControllerTest extends TestCase
{
public function testGetCommentAction()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/Api/PostControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @group legacy
*/
class PostControllerTest extends TestCase
final class PostControllerTest extends TestCase
{
public function testGetPostsAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Symfony\Component\DependencyInjection\Definition;
use Twig\Extra\String\StringExtension;

class TwigStringExtensionCompilerPassTest extends AbstractCompilerPassTestCase
final class TwigStringExtensionCompilerPassTest extends AbstractCompilerPassTestCase
{
public function testLoadTwigStringExtension(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/SonataNewsExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use Sonata\NewsBundle\Model\Post;
use Sonata\NewsBundle\Tests\Fixtures\UserMock;

class SonataNewsExtensionTest extends AbstractExtensionTestCase
final class SonataNewsExtensionTest extends AbstractExtensionTestCase
{
protected function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Document/CommentManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @group legacy
*/
class CommentManagerTest extends TestCase
final class CommentManagerTest extends TestCase
{
public function testImplements()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Document/PostManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @group legacy
*/
class PostManagerTest extends TestCase
final class PostManagerTest extends TestCase
{
public function testImplements()
{
Expand Down
6 changes: 5 additions & 1 deletion tests/Entity/CommentManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
use Sonata\NewsBundle\Model\PostManagerInterface;

/**
* NEXT_MAJOR: Remove this class.
*
* Tests the comment manager entity.
*
* @author Romain Mouillard <romain.mouillard@gmail.com>
*
* @group legacy
*/
class CommentManagerTest extends TestCase
final class CommentManagerTest extends TestCase
{
use EntityManagerMockFactoryTrait;

Expand Down

0 comments on commit 0b9e10d

Please sign in to comment.