Pārlūkot izejas kodu

Merge pull request #2661 from pulzarraider/cs_doc_fix

Minor CS and doc fixes, declared missing properties, fixed deprecated logger->err calls
Andrej Hudec 10 gadi atpakaļ
vecāks
revīzija
24cb39c357
68 mainītis faili ar 144 papildinājumiem un 217 dzēšanām
  1. 10 11
      Admin/Admin.php
  2. 0 1
      Admin/AdminExtension.php
  3. 0 1
      Admin/AdminExtensionInterface.php
  4. 0 1
      Admin/AdminHelper.php
  5. 5 8
      Admin/AdminInterface.php
  6. 4 8
      Admin/BaseFieldDescription.php
  7. 0 2
      Admin/FieldDescriptionCollection.php
  8. 0 2
      Admin/FieldDescriptionInterface.php
  9. 1 1
      Admin/Pool.php
  10. 0 3
      Block/AdminListBlockService.php
  11. 0 2
      Builder/FormContractorInterface.php
  12. 1 1
      DependencyInjection/Compiler/ExtensionCompilerPass.php
  13. 0 1
      Export/Exporter.php
  14. 0 2
      Filter/Filter.php
  15. 4 4
      Form/ChoiceList/ModelChoiceList.php
  16. 1 1
      Form/Extension/Field/Type/MopaCompatibilityTypeFieldExtension.php
  17. 0 1
      Form/Type/AdminType.php
  18. 4 4
      Generator/AdminGenerator.php
  19. 2 2
      Generator/ControllerGenerator.php
  20. 1 2
      Guesser/TypeGuesserChain.php
  21. 5 7
      Manipulator/ServicesManipulator.php
  22. 3 3
      Model/AuditReaderInterface.php
  23. 1 1
      Model/ModelManagerInterface.php
  24. 1 1
      Route/AdminPoolLoader.php
  25. 2 2
      Route/RouteCollection.php
  26. 1 1
      Route/RouteGeneratorInterface.php
  27. 0 2
      Search/SearchHandler.php
  28. 1 1
      Security/Handler/AclSecurityHandlerInterface.php
  29. 8 12
      Tests/Admin/AdminTest.php
  30. 2 2
      Tests/Admin/BaseAdminModelManagerTest.php
  31. 5 5
      Tests/Admin/BaseFieldDescriptionTest.php
  32. 1 1
      Tests/Command/CreateClassCacheCommandTest.php
  33. 2 2
      Tests/Command/ExplainAdminCommandTest.php
  34. 3 21
      Tests/Command/GenerateAdminCommandTest.php
  35. 1 4
      Tests/Command/ListAdminCommandTest.php
  36. 3 9
      Tests/Command/SetupAclCommandTest.php
  37. 4 5
      Tests/Controller/CoreControllerTest.php
  38. 1 2
      Tests/Datagrid/DatagridMapperTest.php
  39. 5 14
      Tests/Datagrid/PagerTest.php
  40. 3 2
      Tests/DependencyInjection/Compiler/ExtensionCompilerPassTest.php
  41. 6 6
      Tests/Event/AdminEventExtensionTest.php
  42. 1 1
      Tests/Event/ConfigureQueryEventTest.php
  43. 1 1
      Tests/Event/PersistenceEventTest.php
  44. 0 4
      Tests/Fixtures/Admin/CommentAdmin.php
  45. 0 2
      Tests/Fixtures/Controller/FooAdminController.php
  46. 9 4
      Tests/Fixtures/Entity/FooArrayAccess.php
  47. 1 1
      Tests/Form/DataTransformer/ModelToIdTransformerTest.php
  48. 6 9
      Tests/Form/DataTransformer/ModelsToArrayTransformerTest.php
  49. 2 4
      Tests/Model/AuditManagerTest.php
  50. 0 1
      Tests/Resources/XliffTest.php
  51. 2 2
      Tests/Route/AdminPoolLoaderTest.php
  52. 1 1
      Tests/Route/DefaultRouteGeneratorTest.php
  53. 3 3
      Tests/Search/SearchHandlerTest.php
  54. 1 1
      Tests/Security/Acl/Permission/MaskBuilderTest.php
  55. 2 2
      Tests/Security/Handler/RoleSecurityHandlerTest.php
  56. 5 5
      Tests/Show/ShowMapperTest.php
  57. 1 1
      Tests/Translator/BCLabelTranslatorStrategyTest.php
  58. 4 4
      Tests/Translator/Extractor/JMSTranslatorBundle/AdminExtractorTest.php
  59. 1 1
      Tests/Translator/FormLabelTranslatorStrategyTest.php
  60. 2 2
      Tests/Translator/NativeLabelTranslatorStrategyTest.php
  61. 1 1
      Tests/Translator/NoopLabelTranslatorStrategyTest.php
  62. 1 1
      Tests/Translator/UnderscoreLabelTranslatorStrategyTest.php
  63. 0 1
      Tests/Validator/ErrorElementTest.php
  64. 2 2
      Translator/Extractor/JMSTranslatorBundle/AdminExtractor.php
  65. 2 0
      Util/FormBuilderIterator.php
  66. 2 0
      Util/FormViewIterator.php
  67. 1 1
      Util/ObjectAclManipulator.php
  68. 2 1
      Validator/InlineValidator.php

+ 10 - 11
Admin/Admin.php

@@ -12,7 +12,6 @@
 namespace Sonata\AdminBundle\Admin;
 
 use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
-use Sonata\AdminBundle\Route\RoutesCache;
 use Sonata\CoreBundle\Model\Metadata;
 use Symfony\Component\Form\Form;
 use Symfony\Component\Form\FormBuilder;
@@ -28,7 +27,6 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
 use Sonata\AdminBundle\Datagrid\DatagridMapper;
 use Sonata\AdminBundle\Show\ShowMapper;
 
-use Sonata\AdminBundle\Admin\Pool;
 use Sonata\AdminBundle\Validator\ErrorElement;
 use Sonata\AdminBundle\Validator\Constraints\InlineConstraint;
 
@@ -264,7 +262,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
     /**
      * Reference the parent collection
      *
-     * @var Admin
+     * @var AdminInterface|null
      */
     protected $parent = null;
 
@@ -541,7 +539,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
      * Configures the tab menu in your admin
      *
      * @param MenuItemInterface $menu
-     * @param                   $action
+     * @param string            $action
      * @param AdminInterface    $childAdmin
      *
      * @return mixed
@@ -1355,7 +1353,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
 
         $metadata->addConstraint(new InlineConstraint(array(
             'service' => $this,
-            'method'  => function(ErrorElement $errorElement, $object) use ($admin) {
+            'method'  => function (ErrorElement $errorElement, $object) use ($admin) {
                 /* @var \Sonata\AdminBundle\Admin\AdminInterface $admin */
 
                 // This avoid the main validation to be cascaded to children
@@ -2101,6 +2099,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
 
         $breadcrumbs = array_reverse($breadcrumbs);
         array_shift($breadcrumbs);
+
         return $breadcrumbs;
     }
 
@@ -2216,13 +2215,13 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
     }
 
     /**
-     * translate a message id
+     * Translate a message id
      *
-     * @param string  $id
-     * @param integer $count
-     * @param array   $parameters
-     * @param null    $domain
-     * @param null    $locale
+     * @param string      $id
+     * @param integer     $count
+     * @param array       $parameters
+     * @param string|null $domain
+     * @param string|null $locale
      *
      * @return string the translated string
      */

+ 0 - 1
Admin/AdminExtension.php

@@ -16,7 +16,6 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper;
 use Sonata\AdminBundle\Show\ShowMapper;
 use Sonata\AdminBundle\Route\RouteCollection;
 use Sonata\AdminBundle\Validator\ErrorElement;
-use Sonata\AdminBundle\Admin\AdminInterface;
 use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
 
 use Knp\Menu\ItemInterface as MenuItemInterface;

+ 0 - 1
Admin/AdminExtensionInterface.php

@@ -16,7 +16,6 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper;
 use Sonata\AdminBundle\Show\ShowMapper;
 use Sonata\AdminBundle\Route\RouteCollection;
 use Sonata\AdminBundle\Validator\ErrorElement;
-use Sonata\AdminBundle\Admin\AdminInterface;
 use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
 
 use Knp\Menu\ItemInterface as MenuItemInterface;

+ 0 - 1
Admin/AdminHelper.php

@@ -17,7 +17,6 @@ use Symfony\Component\Form\FormView;
 use Sonata\AdminBundle\Exception\NoValueException;
 use Sonata\AdminBundle\Util\FormViewIterator;
 use Sonata\AdminBundle\Util\FormBuilderIterator;
-use Sonata\AdminBundle\Admin\BaseFieldDescription;
 
 class AdminHelper
 {

+ 5 - 8
Admin/AdminInterface.php

@@ -11,8 +11,6 @@
 
 namespace Sonata\AdminBundle\Admin;
 
-use Sonata\AdminBundle\Admin\Pool;
-use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
 use Sonata\AdminBundle\Builder\FormContractorInterface;
 use Sonata\AdminBundle\Builder\ListBuilderInterface;
 use Sonata\AdminBundle\Builder\DatagridBuilderInterface;
@@ -24,7 +22,6 @@ use Sonata\AdminBundle\Validator\ErrorElement;
 use Sonata\AdminBundle\Route\RouteGeneratorInterface;
 
 use Knp\Menu\FactoryInterface as MenuFactoryInterface;
-use Knp\Menu\ItemInterface as MenuItemInterface;
 
 use Sonata\CoreBundle\Model\Metadata;
 use Symfony\Component\Validator\ValidatorInterface;
@@ -180,7 +177,7 @@ interface AdminInterface
     public function generateMenuUrl($name, array $parameters = array(), $absolute = false);
 
     /**
-     * @return \Sonata\AdminBundle\Model\ModelManagerInterface;
+     * @return \Sonata\AdminBundle\Model\ModelManagerInterface
      */
     public function getModelManager();
 
@@ -233,7 +230,7 @@ interface AdminInterface
 
     /**
      * @return boolean true if a request object is linked to this Admin, false
-     *      otherwise.
+     *                 otherwise.
      */
     public function hasRequest();
 
@@ -570,7 +567,7 @@ interface AdminInterface
      *
      * @param string $code
      *
-     * @return array|null
+     * @return AdminInterface|null
      */
     public function getChild($code);
 
@@ -601,7 +598,7 @@ interface AdminInterface
     public function getObject($id);
 
     /**
-     * @param string $subject
+     * @param object $subject
      *
      * @return mixed
      */
@@ -850,7 +847,7 @@ interface AdminInterface
     /**
      * Remove a form group field
      *
-     * @param $key
+     * @param string $key
      *
      * @return void
      */

+ 4 - 8
Admin/BaseFieldDescription.php

@@ -11,7 +11,6 @@
 
 namespace Sonata\AdminBundle\Admin;
 
-use Sonata\AdminBundle\Admin\AdminInterface;
 use Sonata\AdminBundle\Exception\NoValueException;
 use Symfony\Component\DependencyInjection\Container;
 
@@ -106,17 +105,17 @@ abstract class BaseFieldDescription implements FieldDescriptionInterface
     protected $options = array();
 
     /**
-     * @var Admin|null the parent Admin instance
+     * @var AdminInterface|null the parent Admin instance
      */
     protected $parent = null;
 
     /**
-     * @var Admin the related admin instance
+     * @var AdminInterface the related admin instance
      */
     protected $admin;
 
     /**
-     * @var Admin the associated admin class if the object is associated to another entity
+     * @var AdminInterface the associated admin class if the object is associated to another entity
      */
     protected $associationAdmin;
 
@@ -293,9 +292,6 @@ abstract class BaseFieldDescription implements FieldDescriptionInterface
     }
 
     /**
-     * set the association admin instance (only used if the field is linked to an Admin)
-     *
-     * @param \Sonata\AdminBundle\Admin\AdminInterface $associationAdmin the associated admin
      * {@inheritdoc}
      */
     public function setAssociationAdmin(AdminInterface $associationAdmin)
@@ -479,6 +475,6 @@ abstract class BaseFieldDescription implements FieldDescriptionInterface
      */
     public function getTranslationDomain()
     {
-        return $this->getOption('translation_domain') ? : $this->getAdmin()->getTranslationDomain();
+        return $this->getOption('translation_domain') ?: $this->getAdmin()->getTranslationDomain();
     }
 }

+ 0 - 2
Admin/FieldDescriptionCollection.php

@@ -10,8 +10,6 @@
  */
 namespace Sonata\AdminBundle\Admin;
 
-use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
-
 class FieldDescriptionCollection implements \ArrayAccess, \Countable
 {
     protected $elements = array();

+ 0 - 2
Admin/FieldDescriptionInterface.php

@@ -11,8 +11,6 @@
 
 namespace Sonata\AdminBundle\Admin;
 
-use Sonata\AdminBundle\Admin\AdminInterface;
-
 interface FieldDescriptionInterface
 {
 

+ 1 - 1
Admin/Pool.php

@@ -207,7 +207,7 @@ class Pool
     }
 
     /**
-     * @return null|\Symfony\Component\DependencyInjection\ContainerInterface
+     * @return ContainerInterface|null
      */
     public function getContainer()
     {

+ 0 - 3
Block/AdminListBlockService.php

@@ -14,14 +14,11 @@ namespace Sonata\AdminBundle\Block;
 use Sonata\BlockBundle\Block\BlockContextInterface;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
-
 use Sonata\AdminBundle\Form\FormMapper;
 use Sonata\AdminBundle\Validator\ErrorElement;
 use Sonata\AdminBundle\Admin\Pool;
-
 use Sonata\BlockBundle\Model\BlockInterface;
 use Sonata\BlockBundle\Block\BaseBlockService;
-use Symfony\Component\OptionsResolver\OptionsResolver;
 use Symfony\Component\OptionsResolver\OptionsResolverInterface;
 
 /**

+ 0 - 2
Builder/FormContractorInterface.php

@@ -12,8 +12,6 @@
 namespace Sonata\AdminBundle\Builder;
 
 use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
-use Sonata\AdminBundle\Admin\AdminInterface;
-
 use Symfony\Component\Form\FormBuilder;
 use Symfony\Component\Form\FormFactoryInterface;
 

+ 1 - 1
DependencyInjection/Compiler/ExtensionCompilerPass.php

@@ -83,7 +83,7 @@ class ExtensionCompilerPass implements CompilerPassInterface
     protected function getExtensionsForAdmin($id, Definition $admin, ContainerBuilder $container, array $extensionMap)
     {
         $extensions = array();
-        $class = $classReflection = $subjectReflection = null;
+        $classReflection = $subjectReflection = null;
 
         $excludes = $extensionMap['excludes'];
         unset($extensionMap['excludes']);

+ 0 - 1
Export/Exporter.php

@@ -11,7 +11,6 @@
 
 namespace Sonata\AdminBundle\Export;
 
-use Symfony\Component\HttpFoundation\StreamedResponse;
 use Sonata\CoreBundle\Exporter\Exporter as BaseExporter;
 
 /**

+ 0 - 2
Filter/Filter.php

@@ -11,8 +11,6 @@
 
 namespace Sonata\AdminBundle\Filter;
 
-use Sonata\AdminBundle\Filter\FilterInterface;
-
 abstract class Filter implements FilterInterface
 {
     protected $name = null;

+ 4 - 4
Form/ChoiceList/ModelChoiceList.php

@@ -194,9 +194,9 @@ class ModelChoiceList extends SimpleChoiceList
      * If they have single identifiers, they are either fetched from the
      * internal entity cache (if filled) or loaded from the database.
      *
-     * @param string $key The choice key (for entities with composite
-     *                      identifiers) or entity ID (for entities with single
-     *                      identifiers)
+     * @param  string $key The choice key (for entities with composite
+     *                     identifiers) or entity ID (for entities with single
+     *                     identifiers)
      * @return object The matching entity
      */
     public function getEntity($key)
@@ -241,7 +241,7 @@ class ModelChoiceList extends SimpleChoiceList
      *
      * @param  object                   $entity The entity for which to get the identifier
      * @throws InvalidArgumentException If the entity does not exist in Doctrine's
-     *                                  identity map
+     *                                         identity map
      * @return array
      */
     public function getIdentifierValues($entity)

+ 1 - 1
Form/Extension/Field/Type/MopaCompatibilityTypeFieldExtension.php

@@ -57,4 +57,4 @@ class MopaCompatibilityTypeFieldExtension extends AbstractTypeExtension
     {
         return 'form';
     }
-}
+}

+ 0 - 1
Form/Type/AdminType.php

@@ -16,7 +16,6 @@ use Symfony\Component\Form\FormBuilderInterface;
 use Symfony\Component\Form\FormInterface;
 use Symfony\Component\Form\FormView;
 
-use Symfony\Component\Form\ReversedTransformer;
 use Symfony\Component\OptionsResolver\Options;
 use Symfony\Component\OptionsResolver\OptionsResolverInterface;
 

+ 4 - 4
Generator/AdminGenerator.php

@@ -33,7 +33,7 @@ class AdminGenerator extends Generator
 
     /**
      * @param ModelManagerInterface $modelManager
-     * @param array|string $skeletonDirectories
+     * @param array|string          $skeletonDirectories
      */
     public function __construct(ModelManagerInterface $modelManager, $skeletonDirectories)
     {
@@ -42,9 +42,9 @@ class AdminGenerator extends Generator
     }
 
     /**
-     * @param BundleInterface $bundle
-     * @param string $adminClassBasename
-     * @param string $modelClass
+     * @param  BundleInterface   $bundle
+     * @param  string            $adminClassBasename
+     * @param  string            $modelClass
      * @throws \RuntimeException
      */
     public function generate(BundleInterface $bundle, $adminClassBasename, $modelClass)

+ 2 - 2
Generator/ControllerGenerator.php

@@ -36,8 +36,8 @@ class ControllerGenerator extends Generator
     }
 
     /**
-     * @param BundleInterface $bundle
-     * @param string $controllerClassBasename
+     * @param  BundleInterface   $bundle
+     * @param  string            $controllerClassBasename
      * @throws \RuntimeException
      */
     public function generate(BundleInterface $bundle, $controllerClassBasename)

+ 1 - 2
Guesser/TypeGuesserChain.php

@@ -12,7 +12,6 @@
 
 namespace Sonata\AdminBundle\Guesser;
 
-use Sonata\AdminBundle\Guesser\TypeGuesserInterface;
 use Symfony\Component\Form\Exception\UnexpectedTypeException;
 use Symfony\Component\Form\Guess\Guess;
 use Sonata\AdminBundle\Model\ModelManagerInterface;
@@ -61,7 +60,7 @@ class TypeGuesserChain implements TypeGuesserInterface
      * return values
      *
      * @param \Closure $closure The closure to execute. Accepts a guesser
-     *                            as argument and should return a Guess instance
+     *                          as argument and should return a Guess instance
      *
      * @return Guess The guess with the highest confidence
      */

+ 5 - 7
Manipulator/ServicesManipulator.php

@@ -12,8 +12,6 @@
 
 namespace Sonata\AdminBundle\Manipulator;
 
-use Symfony\Component\HttpKernel\Bundle\BundleInterface;
-use Symfony\Component\DependencyInjection\Container;
 use Symfony\Component\Yaml\Yaml;
 
 /**
@@ -42,11 +40,11 @@ class ServicesManipulator
     }
 
     /**
-     * @param string $serviceId
-     * @param string $modelClass
-     * @param string $adminClass
-     * @param string $controllerName
-     * @param string $managerType
+     * @param  string            $serviceId
+     * @param  string            $modelClass
+     * @param  string            $adminClass
+     * @param  string            $controllerName
+     * @param  string            $managerType
      * @throws \RuntimeException
      */
     public function addResource($serviceId, $modelClass, $adminClass, $controllerName, $managerType)

+ 3 - 3
Model/AuditReaderInterface.php

@@ -41,9 +41,9 @@ interface AuditReaderInterface
 
     /**
      * @param string $className
-     * @param int $id
-     * @param int $oldRevision
-     * @param int $newRevision
+     * @param int    $id
+     * @param int    $oldRevision
+     * @param int    $newRevision
      */
     public function diff($className, $id, $oldRevision, $newRevision);
 }

+ 1 - 1
Model/ModelManagerInterface.php

@@ -139,7 +139,7 @@ interface ModelManagerInterface
      * @param object $model
      *
      * @return string a string representation of the identifiers for this
-     *      instance
+     *                instance
      */
     public function getNormalizedIdentifier($model);
 

+ 1 - 1
Route/AdminPoolLoader.php

@@ -62,7 +62,7 @@ class AdminPoolLoader extends FileLoader
      */
     public function load($resource, $type = null)
     {
-        $collection = new SymfonyRouteCollection;
+        $collection = new SymfonyRouteCollection();
         foreach ($this->adminServiceIds as $id) {
 
             $admin = $this->pool->getInstance($id);

+ 2 - 2
Route/RouteCollection.php

@@ -63,7 +63,7 @@ class RouteCollection
 
         $defaults['_sonata_name'] = $routeName;
 
-        $this->elements[$this->getCode($name)] = function() use ($pattern, $defaults, $requirements, $options) {
+        $this->elements[$this->getCode($name)] = function () use ($pattern, $defaults, $requirements, $options) {
             return new Route($pattern, $defaults, $requirements, $options);
         };
 
@@ -255,4 +255,4 @@ class RouteCollection
     {
         return $this->baseRoutePattern;
     }
-}
+}

+ 1 - 1
Route/RouteGeneratorInterface.php

@@ -30,7 +30,7 @@ interface RouteGeneratorInterface
      * @param array                                    $parameters
      * @param bool                                     $absolute
      *
-     * @return string
+     * @return array
      */
     public function generateMenuUrl(AdminInterface $admin, $name, array $parameters = array(), $absolute = false);
 

+ 0 - 2
Search/SearchHandler.php

@@ -11,11 +11,9 @@
 
 namespace Sonata\AdminBundle\Search;
 
-
 use Sonata\AdminBundle\Admin\AdminInterface;
 use Sonata\AdminBundle\Admin\Pool;
 use Sonata\AdminBundle\Filter\FilterInterface;
-use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
 
 /**
  * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>

+ 1 - 1
Security/Handler/AclSecurityHandlerInterface.php

@@ -68,7 +68,7 @@ interface AclSecurityHandlerInterface extends SecurityHandlerInterface
      * @abstract
      *
      * @param \Traversable $oids a collection of ObjectIdentityInterface implementations
-     * @param array $sids an array of SecurityIdentityInterface implementations
+     * @param array        $sids an array of SecurityIdentityInterface implementations
      *
      * @throws \Exception
      * @return \SplObjectStorage mapping the passed object identities to ACLs

+ 8 - 12
Tests/Admin/AdminTest.php

@@ -105,7 +105,7 @@ class AdminTest extends \PHPUnit_Framework_TestCase
         );
         $admin->addChild($commentAdmin);
         $admin->setRequest(new Request(array('id' => 42)));
-        $commentAdmin->setRequest(new Request);
+        $commentAdmin->setRequest(new Request());
         $commentAdmin->initialize();
         $admin->initialize();
         $commentAdmin->setCurrentChild($subCommentAdmin);
@@ -133,7 +133,7 @@ class AdminTest extends \PHPUnit_Framework_TestCase
         $modelManager->expects($this->exactly(1))
             ->method('find')
             ->with('Application\Sonata\NewsBundle\Entity\Post', 42)
-            ->will($this->returnValue(new DummySubject));
+            ->will($this->returnValue(new DummySubject()));
 
         $menuFactory->expects($this->exactly(5))
             ->method('createItem')
@@ -153,7 +153,6 @@ class AdminTest extends \PHPUnit_Framework_TestCase
             ->with('sonata_admin_dashboard')
             ->will($this->returnValue('http://somehost.com'));
 
-
         $translatorStrategy->expects($this->exactly(18))
             ->method('getLabel')
             ->withConsecutive(
@@ -239,16 +238,14 @@ class AdminTest extends \PHPUnit_Framework_TestCase
             )
             ->will($this->returnValue($menu));
 
-
         $admin->getBreadcrumbs('repost');
-        $admin->setSubject(new DummySubject);
+        $admin->setSubject(new DummySubject());
         $admin->getBreadcrumbs('flag');
 
-
         $commentAdmin->getBreadcrumbs('edit');
 
         $commentAdmin->getBreadcrumbs('list');
-        $commentAdmin->setSubject(new DummySubject);
+        $commentAdmin->setSubject(new DummySubject());
         $commentAdmin->getBreadcrumbs('reply');
     }
 
@@ -265,7 +262,7 @@ class AdminTest extends \PHPUnit_Framework_TestCase
         );
         $admin->addChild($commentAdmin);
         $admin->setRequest(new Request(array('id' => 42)));
-        $commentAdmin->setRequest(new Request);
+        $commentAdmin->setRequest(new Request());
         $commentAdmin->initialize();
         $admin->initialize();
 
@@ -318,9 +315,8 @@ class AdminTest extends \PHPUnit_Framework_TestCase
             )
             ->will($this->returnValue($menu));
 
-
         $admin->getBreadcrumbs('repost');
-        $admin->setSubject(new DummySubject);
+        $admin->setSubject(new DummySubject());
         $flagBreadcrumb = $admin->getBreadcrumbs('flag');
         $this->assertSame($flagBreadcrumb, $admin->getBreadcrumbs('flag'));
     }
@@ -604,11 +600,11 @@ class AdminTest extends \PHPUnit_Framework_TestCase
 
         $this->assertNotEmpty($admin->toString($s));
 
-        $s = new FooToString;
+        $s = new FooToString();
         $this->assertEquals('salut', $admin->toString($s));
 
         // To string method is implemented, but returns null
-        $s = new FooToStringNull;
+        $s = new FooToStringNull();
         $this->assertNotEmpty($admin->toString($s));
 
         $this->assertEquals("", $admin->toString(false));

+ 2 - 2
Tests/Admin/BaseAdminModelManagerTest.php

@@ -44,7 +44,7 @@ class BaseAdminModelManagerTest extends \PHPUnit_Framework_TestCase
     public function testObject()
     {
         $modelManager = $this->getMock('Sonata\AdminBundle\Model\ModelManagerInterface');
-        $modelManager->expects($this->once())->method('find')->will($this->returnCallback(function($class, $id) {
+        $modelManager->expects($this->once())->method('find')->will($this->returnCallback(function ($class, $id) {
             if ($class != 'class') {
                 throw new \RuntimeException('Invalid class argument');
             }
@@ -62,7 +62,7 @@ class BaseAdminModelManagerTest extends \PHPUnit_Framework_TestCase
     public function testCreateQuery()
     {
         $modelManager = $this->getMock('Sonata\AdminBundle\Model\ModelManagerInterface');
-        $modelManager->expects($this->once())->method('createQuery')->will($this->returnCallback(function($class) {
+        $modelManager->expects($this->once())->method('createQuery')->will($this->returnCallback(function ($class) {
             if ($class != 'class') {
                 throw new \RuntimeException('Invalid class argument');
             }

+ 5 - 5
Tests/Admin/BaseFieldDescriptionTest.php

@@ -103,7 +103,7 @@ class BaseFieldDescriptionTest extends \PHPUnit_Framework_TestCase
         $mock->expects($this->once())->method('getFoo')->will($this->returnValue(42));
 
         $this->assertEquals(42, $description->getFieldValue($mock, 'fake'));
-        
+
         /**
          * Test with One parameter int
          */
@@ -112,13 +112,13 @@ class BaseFieldDescriptionTest extends \PHPUnit_Framework_TestCase
         $description1 = new FieldDescription();
         $description1->setOption('code', 'getWithOneParameter');
         $description1->setOption('parameters', $oneParameter);
-        
+
         $mock1 = $this->getMock('stdClass', array('getWithOneParameter'));
         $returnValue1 = $arg1 + 2;
         $mock1->expects($this->once())->method('getWithOneParameter')->with($this->equalTo($arg1))->will($this->returnValue($returnValue1));
-        
+
         $this->assertEquals(40, $description1->getFieldValue($mock1, 'fake'));
-        
+
         /**
          * Test with Two parameters int
          */
@@ -127,7 +127,7 @@ class BaseFieldDescriptionTest extends \PHPUnit_Framework_TestCase
         $description2 = new FieldDescription();
         $description2->setOption('code', 'getWithTwoParameters');
         $description2->setOption('parameters', $twoParameters);
-        
+
         $mock2 = $this->getMock('stdClass', array('getWithTwoParameters'));
         $returnValue2 = $arg1 + $arg2;
         $mock2->expects($this->any())->method('getWithTwoParameters')->with($this->equalTo($arg1),$this->equalTo($arg2))->will($this->returnValue($returnValue2));

+ 1 - 1
Tests/Command/CreateClassCacheCommandTest.php

@@ -61,7 +61,7 @@ class CreateClassCacheCommandTest extends \PHPUnit_Framework_TestCase
 
         $container->expects($this->any())
                 ->method('get')
-                ->will($this->returnCallback(function($id) use ($kernel) {
+                ->will($this->returnCallback(function ($id) use ($kernel) {
                     if ($id == 'kernel') {
                         return $kernel;
                     }

+ 2 - 2
Tests/Command/ExplainAdminCommandTest.php

@@ -125,7 +125,7 @@ class ExplainAdminCommandTest extends \PHPUnit_Framework_TestCase
 
         $this->admin->expects($this->any())
             ->method('getParent')
-            ->will($this->returnCallback(function() use ($adminParent) {
+            ->will($this->returnCallback(function () use ($adminParent) {
                 return $adminParent;
             }));
 
@@ -139,7 +139,7 @@ class ExplainAdminCommandTest extends \PHPUnit_Framework_TestCase
 
         $container->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($id) use ($container, $admin, $validator) {
+            ->will($this->returnCallback(function ($id) use ($container, $admin, $validator) {
                 switch ($id) {
                     case 'sonata.admin.pool':
                         $pool = new Pool($container, '', '');

+ 3 - 21
Tests/Command/GenerateAdminCommandTest.php

@@ -203,17 +203,15 @@ class GenerateAdminCommandTest extends \PHPUnit_Framework_TestCase
 
             $dialog->expects($this->any())
                 ->method('askConfirmation')
-                ->will($this->returnCallback(function(OutputInterface $output, $question, $default) {
+                ->will($this->returnCallback(function (OutputInterface $output, $question, $default) {
                     $questionClean = substr($question, 6, strpos($question, '</info>')-6);
 
                     switch ($questionClean) {
                         case 'Do you want to generate a controller':
                             return 'yes';
-                            break;
 
                         case 'Do you want to update the services YAML configuration file':
                             return 'yes';
-                            break;
                     }
 
                     return $default;
@@ -221,38 +219,31 @@ class GenerateAdminCommandTest extends \PHPUnit_Framework_TestCase
 
             $dialog->expects($this->any())
                 ->method('askAndValidate')
-                ->will($this->returnCallback(function(OutputInterface $output, $question, $validator, $attempts = false, $default = null) use ($modelEntity) {
+                ->will($this->returnCallback(function (OutputInterface $output, $question, $validator, $attempts = false, $default = null) use ($modelEntity) {
 
                     $questionClean = substr($question, 6, strpos($question, '</info>')-6);
 
                     switch ($questionClean) {
                         case 'The fully qualified model class':
                             return $modelEntity;
-                            break;
 
                         case 'The bundle name':
                             return 'AcmeDemoBundle';
-                            break;
 
                         case 'The admin class basename':
                             return 'FooAdmin';
-                            break;
 
                         case 'The controller class basename':
                             return 'FooAdminController';
-                            break;
 
                         case 'The services YAML configuration file':
                             return 'admin.yml';
-                            break;
 
                         case 'The admin service ID':
                             return 'acme_demo_admin.admin.foo';
-                            break;
 
                         case 'The manager type':
                             return 'foo';
-                            break;
                     }
 
                     return $default;
@@ -264,47 +255,38 @@ class GenerateAdminCommandTest extends \PHPUnit_Framework_TestCase
 
             $questionHelper->expects($this->any())
                 ->method('ask')
-                ->will($this->returnCallback(function(InputInterface $input, OutputInterface $output, Question $question) use ($modelEntity) {
+                ->will($this->returnCallback(function (InputInterface $input, OutputInterface $output, Question $question) use ($modelEntity) {
                     $questionClean = substr($question->getQuestion(), 6, strpos($question->getQuestion(), '</info>')-6);
 
                     switch ($questionClean) {
                         // confirmations
                         case 'Do you want to generate a controller':
                             return 'yes';
-                            break;
 
                         case 'Do you want to update the services YAML configuration file':
                             return 'yes';
-                            break;
 
                         // inputs
                         case 'The fully qualified model class':
                             return $modelEntity;
-                            break;
 
                         case 'The bundle name':
                             return 'AcmeDemoBundle';
-                            break;
 
                         case 'The admin class basename':
                             return 'FooAdmin';
-                            break;
 
                         case 'The controller class basename':
                             return 'FooAdminController';
-                            break;
 
                         case 'The services YAML configuration file':
                             return 'admin.yml';
-                            break;
 
                         case 'The admin service ID':
                             return 'acme_demo_admin.admin.foo';
-                            break;
 
                         case 'The manager type':
                             return 'foo';
-                            break;
                     }
 
                     return false;

+ 1 - 4
Tests/Command/ListAdminCommandTest.php

@@ -40,22 +40,19 @@ class ListAdminCommandTest extends \PHPUnit_Framework_TestCase
 
         $container->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($id) use ($container, $admin1, $admin2) {
+            ->will($this->returnCallback(function ($id) use ($container, $admin1, $admin2) {
                 switch ($id) {
                     case 'sonata.admin.pool':
                         $pool = new Pool($container, '', '');
                         $pool->setAdminServiceIds(array('acme.admin.foo', 'acme.admin.bar'));
 
                         return $pool;
-                        break;
 
                     case 'acme.admin.foo':
                         return $admin1;
-                        break;
 
                     case 'acme.admin.bar':
                         return $admin2;
-                        break;
                 }
 
                 return null;

+ 3 - 9
Tests/Command/SetupAclCommandTest.php

@@ -33,22 +33,19 @@ class SetupAclCommandTest extends \PHPUnit_Framework_TestCase
 
         $container->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($id) use ($container, $admin, $aclManipulator) {
+            ->will($this->returnCallback(function ($id) use ($container, $admin, $aclManipulator) {
                 switch ($id) {
                     case 'sonata.admin.pool':
                         $pool = new Pool($container, '', '');
                         $pool->setAdminServiceIds(array('acme.admin.foo'));
 
                         return $pool;
-                        break;
 
                     case 'sonata.admin.manipulator.acl.admin':
                         return $aclManipulator;
-                        break;
 
                     case 'acme.admin.foo':
                         return $admin;
-                        break;
                 }
 
                 return null;
@@ -74,7 +71,7 @@ class SetupAclCommandTest extends \PHPUnit_Framework_TestCase
 
         $container->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($id) use ($container) {
+            ->will($this->returnCallback(function ($id) use ($container) {
                 if ($id == 'sonata.admin.pool') {
                     $pool = new Pool($container, '', '');
                     $pool->setAdminServiceIds(array('acme.admin.foo'));
@@ -106,22 +103,19 @@ class SetupAclCommandTest extends \PHPUnit_Framework_TestCase
 
         $container->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($id) use ($container, $admin) {
+            ->will($this->returnCallback(function ($id) use ($container, $admin) {
                 switch ($id) {
                     case 'sonata.admin.pool':
                         $pool = new Pool($container, '', '');
                         $pool->setAdminServiceIds(array('acme.admin.foo'));
 
                         return $pool;
-                        break;
 
                     case 'sonata.admin.manipulator.acl.admin':
                         return new \stdClass();
-                        break;
 
                     case 'acme.admin.foo':
                         return $admin;
-                        break;
                 }
 
                 return null;

+ 4 - 5
Tests/Controller/CoreControllerTest.php

@@ -46,10 +46,10 @@ class CoreControllerTest extends \PHPUnit_Framework_TestCase
             'request_stack'     => $requestStack
         );
 
-        $container->expects($this->any())->method('get')->will($this->returnCallback(function($id) use ($values) {
+        $container->expects($this->any())->method('get')->will($this->returnCallback(function ($id) use ($values) {
             return $values[$id];
         }));
-        $container->expects($this->any())->method('getParameter')->will($this->returnCallback(function($name) {
+        $container->expects($this->any())->method('getParameter')->will($this->returnCallback(function ($name) {
             if ($name == 'sonata.admin.configuration.dashboard_blocks') {
                 return array();
             }
@@ -90,16 +90,15 @@ class CoreControllerTest extends \PHPUnit_Framework_TestCase
             'request_stack'     => $requestStack
         );
 
-        $container->expects($this->any())->method('get')->will($this->returnCallback(function($id) use ($values) {
+        $container->expects($this->any())->method('get')->will($this->returnCallback(function ($id) use ($values) {
             return $values[$id];
         }));
-        $container->expects($this->any())->method('getParameter')->will($this->returnCallback(function($name) {
+        $container->expects($this->any())->method('getParameter')->will($this->returnCallback(function ($name) {
             if ($name == 'sonata.admin.configuration.dashboard_blocks') {
                 return array();
             }
         }));
 
-
         $controller = new CoreController();
         $controller->setContainer($container);
 

+ 1 - 2
Tests/Datagrid/DatagridMapperTest.php

@@ -21,7 +21,6 @@ use Sonata\AdminBundle\Admin\FieldDescriptionCollection;
 use Sonata\AdminBundle\Datagrid\PagerInterface;
 use Sonata\AdminBundle\Filter\Filter;
 use Sonata\AdminBundle\Filter\FilterInterface;
-use Sonata\AdminBundle\Translator\NoopLabelTranslatorStrategy;
 
 /**
  * @author Andrej Hudec <pulzarraider@gmail.com>
@@ -62,7 +61,7 @@ class DatagridMapperTest extends \PHPUnit_Framework_TestCase
 
         $datagridBuilder->expects($this->any())
             ->method('addFilter')
-            ->will($this->returnCallback(function($datagrid, $type, $fieldDescription, $admin) use ($filter) {
+            ->will($this->returnCallback(function ($datagrid, $type, $fieldDescription, $admin) use ($filter) {
                 $fieldDescription->setType($type);
 
                 $filterClone = clone $filter;

+ 5 - 14
Tests/Datagrid/PagerTest.php

@@ -311,14 +311,14 @@ class PagerTest extends \PHPUnit_Framework_TestCase
     {
         $this->pager->expects($this->any())
             ->method('getResults')
-            ->will($this->returnValue(array(123 => new \stdClass)));
+            ->will($this->returnValue(array(123 => new \stdClass())));
 
         $this->assertEquals(123, $this->pager->key());
     }
 
     public function testCurrent()
     {
-        $object = new \stdClass;
+        $object = new \stdClass();
 
         $this->pager->expects($this->any())
             ->method('getResults')
@@ -372,19 +372,16 @@ class PagerTest extends \PHPUnit_Framework_TestCase
         $id = 0;
         $query->expects($this->any())
             ->method('execute')
-            ->will($this->returnCallback(function() use (&$id, $object1, $object2, $object3) {
+            ->will($this->returnCallback(function () use (&$id, $object1, $object2, $object3) {
                 switch ($id) {
                     case 0:
                         return array($object1);
-                        break;
 
                     case 1:
                         return array($object2);
-                        break;
 
                     case 2:
                         return array($object3);
-                        break;
                 }
 
                 return null;
@@ -503,19 +500,16 @@ class PagerTest extends \PHPUnit_Framework_TestCase
         $id = 0;
         $query->expects($this->any())
             ->method('execute')
-            ->will($this->returnCallback(function() use (&$id, $object1, $object2, $object3) {
+            ->will($this->returnCallback(function () use (&$id, $object1, $object2, $object3) {
                 switch ($id) {
                     case 0:
                         return array($object1);
-                        break;
 
                     case 1:
                         return array($object2);
-                        break;
 
                     case 2:
                         return array($object3);
-                        break;
                 }
 
                 return null;
@@ -564,19 +558,16 @@ class PagerTest extends \PHPUnit_Framework_TestCase
         $id = 2;
         $query->expects($this->any())
             ->method('execute')
-            ->will($this->returnCallback(function() use (&$id, $object1, $object2, $object3) {
+            ->will($this->returnCallback(function () use (&$id, $object1, $object2, $object3) {
                 switch ($id) {
                     case 0:
                         return array($object1);
-                        break;
 
                     case 1:
                         return array($object2);
-                        break;
 
                     case 2:
                         return array($object3);
-                        break;
                 }
 
                 return null;

+ 3 - 2
Tests/DependencyInjection/Compiler/ExtensionCompilerPassTest.php

@@ -79,7 +79,7 @@ class ExtensionCompilerPassTest extends \PHPUnit_Framework_TestCase
             'Sonata\AdminBundle\DependencyInjection\Compiler\ExtensionCompilerPass', 'flattenExtensionConfiguration'
         );
 
-        $method->setAccessible(TRUE);
+        $method->setAccessible(true);
         $extensionMap = $method->invokeArgs(new ExtensionCompilerPass(), array($extensionMap));
 
         $this->assertArrayHasKey('admins', $extensionMap);
@@ -108,7 +108,7 @@ class ExtensionCompilerPassTest extends \PHPUnit_Framework_TestCase
             'Sonata\AdminBundle\DependencyInjection\Compiler\ExtensionCompilerPass', 'flattenExtensionConfiguration'
         );
 
-        $method->setAccessible(TRUE);
+        $method->setAccessible(true);
         $extensionMap = $method->invokeArgs(new ExtensionCompilerPass(), array($extensionMap));
 
         // Admins
@@ -272,6 +272,7 @@ class ExtensionCompilerPassTest extends \PHPUnit_Framework_TestCase
                 ),
             )
         );
+
         return $config;
     }
 

+ 6 - 6
Tests/Event/AdminEventExtensionTest.php

@@ -120,7 +120,7 @@ class AdminEventExtensionTest extends \PHPUnit_Framework_TestCase
         $this->getExtension(array(
             $this->equalTo('sonata.admin.event.persistence.pre_update'),
             $this->callback($this->getConfigurePersistenceClosure(PersistenceEvent::TYPE_PRE_UPDATE))
-        ))->preUpdate($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass);
+        ))->preUpdate($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass());
     }
 
     public function testConfigureQuery()
@@ -135,7 +135,7 @@ class AdminEventExtensionTest extends \PHPUnit_Framework_TestCase
         $this->getExtension(array(
             $this->equalTo('sonata.admin.event.persistence.post_update'),
             $this->callback($this->getConfigurePersistenceClosure(PersistenceEvent::TYPE_POST_UPDATE))
-        ))->postUpdate($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass);
+        ))->postUpdate($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass());
     }
 
     public function testPrePersist()
@@ -143,7 +143,7 @@ class AdminEventExtensionTest extends \PHPUnit_Framework_TestCase
         $this->getExtension(array(
             $this->equalTo('sonata.admin.event.persistence.pre_persist'),
             $this->callback($this->getConfigurePersistenceClosure(PersistenceEvent::TYPE_PRE_PERSIST))
-        ))->prePersist($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass);
+        ))->prePersist($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass());
     }
 
     public function testPostPersist()
@@ -151,7 +151,7 @@ class AdminEventExtensionTest extends \PHPUnit_Framework_TestCase
         $this->getExtension(array(
             $this->equalTo('sonata.admin.event.persistence.post_persist'),
             $this->callback($this->getConfigurePersistenceClosure(PersistenceEvent::TYPE_POST_PERSIST))
-        ))->postPersist($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass);
+        ))->postPersist($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass());
     }
 
     public function testPreRemove()
@@ -159,7 +159,7 @@ class AdminEventExtensionTest extends \PHPUnit_Framework_TestCase
         $this->getExtension(array(
             $this->equalTo('sonata.admin.event.persistence.pre_remove'),
             $this->callback($this->getConfigurePersistenceClosure(PersistenceEvent::TYPE_PRE_REMOVE))
-        ))->preRemove($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass);
+        ))->preRemove($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass());
     }
 
     public function testPostRemove()
@@ -167,7 +167,7 @@ class AdminEventExtensionTest extends \PHPUnit_Framework_TestCase
         $this->getExtension(array(
             $this->equalTo('sonata.admin.event.persistence.post_remove'),
             $this->callback($this->getConfigurePersistenceClosure(PersistenceEvent::TYPE_POST_REMOVE))
-        ))->postRemove($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass);
+        ))->postRemove($this->getMock('Sonata\AdminBundle\Admin\AdminInterface'), new \stdClass());
     }
 
 }

+ 1 - 1
Tests/Event/ConfigureQueryEventTest.php

@@ -60,4 +60,4 @@ class ConfigureQueryEventTest extends \PHPUnit_Framework_TestCase
         $this->assertInstanceOf('Sonata\AdminBundle\Datagrid\ProxyQueryInterface', $result);
         $this->assertEquals($this->proxyQuery, $result);
     }
-}
+}

+ 1 - 1
Tests/Event/PersistenceEventTest.php

@@ -56,4 +56,4 @@ class PersistenceEventTest extends \PHPUnit_Framework_TestCase
     {
         $this->assertEquals($this->object, $this->event->getObject());
     }
-}
+}

+ 0 - 4
Tests/Fixtures/Admin/CommentAdmin.php

@@ -3,10 +3,6 @@
 namespace Sonata\AdminBundle\Tests\Fixtures\Admin;
 
 use Sonata\AdminBundle\Admin\Admin;
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
-use Sonata\AdminBundle\Datagrid\ListMapper;
-use Sonata\AdminBundle\Form\FormMapper;
-use Sonata\AdminBundle\Show\ShowMapper;
 use Sonata\AdminBundle\Route\RouteCollection;
 
 class CommentAdmin extends Admin

+ 0 - 2
Tests/Fixtures/Controller/FooAdminController.php

@@ -2,8 +2,6 @@
 
 namespace Sonata\AdminBundle\Tests\Fixtures\Controller;
 
-use Sonata\AdminBundle\Tests\Fixtures\Controller\AbstractFooAdminController;
-
 /**
  * Some documentation about Foo controller
  */

+ 9 - 4
Tests/Fixtures/Entity/FooArrayAccess.php

@@ -5,12 +5,15 @@ namespace Sonata\AdminBundle\Tests\Fixtures\Entity;
 class FooArrayAccess implements \ArrayAccess
 {
     // methods to enable ArrayAccess
-    public function offsetExists($offset) {
+    public function offsetExists($offset)
+    {
         $value = $this->offsetGet($offset);
+
         return $value !== null;
     }
 
-    public function offsetGet($offset) {
+    public function offsetGet($offset)
+    {
         $offset = str_replace('_', '', $offset); // method names always use camels, field names can use snakes
         $methodName = "get$offset";
         if (method_exists($this, $methodName)) {
@@ -20,11 +23,13 @@ class FooArrayAccess implements \ArrayAccess
         }
     }
 
-    public function offsetSet($offset, $value) {
+    public function offsetSet($offset, $value)
+    {
         throw new \BadMethodCallException ("Array access of class " . get_class($this) . " is read-only!");
     }
 
-    public function offsetUnset($offset) {
+    public function offsetUnset($offset)
+    {
         throw new \BadMethodCallException("Array access of class " . get_class($this) . " is read-only!");
     }
 

+ 1 - 1
Tests/Form/DataTransformer/ModelToIdTransformerTest.php

@@ -81,6 +81,6 @@ class ModelToIdTransformerTest extends \PHPUnit_Framework_TestCase
         $this->assertNull($transformer->transform(0));
         $this->assertNull($transformer->transform('0'));
 
-        $this->assertEquals(123, $transformer->transform(new \stdClass));
+        $this->assertEquals(123, $transformer->transform(new \stdClass()));
     }
 }

+ 6 - 9
Tests/Form/DataTransformer/ModelsToArrayTransformerTest.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Sonata\AdminBundle\Form\DataTransformer;
+namespace Sonata\AdminBundle\Tests\Form\DataTransformer;
 
 use Symfony\Component\Form\Exception\UnexpectedTypeException;
 use Symfony\Component\Form\Exception\TransformationFailedException;
@@ -41,7 +41,7 @@ class ModelsToArrayTransformerTest extends \PHPUnit_Framework_TestCase
 
         $this->modelChoiceList->expects($this->any())
             ->method('getModelManager')
-            ->will($this->returnCallback(function() use ($modelManager) {
+            ->will($this->returnCallback(function () use ($modelManager) {
                 return $modelManager;
             }));
     }
@@ -55,7 +55,7 @@ class ModelsToArrayTransformerTest extends \PHPUnit_Framework_TestCase
 
         $this->modelChoiceList->expects($this->any())
             ->method('getIdentifierValues')
-            ->will($this->returnCallback(function($entity) use ($identifiers) {
+            ->will($this->returnCallback(function ($entity) use ($identifiers) {
                 if ($entity instanceof FooEntity) {
                     return $identifiers;
                 }
@@ -65,13 +65,13 @@ class ModelsToArrayTransformerTest extends \PHPUnit_Framework_TestCase
 
         $this->modelChoiceList->expects($this->any())
             ->method('getIdentifier')
-            ->will($this->returnCallback(function() use ($identifiers) {
+            ->will($this->returnCallback(function () use ($identifiers) {
                 return $identifiers;
             }));
 
        $this->modelChoiceList->expects($this->any())
             ->method('getEntities')
-            ->will($this->returnCallback(function() {
+            ->will($this->returnCallback(function () {
                 return array('bcd'=>new FooEntity(array('bcd')), 'efg'=>new FooEntity(array('efg')), 'abc'=>new FooEntity(array('abc')));
             }));
 
@@ -151,19 +151,16 @@ class ModelsToArrayTransformerTest extends \PHPUnit_Framework_TestCase
 
         $this->modelChoiceList->expects($this->any())
             ->method('getEntity')
-            ->will($this->returnCallback(function($key) use ($entity1, $entity2, $entity3) {
+            ->will($this->returnCallback(function ($key) use ($entity1, $entity2, $entity3) {
                 switch ($key) {
                     case 'foo':
                         return $entity1;
 
-                        break;
                     case 'bar':
                         return $entity2;
 
-                        break;
                     case 'baz':
                         return $entity3;
-                        break;
                 }
 
                 return null;

+ 2 - 4
Tests/Model/AuditManagerTest.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Sonata\AdminBundle\Model;
+namespace Sonata\AdminBundle\Tests\Model;
 
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Sonata\AdminBundle\Model\AuditManager;
@@ -30,15 +30,13 @@ class AuditManagerTest extends \PHPUnit_Framework_TestCase
 
         $container->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($id) use ($fooReader, $barReader) {
+            ->will($this->returnCallback(function ($id) use ($fooReader, $barReader) {
                 switch ($id) {
                     case 'foo_reader':
                         return $fooReader;
-                        break;
 
                     case 'bar_reader':
                         return $barReader;
-                        break;
                 }
 
                 return null;

+ 0 - 1
Tests/Resources/XliffTest.php

@@ -10,7 +10,6 @@
 
 namespace Sonata\AdminBundle\Tests\Resources;
 
-
 use Sonata\CoreBundle\Test\XliffValidatorTestCase;
 
 class XliffTest extends XliffValidatorTestCase

+ 2 - 2
Tests/Route/AdminPoolLoaderTest.php

@@ -8,7 +8,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Sonata\AdminBundle\Route;
+namespace Sonata\AdminBundle\Tests\Route;
 
 use Sonata\AdminBundle\Route\RouteCollection;
 use Sonata\AdminBundle\Route\AdminPoolLoader;
@@ -55,7 +55,7 @@ class AdminPoolLoaderTest extends \PHPUnit_Framework_TestCase
 
         $pool->expects($this->any())
             ->method('getInstance')
-            ->will($this->returnCallback(function($id) use ($admin1, $admin2) {
+            ->will($this->returnCallback(function ($id) use ($admin1, $admin2) {
                 switch ($id) {
                     case 'foo_admin':
                         return $admin1;

+ 1 - 1
Tests/Route/DefaultRouteGeneratorTest.php

@@ -156,7 +156,7 @@ class DefaultRouteGeneratorTest extends \PHPUnit_Framework_TestCase
         $request->attributes->expects($this->any())->method('has')->will($this->returnValue(true));
         $request->attributes->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($key) {
+            ->will($this->returnCallback(function ($key) {
                 if ($key == 'childId') {
                     return '987654';
                 }

+ 3 - 3
Tests/Search/SearchHandlerTest.php

@@ -8,7 +8,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Sonata\AdminBundle\Route;
+namespace Sonata\AdminBundle\Tests\Search;
 
 use Sonata\AdminBundle\Admin\AdminInterface;
 use Sonata\AdminBundle\Admin\Pool;
@@ -28,7 +28,7 @@ class SearchHandlerTest extends \PHPUnit_Framework_TestCase
     public function getPool(AdminInterface $admin = null)
     {
         $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
-        $container->expects($this->any())->method('get')->will($this->returnCallback(function($id) use ($admin) {
+        $container->expects($this->any())->method('get')->will($this->returnCallback(function ($id) use ($admin) {
             if ($id == 'fake') {
                 throw new ServiceNotFoundException('Fake service does not exist');
             }
@@ -74,4 +74,4 @@ class SearchHandlerTest extends \PHPUnit_Framework_TestCase
         $handler = new SearchHandler($this->getPool($admin));
         $this->assertInstanceOf('Sonata\AdminBundle\Datagrid\PagerInterface', $handler->search($admin, 'myservice'));
     }
-}
+}

+ 1 - 1
Tests/Security/Acl/Permission/MaskBuilderTest.php

@@ -17,7 +17,7 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase
 {
     public function testGetPattern()
     {
-        $builder = new MaskBuilder;
+        $builder = new MaskBuilder();
         $this->assertEquals(MaskBuilder::ALL_OFF, $builder->getPattern());
 
         $builder->add('view');

+ 2 - 2
Tests/Security/Handler/RoleSecurityHandlerTest.php

@@ -77,7 +77,7 @@ class RoleSecurityHandlerTest extends \PHPUnit_Framework_TestCase
 
         $this->securityContext->expects($this->any())
             ->method('isGranted')
-            ->will($this->returnCallback(function(array $attributes, $object) {
+            ->will($this->returnCallback(function (array $attributes, $object) {
 
                 if (in_array('ROLE_BATMAN', $attributes)) {
                     return true;
@@ -181,7 +181,7 @@ class RoleSecurityHandlerTest extends \PHPUnit_Framework_TestCase
 
         $this->securityContext->expects($this->any())
             ->method('isGranted')
-            ->will($this->returnCallback(function(array $attributes, $object) {
+            ->will($this->returnCallback(function (array $attributes, $object) {
                 throw new \RuntimeException('Something is wrong');
             }));
 

+ 5 - 5
Tests/Show/ShowMapperTest.php

@@ -77,19 +77,19 @@ class ShowMapperTest extends \PHPUnit_Framework_TestCase
 
         $this->admin->expects($this->any())
             ->method('getShowGroups')
-            ->will($this->returnCallback(function() use (&$groups) {
+            ->will($this->returnCallback(function () use (&$groups) {
                 return $groups;
             }));
 
         $this->admin->expects($this->any())
             ->method('setShowGroups')
-            ->will($this->returnCallback(function($showGroups) use (&$groups) {
+            ->will($this->returnCallback(function ($showGroups) use (&$groups) {
                 $groups = $showGroups;
             }));
 
         $this->admin->expects($this->any())
             ->method('reorderShowGroup')
-            ->will($this->returnCallback(function($group, $keys) use (&$groups) {
+            ->will($this->returnCallback(function ($group, $keys) use (&$groups) {
                 $showGroups = $groups;
                 $showGroups[$group]['fields'] = array_merge(array_flip($keys), $showGroups[$group]['fields']);
                 $groups = $showGroups;
@@ -114,7 +114,7 @@ class ShowMapperTest extends \PHPUnit_Framework_TestCase
             ->method('getModelManager')
             ->will($this->returnValue($modelManager));
 
-        $labelTranslatorStrategy = new NoopLabelTranslatorStrategy;
+        $labelTranslatorStrategy = new NoopLabelTranslatorStrategy();
 
         $this->admin->expects($this->any())
             ->method('getLabelTranslatorStrategy')
@@ -122,7 +122,7 @@ class ShowMapperTest extends \PHPUnit_Framework_TestCase
 
         $this->showBuilder->expects($this->any())
             ->method('addField')
-            ->will($this->returnCallback(function($list, $type, $fieldDescription, $admin) {
+            ->will($this->returnCallback(function ($list, $type, $fieldDescription, $admin) {
                 $list->add($fieldDescription);
             }));
 

+ 1 - 1
Tests/Translator/BCLabelTranslatorStrategyTest.php

@@ -16,7 +16,7 @@ class BCLabelTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
 {
     public function testLabel()
     {
-        $strategy = new BCLabelTranslatorStrategy;
+        $strategy = new BCLabelTranslatorStrategy();
 
         $this->assertEquals('Isvalid', $strategy->getLabel('isValid', 'form', 'label'));
         $this->assertEquals('Plainpassword', $strategy->getLabel('plainPassword', 'form', 'label'));

+ 4 - 4
Tests/Translator/Extractor/JMSTranslatorBundle/AdminExtractorTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Sonata\AdminBundle\Translator\Extractor\JMSTranslatorBundle;
+namespace Sonata\AdminBundle\Tests\Translator\Extractor\JMSTranslatorBundle;
 
 use Symfony\Component\HttpKernel\Log\LoggerInterface;
 use Sonata\AdminBundle\Admin\Pool;
@@ -52,7 +52,7 @@ class AdminExtractorTest extends \PHPUnit_Framework_TestCase
         $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
         $container->expects($this->any())
             ->method('get')
-            ->will($this->returnCallback(function($id) use ($fooAdmin, $barAdmin) {
+            ->will($this->returnCallback(function ($id) use ($fooAdmin, $barAdmin) {
                 switch ($id) {
                     case 'foo_admin':
                         return $fooAdmin;
@@ -88,7 +88,7 @@ class AdminExtractorTest extends \PHPUnit_Framework_TestCase
         $tester = $this;
         $this->fooAdmin->expects($this->any())
             ->method('getShow')
-            ->will($this->returnCallback(function() use ($translator, $tester) {
+            ->will($this->returnCallback(function () use ($translator, $tester) {
                 $tester->assertEquals('foo', $translator->trans('foo', array(), 'foo_admin_domain'));
                 $tester->assertEquals('foo', $translator->transChoice('foo', 1, array(), 'foo_admin_domain'));
 
@@ -113,7 +113,7 @@ class AdminExtractorTest extends \PHPUnit_Framework_TestCase
 
         $this->fooAdmin->expects($this->any())
             ->method('getShow')
-            ->will($this->returnCallback(function() {
+            ->will($this->returnCallback(function () {
                 throw new \RuntimeException('Foo throws exception');
             }));
 

+ 1 - 1
Tests/Translator/FormLabelTranslatorStrategyTest.php

@@ -16,7 +16,7 @@ class FormLabelTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
 {
     public function testLabel()
     {
-        $strategy = new FormLabelTranslatorStrategy;
+        $strategy = new FormLabelTranslatorStrategy();
 
         $this->assertEquals('Isvalid', $strategy->getLabel('isValid', 'form', 'label'));
         $this->assertEquals('Plainpassword', $strategy->getLabel('plainPassword', 'form', 'label'));

+ 2 - 2
Tests/Translator/NativeLabelTranslatorStrategyTest.php

@@ -13,7 +13,7 @@ namespace Sonata\AdminBundle\Tests\Translator;
 
 use Sonata\AdminBundle\Translator\NativeLabelTranslatorStrategy;
 
-class NativeTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
+class NativeLabelTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
 {
 
     /**
@@ -21,7 +21,7 @@ class NativeTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
      */
     public function testLabel($expectedLabel, $label)
     {
-        $strategy = new NativeLabelTranslatorStrategy;
+        $strategy = new NativeLabelTranslatorStrategy();
 
         $this->assertEquals($expectedLabel, $strategy->getLabel($label, 'form', 'label'));
     }

+ 1 - 1
Tests/Translator/NoopLabelTranslatorStrategyTest.php

@@ -16,7 +16,7 @@ class NoopLabelTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
 {
     public function testLabel()
     {
-        $strategy = new NoopLabelTranslatorStrategy;
+        $strategy = new NoopLabelTranslatorStrategy();
 
         $this->assertEquals('isValid', $strategy->getLabel('isValid', 'form', 'label'));
         $this->assertEquals('isValid_SuperCool', $strategy->getLabel('isValid_SuperCool', 'form', 'label'));

+ 1 - 1
Tests/Translator/UnderscoreLabelTranslatorStrategyTest.php

@@ -16,7 +16,7 @@ class UnderscoreLabelTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
 {
     public function testLabel()
     {
-        $strategy = new UnderscoreLabelTranslatorStrategy;
+        $strategy = new UnderscoreLabelTranslatorStrategy();
 
         $this->assertEquals('datagrid.label_is_valid', $strategy->getLabel('isValid', 'datagrid', 'label'));
         $this->assertEquals('breadcrumb.link_is0_valid', $strategy->getLabel('is0Valid', 'breadcrumb', 'link'));

+ 0 - 1
Tests/Validator/ErrorElementTest.php

@@ -9,7 +9,6 @@
  * file that was distributed with this source code.
  */
 
-
 namespace Sonata\AdminBundle\Tests\Validator;
 
 use Sonata\AdminBundle\Validator\ErrorElement;

+ 2 - 2
Translator/Extractor/JMSTranslatorBundle/AdminExtractor.php

@@ -61,7 +61,7 @@ class AdminExtractor implements ExtractorInterface, TranslatorInterface, Securit
             throw new \RuntimeException('Invalid state');
         }
 
-        $this->catalogue = new MessageCatalogue;
+        $this->catalogue = new MessageCatalogue();
 
         foreach ($this->adminPool->getAdminServiceIds() as $id) {
             $admin = $this->getAdmin($id);
@@ -104,7 +104,7 @@ class AdminExtractor implements ExtractorInterface, TranslatorInterface, Securit
                         call_user_func_array(array($admin, $method), $args);
                     } catch (\Exception $e) {
                         if ($this->logger) {
-                            $this->logger->err(sprintf('ERROR : admin:%s - Raise an exception : %s', $admin->getCode(), $e->getMessage()));
+                            $this->logger->error(sprintf('ERROR : admin:%s - Raise an exception : %s', $admin->getCode(), $e->getMessage()));
                         }
 
                         throw $e;

+ 2 - 0
Util/FormBuilderIterator.php

@@ -22,6 +22,8 @@ class FormBuilderIterator extends \RecursiveArrayIterator
 
     protected $prefix;
 
+    protected $iterator;
+
     /**
      * @param \Symfony\Component\Form\FormBuilder $formBuilder
      * @param bool                                $prefix

+ 2 - 0
Util/FormViewIterator.php

@@ -16,6 +16,8 @@ class FormViewIterator implements \RecursiveIterator
 {
     protected $formView;
 
+    protected $iterator;
+
     /**
      * @param \Symfony\Component\Form\FormView $formView
      */

+ 1 - 1
Util/ObjectAclManipulator.php

@@ -23,7 +23,7 @@ abstract class ObjectAclManipulator implements ObjectAclManipulatorInterface
      *
      * @param OutputInterface      $output
      * @param AdminInterface       $admin
-     * @param \Traversable         $oids              a collection of ObjectIdentityInterface implementations
+     * @param \Traversable         $oids             a collection of ObjectIdentityInterface implementations
      * @param UserSecurityIdentity $securityIdentity
      *
      * @throws \Exception

+ 2 - 1
Validator/InlineValidator.php

@@ -13,13 +13,14 @@ namespace Sonata\AdminBundle\Validator;
 use Symfony\Component\Validator\ConstraintValidator;
 use Symfony\Component\Validator\Constraint;
 use Symfony\Component\DependencyInjection\ContainerInterface;
-use Sonata\AdminBundle\Validator\ErrorElement;
 use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
 
 class InlineValidator extends ConstraintValidator
 {
     protected $container;
 
+    protected $constraintValidatorFactory;
+
     /**
      * @param \Symfony\Component\DependencyInjection\ContainerInterface            $container
      * @param \Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory $constraintValidatorFactory