RUN PHP-CS PSR-2

This commit is contained in:
Adel 2012-07-19 01:44:18 +03:00 committed by Adel ELHAIBA
parent 102c7acd60
commit 4219e706d4
28 changed files with 216 additions and 205 deletions

View file

@ -278,7 +278,7 @@ abstract class AbstractCommand extends ContainerAwareCommand
$logicalName = $this->transformToLogicalName($schema, $bundle); $logicalName = $this->transformToLogicalName($schema, $bundle);
$finalSchema = new \SplFileInfo($this->getFileLocator()->locate($logicalName)); $finalSchema = new \SplFileInfo($this->getFileLocator()->locate($logicalName));
$finalSchemas[(string)$finalSchema] = array($bundle, $finalSchema); $finalSchemas[(string) $finalSchema] = array($bundle, $finalSchema);
} }
} }
} }

View file

@ -1,6 +1,5 @@
<?php <?php
/** /**
* This file is part of the PropelBundle package. * This file is part of the PropelBundle package.
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE

View file

@ -15,7 +15,7 @@ namespace Propel\PropelBundle\Command;
*/ */
class Phing extends \Phing class Phing extends \Phing
{ {
static public function getPhingVersion() public static function getPhingVersion()
{ {
return 'Phing/Symfony'; return 'Phing/Symfony';
} }

View file

@ -23,5 +23,5 @@ interface DataDumperInterface
* @param string $filename The file name to write data. * @param string $filename The file name to write data.
* @param string $connectionName The Propel connection name. * @param string $connectionName The Propel connection name.
*/ */
function dump($filename, $connectionName = null); public function dump($filename, $connectionName = null);
} }

View file

@ -10,7 +10,6 @@
namespace Propel\PropelBundle\DataFixtures\Loader; namespace Propel\PropelBundle\DataFixtures\Loader;
use \BasePeer; use \BasePeer;
use \BaseObject; use \BaseObject;
use \Propel; use \Propel;

View file

@ -23,5 +23,5 @@ interface DataLoaderInterface
* @param array $files A set of files containing datas to load. * @param array $files A set of files containing datas to load.
* @param string $connectionName The Propel connection name * @param string $connectionName The Propel connection name
*/ */
function load($files = array(), $connectionName); public function load($files = array(), $connectionName);
} }

View file

@ -39,7 +39,7 @@ class XmlDataLoader extends AbstractDataLoader
// First make a valid key which is the Ns (Namespace) attribute // First make a valid key which is the Ns (Namespace) attribute
// + the element name (the class name) // + the element name (the class name)
foreach ($value->attributes() as $subkey => $subvalue) { foreach ($value->attributes() as $subkey => $subvalue) {
if ('Namespace' === (string)$subkey) { if ('Namespace' === (string) $subkey) {
$key = $subvalue . '\\' . $key; $key = $subvalue . '\\' . $key;
break; break;
} }

View file

@ -26,7 +26,7 @@ class AclClass extends BaseAclClass
* *
* @return \Propel\PropelBundle\Model\Acl\AclClass * @return \Propel\PropelBundle\Model\Acl\AclClass
*/ */
static public function fromAclObjectIdentity(ObjectIdentityInterface $objectIdentity, \PropelPDO $con = null) public static function fromAclObjectIdentity(ObjectIdentityInterface $objectIdentity, \PropelPDO $con = null)
{ {
$obj = AclClassQuery::create() $obj = AclClassQuery::create()
->filterByType($objectIdentity->getType()) ->filterByType($objectIdentity->getType())

View file

@ -31,7 +31,7 @@ class Entry extends BaseEntry
* *
* @return \Propel\PropelBundle\Model\Acl\Entry * @return \Propel\PropelBundle\Model\Acl\Entry
*/ */
static public function fromAclEntry(EntryInterface $aclEntry) public static function fromAclEntry(EntryInterface $aclEntry)
{ {
$entry = new self(); $entry = new self();
@ -69,7 +69,7 @@ class Entry extends BaseEntry
* *
* @return \Symfony\Component\Security\Acl\Model\EntryInterface * @return \Symfony\Component\Security\Acl\Model\EntryInterface
*/ */
static public function toAclEntry(Entry $modelEntry, AclInterface $acl) public static function toAclEntry(Entry $modelEntry, AclInterface $acl)
{ {
if (null === $modelEntry->getFieldName()) { if (null === $modelEntry->getFieldName()) {
return new AclEntry($modelEntry, $acl); return new AclEntry($modelEntry, $acl);

View file

@ -25,7 +25,7 @@ class SecurityIdentity extends BaseSecurityIdentity
* *
* @return \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface * @return \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface
*/ */
static public function toAclIdentity(SecurityIdentity $securityIdentity) public static function toAclIdentity(SecurityIdentity $securityIdentity)
{ {
$identifier = $securityIdentity->getIdentifier(); $identifier = $securityIdentity->getIdentifier();
@ -58,7 +58,7 @@ class SecurityIdentity extends BaseSecurityIdentity
* *
* @return \Propel\PropelBundle\Model\Acl\SecurityIdentity * @return \Propel\PropelBundle\Model\Acl\SecurityIdentity
*/ */
static public function fromAclIdentity(SecurityIdentityInterface $aclIdentity, \PropelPDO $con = null) public static function fromAclIdentity(SecurityIdentityInterface $aclIdentity, \PropelPDO $con = null)
{ {
if ($aclIdentity instanceof UserSecurityIdentity) { if ($aclIdentity instanceof UserSecurityIdentity) {
$identifier = $aclIdentity->getClass().'-'.$aclIdentity->getUsername(); $identifier = $aclIdentity->getClass().'-'.$aclIdentity->getUsername();

View file

@ -8,7 +8,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInte
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
* PropelParamConverter * PropelParamConverter
* *
@ -47,8 +46,21 @@ class PropelParamConverter implements ParamConverterInterface
*/ */
protected $withs; protected $withs;
/**
* @var bool
*/
protected $hasWith = false; protected $hasWith = false;
/**
* @param Request $request
* @param ConfigurationInterface $configuration
*
* @return bool
*
* @throws \LogicException
* @throws NotFoundHttpException
* @throws \Exception
*/
public function apply(Request $request, ConfigurationInterface $configuration) public function apply(Request $request, ConfigurationInterface $configuration)
{ {
$classQuery = $configuration->getClass() . 'Query'; $classQuery = $configuration->getClass() . 'Query';
@ -107,6 +119,11 @@ class PropelParamConverter implements ParamConverterInterface
return true; return true;
} }
/**
* @param ConfigurationInterface $configuration
*
* @return bool
*/
public function supports(ConfigurationInterface $configuration) public function supports(ConfigurationInterface $configuration)
{ {
if (null === ($classname = $configuration->getClass())) { if (null === ($classname = $configuration->getClass())) {
@ -129,6 +146,8 @@ class PropelParamConverter implements ParamConverterInterface
* *
* @param string $classQuery the query class * @param string $classQuery the query class
* @param Request $request * @param Request $request
*
* @return mixed
*/ */
protected function findPk($classQuery, Request $request) protected function findPk($classQuery, Request $request)
{ {
@ -146,9 +165,10 @@ class PropelParamConverter implements ParamConverterInterface
/** /**
* Try to find the object with all params from the $request * Try to find the object with all params from the $request
* *
* @param string $classQuery * @param string $classQuery the query class
* @param Request $request the query class * @param Request $request
* @param array $exclude an array of param to exclude from the filter *
* @return mixed
*/ */
protected function findOneBy($classQuery, Request $request) protected function findOneBy($classQuery, Request $request)
{ {
@ -178,6 +198,9 @@ class PropelParamConverter implements ParamConverterInterface
* Init the query class with optional joinWith * Init the query class with optional joinWith
* *
* @param string $classQuery * @param string $classQuery
*
* @return \ModelCriteria
*
* @throws \Exception * @throws \Exception
*/ */
protected function getQuery($classQuery) protected function getQuery($classQuery)
@ -207,6 +230,9 @@ class PropelParamConverter implements ParamConverterInterface
* Return the valid join Criteria base on the with parameter * Return the valid join Criteria base on the with parameter
* *
* @param array $with * @param array $with
*
* @return string
*
* @throws \Exception * @throws \Exception
*/ */
protected function getValidJoin($with) protected function getValidJoin($with)

View file

@ -10,7 +10,6 @@
namespace Propel\PropelBundle\Security\Acl\Domain; namespace Propel\PropelBundle\Security\Acl\Domain;
use Symfony\Component\Security\Acl\Exception\Exception as AclException; use Symfony\Component\Security\Acl\Exception\Exception as AclException;
use Symfony\Component\Security\Acl\Model\AclInterface; use Symfony\Component\Security\Acl\Model\AclInterface;

View file

@ -24,7 +24,6 @@ use Propel\PropelBundle\Security\Acl\Domain\Entry;
use Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException; use Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException;
use Symfony\Component\Security\Acl\Exception\Exception as AclException; use Symfony\Component\Security\Acl\Exception\Exception as AclException;
use Symfony\Component\Security\Acl\Model\AclInterface; use Symfony\Component\Security\Acl\Model\AclInterface;
use Symfony\Component\Security\Acl\Model\EntryInterface; use Symfony\Component\Security\Acl\Model\EntryInterface;
use Symfony\Component\Security\Acl\Model\FieldEntryInterface; use Symfony\Component\Security\Acl\Model\FieldEntryInterface;

View file

@ -61,7 +61,7 @@ class FixturesLoadCommandTest extends TestCase
{ {
$tmp_dir = $this->fixtures_dir; $tmp_dir = $this->fixtures_dir;
return array_map(function($file) use($tmp_dir) { return array_map(function($file) use ($tmp_dir) {
return str_replace($tmp_dir . DIRECTORY_SEPARATOR, '', $file); return str_replace($tmp_dir . DIRECTORY_SEPARATOR, '', $file);
}, array_keys(iterator_to_array($file_iterator))); }, array_keys(iterator_to_array($file_iterator)));
} }

View file

@ -4,7 +4,6 @@ namespace Propel\PropelBundle\Tests\Fixtures\Model;
use Propel\PropelBundle\Tests\Fixtures\Model\om\BaseBook; use Propel\PropelBundle\Tests\Fixtures\Model\om\BaseBook;
/** /**
* Skeleton subclass for representing a row from the 'book' table. * Skeleton subclass for representing a row from the 'book' table.
* *

View file

@ -4,7 +4,6 @@ namespace Propel\PropelBundle\Tests\Fixtures\Model;
use Propel\PropelBundle\Tests\Fixtures\Model\om\BaseBookPeer; use Propel\PropelBundle\Tests\Fixtures\Model\om\BaseBookPeer;
/** /**
* Skeleton subclass for performing query and update operations on the 'book' table. * Skeleton subclass for performing query and update operations on the 'book' table.
* *

View file

@ -4,7 +4,6 @@ namespace Propel\PropelBundle\Tests\Fixtures\Model;
use Propel\PropelBundle\Tests\Fixtures\Model\om\BaseBookQuery; use Propel\PropelBundle\Tests\Fixtures\Model\om\BaseBookQuery;
/** /**
* Skeleton subclass for performing query and update operations on the 'book' table. * Skeleton subclass for performing query and update operations on the 'book' table.
* *

View file

@ -5,7 +5,6 @@ namespace Propel\PropelBundle\Tests\Fixtures\Model\map;
use \RelationMap; use \RelationMap;
use \TableMap; use \TableMap;
/** /**
* This class defines the structure of the 'book' table. * This class defines the structure of the 'book' table.
* *

View file

@ -9,7 +9,6 @@ use \PDO;
use \Persistent; use \Persistent;
use \Propel; use \Propel;
use \PropelException; use \PropelException;
use \PropelObjectCollection;
use \PropelPDO; use \PropelPDO;
use Propel\PropelBundle\Tests\Fixtures\Model\BookPeer; use Propel\PropelBundle\Tests\Fixtures\Model\BookPeer;
use Propel\PropelBundle\Tests\Fixtures\Model\BookQuery; use Propel\PropelBundle\Tests\Fixtures\Model\BookQuery;

View file

@ -65,7 +65,6 @@ abstract class BaseBookPeer
*/ */
public static $instances = array(); public static $instances = array();
/** /**
* holds an array of fieldnames * holds an array of fieldnames
* *
@ -106,7 +105,7 @@ abstract class BaseBookPeer
* @return string translated name of the field. * @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings. * @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/ */
static public function translateFieldName($name, $fromType, $toType) public static function translateFieldName($name, $fromType, $toType)
{ {
$toNames = self::getFieldNames($toType); $toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
@ -126,7 +125,7 @@ abstract class BaseBookPeer
* @return array A list of field names * @return array A list of field names
*/ */
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{ {
if (!array_key_exists($type, self::$fieldNames)) { if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
@ -529,7 +528,6 @@ abstract class BaseBookPeer
throw new PropelException('Cannot insert a value for auto-increment primary key ('.BookPeer::ID.')'); throw new PropelException('Cannot insert a value for auto-increment primary key ('.BookPeer::ID.')');
} }
// Set the correct dbName // Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME); $criteria->setDbName(self::DATABASE_NAME);
@ -770,4 +768,3 @@ abstract class BaseBookPeer
// This is the static code needed to register the TableMap for this table with the main Propel class. // This is the static code needed to register the TableMap for this table with the main Propel class.
// //
BaseBookPeer::buildTableMap(); BaseBookPeer::buildTableMap();

View file

@ -4,7 +4,6 @@ namespace Propel\PropelBundle\Tests\Fixtures\Model\om;
use \Criteria; use \Criteria;
use \ModelCriteria; use \ModelCriteria;
use \ModelJoin;
use \PropelPDO; use \PropelPDO;
use Propel\PropelBundle\Tests\Fixtures\Model\BookPeer; use Propel\PropelBundle\Tests\Fixtures\Model\BookPeer;
use Propel\PropelBundle\Tests\Fixtures\Model\BookQuery; use Propel\PropelBundle\Tests\Fixtures\Model\BookQuery;

View file

@ -8,7 +8,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Propel\PropelBundle\Tests\TestCase; use Propel\PropelBundle\Tests\TestCase;
class PropelParamConverterTest extends TestCase class PropelParamConverterTest extends TestCase
{ {
@ -152,7 +151,6 @@ class PropelParamConverterTest extends TestCase
$paramConverter->apply($request, $configuration); $paramConverter->apply($request, $configuration);
} }
public function testParamConverterFindWithOptionalParam() public function testParamConverterFindWithOptionalParam()
{ {
$paramConverter = new PropelParamConverter(); $paramConverter = new PropelParamConverter();

View file

@ -33,7 +33,7 @@ class UniqueObjectValidator extends ConstraintValidator
throw new UnexpectedTypeException($constraint->fields, 'array'); throw new UnexpectedTypeException($constraint->fields, 'array');
} }
$fields = (array)$constraint->fields; $fields = (array) $constraint->fields;
if (0 === count($fields)) { if (0 === count($fields)) {
throw new ConstraintDefinitionException("At least one field must be specified."); throw new ConstraintDefinitionException("At least one field must be specified.");