Commit 3f67cb7f authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2798 from tolbon/Scrutinizer

Fix PSR2 rules : "the static declaration should come after visibility"
parents a756a6ae 5d1389dd
......@@ -28,7 +28,7 @@ class CacheException extends \Doctrine\DBAL\DBALException
/**
* @return \Doctrine\DBAL\Cache\CacheException
*/
static public function noCacheKey()
public static function noCacheKey()
{
return new self("No cache key was set.");
}
......@@ -36,7 +36,7 @@ class CacheException extends \Doctrine\DBAL\DBALException
/**
* @return \Doctrine\DBAL\Cache\CacheException
*/
static public function noResultDriverConfigured()
public static function noResultDriverConfigured()
{
return new self("Trying to cache a query but no result driver is configured.");
}
......
......@@ -19,9 +19,8 @@
namespace Doctrine\DBAL\Driver\OCI8;
use PDO;
use IteratorAggregate;
use Doctrine\DBAL\Driver\Statement;
use PDO;
/**
* The OCI8 implementation of the Statement interface.
......@@ -123,7 +122,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
* @return string
* @throws \Doctrine\DBAL\Driver\OCI8\OCI8Exception
*/
static public function convertPositionalToNamedPlaceholders($statement)
public static function convertPositionalToNamedPlaceholders($statement)
{
$fragmentOffset = $tokenOffset = 0;
$fragments = $paramMap = [];
......
......@@ -29,7 +29,7 @@ class SQLSrvException extends AbstractDriverException
*
* @return \Doctrine\DBAL\Driver\SQLSrv\SQLSrvException
*/
static public function fromSqlSrvErrors()
public static function fromSqlSrvErrors()
{
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
$message = "";
......
......@@ -47,7 +47,7 @@ class OraclePlatform extends AbstractPlatform
*
* @throws DBALException
*/
static public function assertValidIdentifier($identifier)
public static function assertValidIdentifier($identifier)
{
if ( ! preg_match('(^(([a-zA-Z]{1}[a-zA-Z0-9_$#]{0,})|("[^"]+"))$)', $identifier)) {
throw new DBALException("Invalid Oracle identifier");
......
......@@ -529,7 +529,7 @@ class SqlitePlatform extends AbstractPlatform
*
* @return float
*/
static public function udfSqrt($value)
public static function udfSqrt($value)
{
return sqrt($value);
}
......@@ -542,7 +542,7 @@ class SqlitePlatform extends AbstractPlatform
*
* @return integer
*/
static public function udfMod($a, $b)
public static function udfMod($a, $b)
{
return ($a % $b);
}
......@@ -554,7 +554,7 @@ class SqlitePlatform extends AbstractPlatform
*
* @return integer
*/
static public function udfLocate($str, $substr, $offset = 0)
public static function udfLocate($str, $substr, $offset = 0)
{
// SQL's LOCATE function works on 1-based positions, while PHP's strpos works on 0-based positions.
// So we have to make them compatible if an offset is given.
......
......@@ -32,7 +32,7 @@ class QueryException extends DBALException
*
* @return \Doctrine\DBAL\Query\QueryException
*/
static public function unknownAlias($alias, $registeredAliases)
public static function unknownAlias($alias, $registeredAliases)
{
return new self("The given alias '" . $alias . "' is not part of " .
"any FROM or JOIN clause table. The currently registered " .
......@@ -45,7 +45,7 @@ class QueryException extends DBALException
*
* @return \Doctrine\DBAL\Query\QueryException
*/
static public function nonUniqueAlias($alias, $registeredAliases)
public static function nonUniqueAlias($alias, $registeredAliases)
{
return new self("The given alias '" . $alias . "' is not unique " .
"in FROM and JOIN clause table. The currently registered " .
......
......@@ -48,7 +48,7 @@ class SQLParserUtils
*
* @return array
*/
static public function getPlaceholderPositions($statement, $isPositional = true)
public static function getPlaceholderPositions($statement, $isPositional = true)
{
$match = ($isPositional) ? '?' : ':';
if (strpos($statement, $match) === false) {
......@@ -84,7 +84,7 @@ class SQLParserUtils
*
* @throws SQLParserUtilsException
*/
static public function expandListParameters($query, $params, $types)
public static function expandListParameters($query, $params, $types)
{
$isPositional = is_int(key($params));
$arrayPositions = array();
......@@ -199,7 +199,7 @@ class SQLParserUtils
* @param string $statement
* @return array
*/
static private function getUnquotedStatementFragments($statement)
private static function getUnquotedStatementFragments($statement)
{
$literal = self::ESCAPED_SINGLE_QUOTED_TEXT . '|' .
self::ESCAPED_DOUBLE_QUOTED_TEXT . '|' .
......@@ -219,7 +219,7 @@ class SQLParserUtils
* @throws SQLParserUtilsException
* @return mixed
*/
static private function extractParam($paramName, $paramsOrTypes, $isParam, $defaultValue = null)
private static function extractParam($paramName, $paramsOrTypes, $isParam, $defaultValue = null)
{
if (array_key_exists($paramName, $paramsOrTypes)) {
return $paramsOrTypes[$paramName];
......
......@@ -36,7 +36,7 @@ class Comparator
*
* @return \Doctrine\DBAL\Schema\SchemaDiff
*/
static public function compareSchemas(Schema $fromSchema, Schema $toSchema)
public static function compareSchemas(Schema $fromSchema, Schema $toSchema)
{
$c = new self();
......
......@@ -38,7 +38,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function tableDoesNotExist($tableName)
public static function tableDoesNotExist($tableName)
{
return new self("There is no table with name '".$tableName."' in the schema.", self::TABLE_DOESNT_EXIST);
}
......@@ -48,7 +48,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function indexNameInvalid($indexName)
public static function indexNameInvalid($indexName)
{
return new self("Invalid index-name $indexName given, has to be [a-zA-Z0-9_]", self::INDEX_INVALID_NAME);
}
......@@ -59,7 +59,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function indexDoesNotExist($indexName, $table)
public static function indexDoesNotExist($indexName, $table)
{
return new self("Index '$indexName' does not exist on table '$table'.", self::INDEX_DOESNT_EXIST);
}
......@@ -70,7 +70,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function indexAlreadyExists($indexName, $table)
public static function indexAlreadyExists($indexName, $table)
{
return new self("An index with name '$indexName' was already defined on table '$table'.", self::INDEX_ALREADY_EXISTS);
}
......@@ -81,7 +81,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function columnDoesNotExist($columnName, $table)
public static function columnDoesNotExist($columnName, $table)
{
return new self("There is no column with name '$columnName' on table '$table'.", self::COLUMN_DOESNT_EXIST);
}
......@@ -91,7 +91,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function namespaceAlreadyExists($namespaceName)
public static function namespaceAlreadyExists($namespaceName)
{
return new self(
sprintf("The namespace with name '%s' already exists.", $namespaceName),
......@@ -104,7 +104,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function tableAlreadyExists($tableName)
public static function tableAlreadyExists($tableName)
{
return new self("The table with name '".$tableName."' already exists.", self::TABLE_ALREADY_EXISTS);
}
......@@ -115,7 +115,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function columnAlreadyExists($tableName, $columnName)
public static function columnAlreadyExists($tableName, $columnName)
{
return new self(
"The column '".$columnName."' on table '".$tableName."' already exists.", self::COLUMN_ALREADY_EXISTS
......@@ -127,7 +127,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function sequenceAlreadyExists($sequenceName)
public static function sequenceAlreadyExists($sequenceName)
{
return new self("The sequence '".$sequenceName."' already exists.", self::SEQUENCE_ALREADY_EXISTS);
}
......@@ -137,7 +137,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function sequenceDoesNotExist($sequenceName)
public static function sequenceDoesNotExist($sequenceName)
{
return new self("There exists no sequence with the name '".$sequenceName."'.", self::SEQUENCE_DOENST_EXIST);
}
......@@ -148,7 +148,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function foreignKeyDoesNotExist($fkName, $table)
public static function foreignKeyDoesNotExist($fkName, $table)
{
return new self("There exists no foreign key with the name '$fkName' on table '$table'.", self::FOREIGNKEY_DOESNT_EXIST);
}
......@@ -159,7 +159,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey)
public static function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey)
{
return new self(
"The performed schema operation on ".$localTable->getName()." requires a named foreign key, ".
......@@ -174,7 +174,7 @@ class SchemaException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Schema\SchemaException
*/
static public function alterTableChangeNotSupported($changeName)
public static function alterTableChangeNotSupported($changeName)
{
return new self("Alter table change not supported, given '$changeName'");
}
......
......@@ -31,7 +31,7 @@ class ShardingException extends DBALException
/**
* @return \Doctrine\DBAL\Sharding\ShardingException
*/
static public function notImplemented()
public static function notImplemented()
{
return new self("This functionality is not implemented with this sharding provider.", 1331557937);
}
......@@ -39,7 +39,7 @@ class ShardingException extends DBALException
/**
* @return \Doctrine\DBAL\Sharding\ShardingException
*/
static public function missingDefaultFederationName()
public static function missingDefaultFederationName()
{
return new self("SQLAzure requires a federation name to be set during sharding configuration.", 1332141280);
}
......@@ -47,7 +47,7 @@ class ShardingException extends DBALException
/**
* @return \Doctrine\DBAL\Sharding\ShardingException
*/
static public function missingDefaultDistributionKey()
public static function missingDefaultDistributionKey()
{
return new self("SQLAzure requires a distribution key to be set during sharding configuration.", 1332141329);
}
......@@ -55,7 +55,7 @@ class ShardingException extends DBALException
/**
* @return \Doctrine\DBAL\Sharding\ShardingException
*/
static public function activeTransaction()
public static function activeTransaction()
{
return new self("Cannot switch shard during an active transaction.", 1332141766);
}
......@@ -63,7 +63,7 @@ class ShardingException extends DBALException
/**
* @return \Doctrine\DBAL\Sharding\ShardingException
*/
static public function noShardDistributionValue()
public static function noShardDistributionValue()
{
return new self("You have to specify a string or integer as shard distribution value.", 1332142103);
}
......@@ -71,7 +71,7 @@ class ShardingException extends DBALException
/**
* @return \Doctrine\DBAL\Sharding\ShardingException
*/
static public function missingDistributionType()
public static function missingDistributionType()
{
return new self("You have to specify a sharding distribution type such as 'integer', 'string', 'guid'.");
}
......
......@@ -23,10 +23,10 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Tools\Console\Command\ImportCommand;
use Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand;
use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
use Symfony\Component\Console\Helper\HelperSet;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Symfony\Component\Console\Application;
use Doctrine\DBAL\Version;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Helper\HelperSet;
/**
* Handles running the Console Tools inside Symfony Console context.
......@@ -40,7 +40,7 @@ class ConsoleRunner
*
* @return HelperSet
*/
static public function createHelperSet(Connection $connection)
public static function createHelperSet(Connection $connection)
{
return new HelperSet([
'db' => new ConnectionHelper($connection)
......@@ -55,7 +55,7 @@ class ConsoleRunner
*
* @return void
*/
static public function run(HelperSet $helperSet, $commands = [])
public static function run(HelperSet $helperSet, $commands = [])
{
$cli = new Application('Doctrine Command Line Interface', Version::VERSION);
......@@ -73,7 +73,7 @@ class ConsoleRunner
*
* @return void
*/
static public function addCommands(Application $cli)
public static function addCommands(Application $cli)
{
$cli->addCommands([
new RunSqlCommand(),
......@@ -85,7 +85,7 @@ class ConsoleRunner
/**
* Prints the instructions to create a configuration file
*/
static public function printCliConfigTemplate()
public static function printCliConfigTemplate()
{
echo <<<'HELP'
You are missing a "cli-config.php" or "config/cli-config.php" file in your
......
......@@ -39,7 +39,7 @@ class ConversionException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Types\ConversionException
*/
static public function conversionFailed($value, $toType)
public static function conversionFailed($value, $toType)
{
$value = (strlen($value) > 32) ? substr($value, 0, 20) . '...' : $value;
......@@ -57,7 +57,7 @@ class ConversionException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Types\ConversionException
*/
static public function conversionFailedFormat($value, $toType, $expectedFormat, \Exception $previous = null)
public static function conversionFailedFormat($value, $toType, $expectedFormat, \Exception $previous = null)
{
$value = (strlen($value) > 32) ? substr($value, 0, 20) . '...' : $value;
......@@ -78,7 +78,7 @@ class ConversionException extends \Doctrine\DBAL\DBALException
*
* @return \Doctrine\DBAL\Types\ConversionException
*/
static public function conversionFailedInvalidType($value, $toType, array $possibleTypes)
public static function conversionFailedInvalidType($value, $toType, array $possibleTypes)
{
$actualType = is_object($value) ? get_class($value) : gettype($value);
......@@ -100,7 +100,7 @@ class ConversionException extends \Doctrine\DBAL\DBALException
));
}
static public function conversionFailedSerialization($value, $format, $error)
public static function conversionFailedSerialization($value, $format, $error)
{
$actualType = is_object($value) ? get_class($value) : gettype($value);
......
......@@ -40,7 +40,7 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
}
static public function dataIdempotentDataConversion()
public static function dataIdempotentDataConversion()
{
$obj = new \stdClass();
$obj->foo = "bar";
......
......@@ -11,7 +11,7 @@ use Doctrine\DBAL\Types\Type;
class OraclePlatformTest extends AbstractPlatformTestCase
{
static public function dataValidIdentifiers()
public static function dataValidIdentifiers()
{
return array(
array('a'),
......@@ -35,7 +35,7 @@ class OraclePlatformTest extends AbstractPlatformTestCase
$platform->assertValidIdentifier($identifier);
}
static public function dataInvalidIdentifiers()
public static function dataInvalidIdentifiers()
{
return array(
array('1'),
......
......@@ -4,7 +4,7 @@ namespace Doctrine\Tests\DBAL;
class UtilTest extends \Doctrine\Tests\DbalTestCase
{
static public function dataConvertPositionalToNamedParameters()
public static function dataConvertPositionalToNamedParameters()
{
return array(
array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment