Skip to content

Commit

Permalink
PHP CS fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Jun 18, 2015
1 parent 83d65b1 commit 8335b04
Show file tree
Hide file tree
Showing 141 changed files with 900 additions and 1,034 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Resources/doc/_build/*
nbproject
coverage
composer.lock
vendor
vendor
.php_cs.cache
19 changes: 19 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(array(__DIR__))
;

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers(array(
'-unalign_double_arrow',
'-unalign_equals',
'align_double_arrow',
'newline_after_open_tag',
'ordered_use',
'long_array_syntax',
))
->setUsingCache(true)
->finder($finder)
;
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ env:
matrix:
fast_finish: true
include:
- php: 5.6
env: CS_FIXER=run
- php: 5.3
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 5.6
Expand Down Expand Up @@ -53,7 +55,9 @@ before_script:
- export PATH=$HOME/.local/bin:$PATH
- pip install -r Resources/doc/requirements.txt --user `whoami`

script: make test
script:
- if [ "$CS_FIXER" = "run" ]; then make cs_dry_run ; fi;
- make test

notifications:
webhooks: https://sonata-project.org/bundles/media/master/travis
webhooks: https://sonata-project.org/bundles/media/master/travis
14 changes: 5 additions & 9 deletions Admin/BaseMediaAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
namespace Sonata\MediaBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\ClassificationBundle\Model\CategoryManagerInterface;
use Sonata\CoreBundle\Model\Metadata;
use Sonata\MediaBundle\Provider\Pool;
use Sonata\MediaBundle\Form\DataTransformer\ProviderDataTransformer;

use Knp\Menu\ItemInterface as MenuItemInterface;
use Sonata\MediaBundle\Provider\Pool;

abstract class BaseMediaAdmin extends Admin
{
Expand Down Expand Up @@ -90,7 +86,7 @@ protected function configureFormFields(FormMapper $formMapper)
'context' => $media->getContext(),
'hide_context' => true,
'mode' => 'tree',
)
),
));
}

Expand Down Expand Up @@ -137,10 +133,10 @@ public function getPersistentParameters()
$categoryId = $this->categoryManager->getRootCategory($context)->getId();
}

return array_merge($parameters,array(
return array_merge($parameters, array(
'context' => $context,
'category' => $categoryId,
'hide_context' => (bool)$this->getRequest()->get('hide_context')
'hide_context' => (bool) $this->getRequest()->get('hide_context'),
));
}

Expand Down
8 changes: 4 additions & 4 deletions Admin/GalleryAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
namespace Sonata\MediaBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\MediaBundle\Provider\Pool;

class GalleryAdmin extends Admin
Expand Down Expand Up @@ -64,8 +64,8 @@ protected function configureFormFields(FormMapper $formMapper)
$formMapper
->with('Options')
->add('context', 'sonata_type_translatable_choice', array(
'choices' => $contexts,
'catalogue' => 'SonataMediaBundle'
'choices' => $contexts,
'catalogue' => 'SonataMediaBundle',
))
->add('enabled', null, array('required' => false))
->add('name')
Expand All @@ -79,7 +79,7 @@ protected function configureFormFields(FormMapper $formMapper)
'inline' => 'table',
'sortable' => 'position',
'link_parameters' => array('context' => $context),
'admin_code' => 'sonata.media.admin.gallery_has_media'
'admin_code' => 'sonata.media.admin.gallery_has_media',
)
)
->end()
Expand Down
9 changes: 3 additions & 6 deletions Admin/GalleryHasMediaAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
namespace Sonata\MediaBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;

class GalleryHasMediaAdmin extends Admin
{
/**
* @param \Sonata\AdminBundle\Form\FormMapper $formMapper
*
* @return void
*/
protected function configureFormFields(FormMapper $formMapper)
{
Expand All @@ -40,16 +38,15 @@ protected function configureFormFields(FormMapper $formMapper)

$formMapper
->add('media', 'sonata_type_model_list', array('required' => false), array(
'link_parameters' => $link_parameters
'link_parameters' => $link_parameters,
))
->add('enabled', null, array('required' => false))
->add('position', 'hidden')
;
}

/**
* @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
* @return void
* @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
Expand Down
4 changes: 2 additions & 2 deletions Admin/Manager/DoctrineMongoDBManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Sonata\MediaBundle\Admin\Manager;

use Sonata\DoctrineMongoDBAdminBundle\Model\ModelManager;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\DoctrineMongoDBAdminBundle\Model\ModelManager;

/**
* this method overwrite the default AdminModelManager to call
* the custom methods from the dedicated media manager
* the custom methods from the dedicated media manager.
*/
class DoctrineMongoDBManager extends ModelManager
{
Expand Down
9 changes: 3 additions & 6 deletions Admin/Manager/DoctrineORMManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
namespace Sonata\MediaBundle\Admin\Manager;

use Doctrine\DBAL\DBALException;
use Sonata\DoctrineORMAdminBundle\Model\ModelManager;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Exception\ModelManagerException;

use Sonata\DoctrineORMAdminBundle\Model\ModelManager;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
* this method overwrite the default AdminModelManager to call
* the custom methods from the dedicated media manager
* the custom methods from the dedicated media manager.
*/
class DoctrineORMManager extends ModelManager
{
Expand Down Expand Up @@ -71,12 +70,10 @@ public function delete($object)
}

/**
* Deletes a set of $class identified by the provided $idx array
* Deletes a set of $class identified by the provided $idx array.
*
* @param string $class
* @param \Sonata\AdminBundle\Datagrid\ProxyQueryInterface $queryProxy
*
* @return void
*/
public function batchDelete($class, ProxyQueryInterface $queryProxy)
{
Expand Down
5 changes: 2 additions & 3 deletions Admin/ODM/MediaAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@

namespace Sonata\MediaBundle\Admin\ODM;

use Sonata\MediaBundle\Admin\BaseMediaAdmin as Admin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\MediaBundle\Admin\BaseMediaAdmin as Admin;

class MediaAdmin extends Admin
{
/**
* @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
* @return void
* @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
Expand Down
15 changes: 7 additions & 8 deletions Admin/ORM/MediaAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@

namespace Sonata\MediaBundle\Admin\ORM;

use Sonata\MediaBundle\Admin\BaseMediaAdmin as Admin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\MediaBundle\Admin\BaseMediaAdmin as Admin;

class MediaAdmin extends Admin
{
/**
* @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
* @return void
* @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$options = array(
'choices' => array()
'choices' => array(),
);

foreach ($this->pool->getContexts() as $name => $context) {
Expand All @@ -35,7 +34,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
->add('providerReference')
->add('enabled')
->add('context', null, array(
'show_filter' => $this->getPersistentParameter('hide_context') !== true
'show_filter' => $this->getPersistentParameter('hide_context') !== true,
), 'choice', $options)
->add('category', null, array(
'show_filter' => false,
Expand All @@ -53,13 +52,13 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
}

$datagridMapper->add('providerName', 'doctrine_orm_choice', array(
'field_options'=> array(
'choices' => $providers,
'field_options' => array(
'choices' => $providers,
'required' => false,
'multiple' => false,
'expanded' => false,
),
'field_type'=> 'choice',
'field_type' => 'choice',
));
}
}
9 changes: 4 additions & 5 deletions Admin/PHPCR/GalleryAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Sonata\MediaBundle\Admin\PHPCR;

use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\MediaBundle\Admin\GalleryAdmin as BaseGalleryAdmin;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\MediaBundle\Admin\GalleryAdmin as BaseGalleryAdmin;

class GalleryAdmin extends BaseGalleryAdmin
{
Expand Down Expand Up @@ -48,7 +48,6 @@ public function id($object)
return $this->getUrlsafeIdentifier($object);
}


/**
* {@inheritdoc}
*/
Expand All @@ -68,9 +67,9 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
protected function configureRoutes(RouteCollection $collection)
{
// Allow path in id parameter
$collection->add('view', $this->getRouterIdParameter() . '/view', array(), array('id' => '.+', '_method' => 'GET'));
$collection->add('show', $this->getRouterIdParameter() . '/show', array(
'_controller' => sprintf('%s:%s', $this->baseControllerName, 'view')
$collection->add('view', $this->getRouterIdParameter().'/view', array(), array('id' => '.+', '_method' => 'GET'));
$collection->add('show', $this->getRouterIdParameter().'/show', array(
'_controller' => sprintf('%s:%s', $this->baseControllerName, 'view'),
),
array('id' => '.+', '_method' => 'GET')
);
Expand Down
11 changes: 5 additions & 6 deletions Admin/PHPCR/MediaAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Sonata\MediaBundle\Admin\PHPCR;

use Sonata\MediaBundle\Admin\BaseMediaAdmin as Admin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\MediaBundle\Admin\BaseMediaAdmin as Admin;

class MediaAdmin extends Admin
{
Expand Down Expand Up @@ -49,8 +49,7 @@ public function id($object)
}

/**
* @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
* @return void
* @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
Expand All @@ -69,9 +68,9 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
protected function configureRoutes(RouteCollection $collection)
{
// Allow path in id parameter
$collection->add('view', $this->getRouterIdParameter() . '/view', array(), array('id' => '.+', '_method' => 'GET'));
$collection->add('show', $this->getRouterIdParameter() . '/show', array(
'_controller' => sprintf('%s:%s', $this->baseControllerName, 'view')
$collection->add('view', $this->getRouterIdParameter().'/view', array(), array('id' => '.+', '_method' => 'GET'));
$collection->add('show', $this->getRouterIdParameter().'/show', array(
'_controller' => sprintf('%s:%s', $this->baseControllerName, 'view'),
),
array('id' => '.+', '_method' => 'GET')
);
Expand Down
4 changes: 2 additions & 2 deletions Block/Breadcrumb/BaseGalleryBreadcrumbBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Sonata\SeoBundle\Block\Breadcrumb\BaseBreadcrumbMenuBlockService;

/**
* Abstract class for media breadcrumbs
* Abstract class for media breadcrumbs.
*
* @author Sylvain Deloux <[email protected]>
*/
Expand All @@ -30,7 +30,7 @@ protected function getRootMenu(BlockContextInterface $blockContext)

$menu->addChild('sonata_media_gallery_index', array(
'route' => 'sonata_media_gallery_index',
'extras' => array('translation_domain' => 'SonataMediaBundle')
'extras' => array('translation_domain' => 'SonataMediaBundle'),
));

return $menu;
Expand Down
Loading

0 comments on commit 8335b04

Please sign in to comment.