Kaynağa Gözat

some phpdoc fixes and improve code view

Konstantin Kuklin 12 yıl önce
ebeveyn
işleme
73d507571c

+ 7 - 5
Admin/Admin.php

@@ -13,6 +13,7 @@ namespace Sonata\AdminBundle\Admin;
 
 use Symfony\Component\Form\Form;
 use Symfony\Component\Form\FormBuilder;
+use Symfony\Component\Form\Util\PropertyPath;
 use Symfony\Component\Validator\ValidatorInterface;
 use Symfony\Component\Routing\RouterInterface;
 use Symfony\Component\Translation\TranslatorInterface;
@@ -26,6 +27,7 @@ use Sonata\AdminBundle\Show\ShowMapper;
 
 use Sonata\AdminBundle\Admin\Pool;
 use Sonata\AdminBundle\Validator\ErrorElement;
+use Sonata\AdminBundle\Validator\Constraints\InlineConstraint;
 
 use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
 use Sonata\AdminBundle\Builder\FormContractorInterface;
@@ -776,7 +778,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
         if ($this->isChild() && $this->getParentAssociationMapping()) {
             $parent = $this->getParent()->getObject($this->request->get($this->getParent()->getIdParameter()));
 
-            $propertyPath = new \Symfony\Component\Form\Util\PropertyPath($this->getParentAssociationMapping());
+            $propertyPath = new PropertyPath($this->getParentAssociationMapping());
 
             $object = $this->getSubject();
 
@@ -1142,7 +1144,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
 
         // add the custom inline validation option
         $metadata = $this->validator->getMetadataFactory()->getClassMetadata($this->getClass());
-        $metadata->addConstraint(new \Sonata\AdminBundle\Validator\Constraints\InlineConstraint(array(
+        $metadata->addConstraint(new InlineConstraint(array(
             'service' => $this,
             'method'  => function(ErrorElement $errorElement, $object) use ($admin) {
                 /* @var \Sonata\AdminBundle\Admin\AdminInterface $admin */
@@ -1275,7 +1277,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
      * @param string                                   $action
      * @param \Sonata\AdminBundle\Admin\AdminInterface $childAdmin
      *
-     * @return MenuItem|false
+     * @return MenuItem|boolean
      */
     public function buildSideMenu($action, AdminInterface $childAdmin = null)
     {
@@ -1302,7 +1304,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
      * @param string                                   $action
      * @param \Sonata\AdminBundle\Admin\AdminInterface $childAdmin
      *
-     * @return \Knp\MenuBundle\Menu
+     * @return \Knp\Menu\MenuItem
      */
     public function getSideMenu($action, AdminInterface $childAdmin = null)
     {
@@ -2004,7 +2006,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
      * translate a message id
      *
      * @param string  $id
-     * @param integet $count
+     * @param integer $count
      * @param array   $parameters
      * @param null    $domain
      * @param null    $locale

+ 1 - 1
Admin/AdminHelper.php

@@ -154,7 +154,7 @@ class AdminHelper
      * @param object                                              $object
      * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
      *
-     * @return void
+     * @throws \RuntimeException
      */
     public function addNewInstance($object, FieldDescriptionInterface $fieldDescription)
     {

+ 1 - 0
Command/GenerateObjectAclCommand.php

@@ -48,6 +48,7 @@ class GenerateObjectAclCommand extends ContainerAwareCommand
      */
     public function execute(InputInterface $input, OutputInterface $output)
     {
+        /** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
         $dialog = $this->getHelperSet()->get('dialog');
 
         $output->writeln('Welcome to the AdminBundle object ACL generator');

+ 19 - 1
Controller/CRUDController.php

@@ -142,6 +142,8 @@ class CRUDController extends Controller
     /**
      * return the Response object associated to the list action
      *
+     * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
+     *
      * @return Response
      */
     public function listAction()
@@ -229,10 +231,12 @@ class CRUDController extends Controller
     /**
      * return the Response object associated to the edit action
      *
-     * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
      *
      * @param mixed $id
      *
+     * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
+     * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
+     *
      * @return Response
      */
     public function editAction($id = null)
@@ -254,6 +258,7 @@ class CRUDController extends Controller
 
         $this->admin->setSubject($object);
 
+        /** @var $form \Symfony\Component\Form\Form */
         $form = $this->admin->getForm();
         $form->setData($object);
 
@@ -421,6 +426,7 @@ class CRUDController extends Controller
     /**
      * return the Response object associated to the create action
      *
+     * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
      * @return Response
      */
     public function createAction()
@@ -436,6 +442,7 @@ class CRUDController extends Controller
 
         $this->admin->setSubject($object);
 
+        /** @var $form \Symfony\Component\Form\Form */
         $form = $this->admin->getForm();
         $form->setData($object);
 
@@ -530,6 +537,11 @@ class CRUDController extends Controller
     /**
      * return the Response object associated to the view action
      *
+     * @param null $id
+     *
+     * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
+     * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
+     *
      * @return Response
      */
     public function showAction($id = null)
@@ -597,6 +609,9 @@ class CRUDController extends Controller
      * @param null    $id
      * @param string  $revision
      *
+     * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
+     * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
+     *
      * @return Response
      */
     public function historyViewRevisionAction($id = null, $revision = null)
@@ -640,6 +655,9 @@ class CRUDController extends Controller
     /**
      * @param Request $request
      *
+     * @throws \RuntimeException
+     * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
+     *
      * @return Response
      */
     public function exportAction(Request $request)

+ 1 - 1
Controller/CoreController.php

@@ -31,7 +31,7 @@ class CoreController extends Controller
     }
 
     /**
-     * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
+     * @return Response
      */
     public function dashboardAction()
     {

+ 1 - 0
Controller/HelperController.php

@@ -82,6 +82,7 @@ class HelperController
 
         list($fieldDescription, $form) = $this->helper->appendFormFieldElement($admin, $subject, $elementId);
 
+        /** @var $form \Symfony\Component\Form\Form */
         $view = $this->helper->getChildFormView($form->createView(), $elementId);
 
         // render the widget

+ 1 - 2
Datagrid/DatagridMapper.php

@@ -15,7 +15,6 @@ use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
 use Sonata\AdminBundle\Model\ModelManagerInterface;
 use Sonata\AdminBundle\Datagrid\DatagridInterface;
 use Sonata\AdminBundle\Builder\DatagridBuilderInterface;
-use Sonata\AdminBundle\Filter\FilterProxy;
 
 /**
  * This class is use to simulate the Form API
@@ -86,7 +85,7 @@ class DatagridMapper
     /**
      * @param string $name
      *
-     * @return FilterInterface
+     * @return \Sonata\AdminBundle\Filter\FilterInterface
      */
     public function get($name)
     {

+ 1 - 1
Datagrid/Pager.php

@@ -621,7 +621,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter
     }
 
     /**
-     * @return null
+     * @return ProxyQueryInterface
      */
     public function getQuery()
     {

+ 9 - 4
Export/Exporter.php

@@ -14,6 +14,11 @@ namespace Sonata\AdminBundle\Export;
 use Exporter\Source\SourceIteratorInterface;
 use Symfony\Component\HttpFoundation\StreamedResponse;
 
+use Exporter\Writer\XlsWriter;
+use Exporter\Writer\XmlWriter;
+use Exporter\Writer\JsonWriter;
+use Exporter\Writer\CsvWriter;
+
 class Exporter
 {
     /**
@@ -29,19 +34,19 @@ class Exporter
     {
         switch ($format) {
             case 'xls':
-                $writer      = new \Exporter\Writer\XlsWriter('php://output');
+                $writer      = new XlsWriter('php://output');
                 $contentType = 'application/vnd.ms-excel';
                 break;
             case 'xml':
-                $writer      = new \Exporter\Writer\XmlWriter('php://output');
+                $writer      = new XmlWriter('php://output');
                 $contentType = 'text/xml';
                 break;
             case 'json':
-                $writer      = new \Exporter\Writer\JsonWriter('php://output');
+                $writer      = new JsonWriter('php://output');
                 $contentType = 'application/json';
                 break;
             case 'csv':
-                $writer      = new \Exporter\Writer\CsvWriter('php://output', ',', '"', "", true);
+                $writer      = new CsvWriter('php://output', ',', '"', "", true);
                 $contentType = 'text/csv';
                 break;
             default:

+ 3 - 0
Form/ChoiceList/ModelChoiceList.php

@@ -112,6 +112,8 @@ class ModelChoiceList extends SimpleChoiceList
      * is used as option values. Otherwise this method tries to convert
      * objects to strings using __toString().
      *
+     * @param $choices
+     *
      * @return array  An array of choices
      */
     protected function load($choices)
@@ -232,6 +234,7 @@ class ModelChoiceList extends SimpleChoiceList
      * @param  object $entity  The entity for which to get the identifier
      * @throws FormException   If the entity does not exist in Doctrine's
      *                         identity map
+     * @return array
      */
     public function getIdentifierValues($entity)
     {

+ 1 - 1
Guesser/TypeGuesserChain.php

@@ -63,7 +63,7 @@ class TypeGuesserChain implements TypeGuesserInterface
      * @param  \Closure $closure  The closure to execute. Accepts a guesser
      *                            as argument and should return a Guess instance
      *
-     * @return FieldFactoryGuess  The guess with the highest confidence
+     * @return Guess  The guess with the highest confidence
      */
     private function guess(\Closure $closure)
     {

+ 0 - 4
Model/ModelManagerInterface.php

@@ -231,8 +231,6 @@ interface ModelManagerInterface
     /**
      * @param string $class
      * @param array  $array
-     *
-     * @return void
      */
     function modelReverseTransform($class, array $array = array());
 
@@ -246,8 +244,6 @@ interface ModelManagerInterface
 
     /**
      * @param mixed $query
-     *
-     * @return void
      */
     function executeQuery($query);
 

+ 1 - 1
Route/AdminPoolLoader.php

@@ -23,7 +23,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 class AdminPoolLoader extends FileLoader
 {
     /**
-     * @var Bundle\Sonata\AdminBundle\Admin\Pool
+     * @var \Sonata\AdminBundle\Admin\Pool
      */
     protected $pool;
 

+ 7 - 4
Route/DefaultRouteGenerator.php

@@ -38,11 +38,14 @@ class DefaultRouteGenerator implements RouteGeneratorInterface
     }
 
     /**
+     *
+     * @param \Sonata\AdminBundle\Admin\AdminInterface  $admin
+     * @param string                                    $name
+     * @param array                                     $parameters
+     * @param bool                                      $absolute
+
      * @throws \RuntimeException
-     * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
-     * @param $name
-     * @param array $parameter
-     * @param bool $absolute
+
      * @return string
      */
     public function generateUrl(AdminInterface $admin, $name, array $parameters = array(), $absolute = false)

+ 2 - 0
Route/RouteCollection.php

@@ -111,6 +111,8 @@ class RouteCollection
     /**
      * @param string $name
      *
+     * @throws \InvalidArgumentException
+     *
      * @return Route
      */
     public function get($name)

+ 0 - 1
Security/Handler/AclSecurityHandler.php

@@ -11,7 +11,6 @@
 
 namespace Sonata\AdminBundle\Security\Handler;
 
-
 use Symfony\Component\Security\Core\SecurityContextInterface;
 use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
 use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;

+ 1 - 1
Security/Handler/AclSecurityHandlerInterface.php

@@ -59,7 +59,7 @@ interface AclSecurityHandlerInterface extends SecurityHandlerInterface
      *
      * @param ObjectIdentityInterface $objectIdentity
      *
-     * @return mixed \Symfony\Component\Security\Acl\Model\AclInterface or NULL if not found
+     * @return null|\Symfony\Component\Security\Acl\Model\AclInterface or NULL if not found
      */
     function getObjectAcl(ObjectIdentityInterface $objectIdentity);
 

+ 0 - 2
Security/Handler/SecurityHandlerInterface.php

@@ -35,8 +35,6 @@ interface SecurityHandlerInterface
 
     /**
      * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
-     *
-     * @return void
      */
     function buildSecurityInformation(AdminInterface $admin);
 

+ 2 - 0
Twig/Extension/SonataAdminExtension.php

@@ -133,6 +133,8 @@ class SonataAdminExtension extends \Twig_Extension
      * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
      * @param array                                               $params
      *
+     * @throws \RuntimeException
+     *
      * @return mixed
      */
     public function getValueFromFieldDescription($object, FieldDescriptionInterface $fieldDescription, array $params = array())

+ 1 - 1
Util/ObjectAclManipulatorInterface.php

@@ -26,7 +26,7 @@ interface ObjectAclManipulatorInterface
      * @param AdminInterface       $admin
      * @param UserSecurityIdentity $securityIdentity
      *
-     * @throws ModelManagerException
+     * @throws \Sonata\AdminBundle\Exception\ModelManagerException
      * @return void
      */
     function batchConfigureAcls(OutputInterface $output, AdminInterface $admin, UserSecurityIdentity $securityIdentity = null);

+ 1 - 1
Validator/ErrorElement.php

@@ -176,7 +176,7 @@ class ErrorElement
     }
 
     /**
-     * @return null
+     * @return null|PropertyPath
      */
     protected function getCurrentPropertyPath()
     {