Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PSR2 rules : "the static declaration should come after visibility" #2798

Merged
merged 1 commit into from
Aug 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Cache/CacheException.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ 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.");
}

/**
* @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.");
}
Expand Down
5 changes: 2 additions & 3 deletions lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -123,7 +122,7 @@ public function __construct($dbh, $statement, OCI8Connection $conn)
* @return string
* @throws \Doctrine\DBAL\Driver\OCI8\OCI8Exception
*/
static public function convertPositionalToNamedPlaceholders($statement)
public static function convertPositionalToNamedPlaceholders($statement)
{
$fragmentOffset = $tokenOffset = 0;
$fragments = $paramMap = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public function getTruncateTableSQL($tableName, $cascade = false)
*
* @return float
*/
static public function udfSqrt($value)
public static function udfSqrt($value)
{
return sqrt($value);
}
Expand All @@ -542,7 +542,7 @@ static public function udfSqrt($value)
*
* @return integer
*/
static public function udfMod($a, $b)
public static function udfMod($a, $b)
{
return ($a % $b);
}
Expand All @@ -554,7 +554,7 @@ static public function udfMod($a, $b)
*
* @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.
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Query/QueryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 " .
Expand All @@ -45,7 +45,7 @@ static public function unknownAlias($alias, $registeredAliases)
*
* @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 " .
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/SQLParserUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -84,7 +84,7 @@ static public function getPlaceholderPositions($statement, $isPositional = true)
*
* @throws SQLParserUtilsException
*/
static public function expandListParameters($query, $params, $types)
public static function expandListParameters($query, $params, $types)
{
$isPositional = is_int(key($params));
$arrayPositions = array();
Expand Down Expand Up @@ -199,7 +199,7 @@ static public function expandListParameters($query, $params, $types)
* @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 . '|' .
Expand All @@ -219,7 +219,7 @@ static private function getUnquotedStatementFragments($statement)
* @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];
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Schema/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
26 changes: 13 additions & 13 deletions lib/Doctrine/DBAL/Schema/SchemaException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -48,7 +48,7 @@ static public function tableDoesNotExist($tableName)
*
* @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);
}
Expand All @@ -59,7 +59,7 @@ static public function indexNameInvalid($indexName)
*
* @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);
}
Expand All @@ -70,7 +70,7 @@ static public function indexDoesNotExist($indexName, $table)
*
* @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);
}
Expand All @@ -81,7 +81,7 @@ static public function indexAlreadyExists($indexName, $table)
*
* @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);
}
Expand All @@ -91,7 +91,7 @@ static public function columnDoesNotExist($columnName, $table)
*
* @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),
Expand All @@ -104,7 +104,7 @@ static public function namespaceAlreadyExists($namespaceName)
*
* @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);
}
Expand All @@ -115,7 +115,7 @@ static public function tableAlreadyExists($tableName)
*
* @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
Expand All @@ -127,7 +127,7 @@ static public function columnAlreadyExists($tableName, $columnName)
*
* @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);
}
Expand All @@ -137,7 +137,7 @@ static public function sequenceAlreadyExists($sequenceName)
*
* @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);
}
Expand All @@ -148,7 +148,7 @@ static public function sequenceDoesNotExist($sequenceName)
*
* @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);
}
Expand All @@ -159,7 +159,7 @@ static public function foreignKeyDoesNotExist($fkName, $table)
*
* @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, ".
Expand All @@ -174,7 +174,7 @@ static public function namedForeignKeyRequired(Table $localTable, ForeignKeyCons
*
* @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'");
}
Expand Down
12 changes: 6 additions & 6 deletions lib/Doctrine/DBAL/Sharding/ShardingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,47 @@ 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);
}

/**
* @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);
}

/**
* @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);
}

/**
* @return \Doctrine\DBAL\Sharding\ShardingException
*/
static public function activeTransaction()
public static function activeTransaction()
{
return new self("Cannot switch shard during an active transaction.", 1332141766);
}

/**
* @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);
}

/**
* @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'.");
}
Expand Down
12 changes: 6 additions & 6 deletions lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
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.
Expand All @@ -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)
Expand All @@ -55,7 +55,7 @@ static public function createHelperSet(Connection $connection)
*
* @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);

Expand All @@ -73,7 +73,7 @@ static public function run(HelperSet $helperSet, $commands = [])
*
* @return void
*/
static public function addCommands(Application $cli)
public static function addCommands(Application $cli)
{
$cli->addCommands([
new RunSqlCommand(),
Expand All @@ -85,7 +85,7 @@ static public function addCommands(Application $cli)
/**
* 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
Expand Down
Loading