Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
add a lot more CS fixes and phpdoc cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Sep 23, 2013
1 parent d4b4cb3 commit 8eec865
Show file tree
Hide file tree
Showing 32 changed files with 168 additions and 267 deletions.
6 changes: 3 additions & 3 deletions Admin/Admin.php
Expand Up @@ -26,8 +26,8 @@
class Admin extends BaseAdmin
{
/**
* Path to the root node in the repository
* under which documents of this admin should be created.
* Path to the root node in the repository under which documents of this
* admin should be created.
*
* @var string
*/
Expand Down Expand Up @@ -72,7 +72,7 @@ public function createQuery($context = 'list')
* @param string $name
* @param mixed $object
* @param array $parameters
* @param bool $absolute
* @param boolean $absolute
*
* @return string
*/
Expand Down
43 changes: 17 additions & 26 deletions Admin/FieldDescription.php
Expand Up @@ -13,6 +13,9 @@

use Sonata\AdminBundle\Admin\BaseFieldDescription;

/**
* {@inheritDoc}
*/
class FieldDescription extends BaseFieldDescription
{
public function __construct()
Expand All @@ -21,16 +24,15 @@ public function __construct()
}

/**
* Define the association mapping definition
*
* @param array $associationMapping
* {@inheritDoc}
*
* @throws \RuntimeException
* @throws \InvalidArgumentException if the mapping is no array or of an
* unknown type.
*/
public function setAssociationMapping($associationMapping)
{
if (!is_array($associationMapping)) {
throw new \RuntimeException('The association mapping must be an array');
throw new \InvalidArgumentException('The association mapping must be an array');
}

$this->associationMapping = $associationMapping;
Expand All @@ -39,15 +41,13 @@ public function setAssociationMapping($associationMapping)
$this->type = $this->type ?: $associationMapping['type'];
$this->mappingType = $this->mappingType ?: $associationMapping['type'];
} else {
throw new \RuntimeException('Unknown association mapping type');
throw new \InvalidArgumentException('Unknown association mapping type');
}
$this->fieldName = $associationMapping['fieldName'];
}

/**
* return the related Target Entity
*
* @return string|null
* {@inheritDoc}
*/
public function getTargetEntity()
{
Expand All @@ -62,16 +62,14 @@ public function getTargetEntity()
}

/**
* set the field mapping information
*
* @param array $fieldMapping
* {@inheritDoc}
*
* @throws \RuntimeException
* @throws \InvalidArgumentException if the mapping information is not an array.
*/
public function setFieldMapping($fieldMapping)
{
if (!is_array($fieldMapping)) {
throw new \RuntimeException('The field mapping must be an array');
throw new \InvalidArgumentException('The field mapping must be an array');
}

$this->fieldMapping = $fieldMapping;
Expand All @@ -82,21 +80,15 @@ public function setFieldMapping($fieldMapping)
}

/**
* return true if the FieldDescription is linked to an identifier field
*
* @return bool
* {@inheritDoc}
*/
public function isIdentifier()
{
return isset($this->fieldMapping['id']) ? $this->fieldMapping['id'] : false;
}

/**
* return the value linked to the description
*
* @param object $object
*
* @return mixed
* {@inheritDoc}
*/
public function getValue($object)
{
Expand All @@ -108,11 +100,10 @@ public function getValue($object)
}

/**
* set the parent association mappings information
*
* @param array $parentAssociationMappings
* {@inheritDoc}
*
* @throws \RuntimeException
* @throws \InvalidArgumentException if the list of mappings does contain
* something else than arrays.
*/
public function setParentAssociationMappings(array $parentAssociationMappings)
{
Expand Down
17 changes: 8 additions & 9 deletions Block/TreeBlockService.php
Expand Up @@ -39,27 +39,25 @@ public function __construct($name, EngineInterface $templating, array $defaults
}

/**
* @param FormMapper $form
* @param BlockInterface $block
* {@inheritDoc}
*
* NOOP as there is nothing to edit.
*/
public function buildEditForm(FormMapper $form, BlockInterface $block)
{
// there is nothing to edit here!
}

/**
* @param BlockContextInterface $blockContext
* @param Response $response
*
* @return Response
* {@inheritDoc}
*/
public function execute(BlockContextInterface $blockContext, Response $response = null)
{
return $this->templating->renderResponse($blockContext->getTemplate(), $blockContext->getSettings(), $response);
}

/**
* @param OptionsResolverInterface $resolver
* {@inheritDoc}
*/
public function setDefaultSettings(OptionsResolverInterface $resolver)
{
Expand All @@ -72,8 +70,9 @@ public function setDefaultSettings(OptionsResolverInterface $resolver)
}

/**
* @param ErrorElement $errorElement
* @param BlockInterface $block
* {@inheritDoc}
*
* NOOP as we do not edit and hence have nothing to validate.
*/
public function validateBlock(ErrorElement $errorElement, BlockInterface $block)
{
Expand Down
13 changes: 3 additions & 10 deletions Builder/DatagridBuilder.php
Expand Up @@ -80,8 +80,7 @@ public function getPager()
}

/**
* @param AdminInterface $admin
* @param FieldDescriptionInterface $fieldDescription
* {@inheritDoc}
*/
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription)
{
Expand All @@ -107,10 +106,7 @@ public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInter
}

/**
* @param DatagridInterface $datagrid
* @param null $type
* @param FieldDescriptionInterface $fieldDescription
* @param AdminInterface $admin
* {@inheritDoc}
*
* @return FilterInterface
*/
Expand Down Expand Up @@ -147,10 +143,7 @@ public function addFilter(DatagridInterface $datagrid, $type = null, FieldDescri
}

/**
* @param AdminInterface $admin
* @param array $values
*
* @return DatagridInterface
* {@inheritDoc}
*/
public function getBaseDatagrid(AdminInterface $admin, array $values = array())
{
Expand Down
17 changes: 6 additions & 11 deletions Builder/FormContractor.php
Expand Up @@ -38,10 +38,9 @@ public function __construct(FormFactoryInterface $formFactory)
/**
* The method defines the correct default settings for the provided FieldDescription
*
* @param AdminInterface $admin
* @param FieldDescriptionInterface $fieldDescription
* {@inheritDoc}
*
* @throws \RuntimeException
* @throws \RuntimeException if the $fieldDescription does not specify a type.
*/
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription)
{
Expand Down Expand Up @@ -90,22 +89,18 @@ public function getFormFactory()
}

/**
* @param string $name
* @param array $options
*
* @return FormBuilder
* {@inheritDoc}
*/
public function getFormBuilder($name, array $options = array())
{
return $this->getFormFactory()->createNamedBuilder($name, 'form', null, $options);
}

/**
* @param $type
* @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
* {@inheritDoc}
*
* @return array
* @throws \LogicException
* @throws \LogicException if a sonata_type_model field does not have a
* target model configured.
*/
public function getDefaultOptions($type, FieldDescriptionInterface $fieldDescription)
{
Expand Down
18 changes: 5 additions & 13 deletions Builder/ListBuilder.php
Expand Up @@ -42,19 +42,15 @@ public function __construct(TypeGuesserInterface $guesser, array $templates = ar
}

/**
* @param array $options
*
* @return FieldDescriptionCollection
* {@inheritDoc}
*/
public function getBaseList(array $options = array())
{
return new FieldDescriptionCollection();
}

/**
* @param null $type
* @param FieldDescriptionInterface $fieldDescription
* @param AdminInterface $admin
* {@inheritDoc}
*/
public function buildField($type = null, FieldDescriptionInterface $fieldDescription, AdminInterface $admin)
{
Expand All @@ -69,10 +65,7 @@ public function buildField($type = null, FieldDescriptionInterface $fieldDescrip
}

/**
* @param FieldDescriptionCollection $list
* @param null $type
* @param FieldDescriptionInterface $fieldDescription
* @param AdminInterface $admin
* {@inheritDoc}
*/
public function addField(FieldDescriptionCollection $list, $type = null, FieldDescriptionInterface $fieldDescription, AdminInterface $admin)
{
Expand All @@ -97,10 +90,9 @@ private function getTemplate($type)
}

/**
* @param AdminInterface $admin
* @param FieldDescriptionInterface $fieldDescription
* {@inheritDoc}
*
* @throws \RuntimeException
* @throws \RuntimeException if the $fielDescription does not have a type.
*/
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription)
{
Expand Down
14 changes: 4 additions & 10 deletions Builder/ShowBuilder.php
Expand Up @@ -35,20 +35,15 @@ public function __construct(TypeGuesserInterface $guesser)
}

/**
* @param array $options
*
* @return FieldDescriptionCollection
* {@inheritDoc}
*/
public function getBaseList(array $options = array())
{
return new FieldDescriptionCollection();
}

/**
* @param FieldDescriptionCollection $list
* @param null $type
* @param FieldDescriptionInterface $fieldDescription
* @param AdminInterface $admin
* {@inheritDoc}
*/
public function addField(FieldDescriptionCollection $list, $type = null, FieldDescriptionInterface $fieldDescription, AdminInterface $admin)
{
Expand All @@ -74,10 +69,9 @@ public function addField(FieldDescriptionCollection $list, $type = null, FieldDe
/**
* The method defines the correct default settings for the provided FieldDescription
*
* @param AdminInterface $admin
* @param FieldDescriptionInterface $fieldDescription
* {@inheritDoc}
*
* @throws \RuntimeException
* @throws \RuntimeException if the $fieldDescription does not have a type.
*/
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription)
{
Expand Down
4 changes: 2 additions & 2 deletions Controller/TreeController.php
Expand Up @@ -37,15 +37,15 @@ class TreeController extends Controller
private $defaults;

/**
* @var bool
* @var boolean
*/
private $confirmMove = false;

/**
* @param TreeInterface $tree
* @param string $template
* @param array $defaults
* @param bool $confirmMove
* @param boolean $confirmMove
*/
public function __construct(TreeInterface $tree, $template = null, array $defaults = array(), $confirmMove = false)
{
Expand Down

0 comments on commit 8eec865

Please sign in to comment.