Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
4f7c1b72
Commit
4f7c1b72
authored
Aug 03, 2017
by
Marco Pivetta
Committed by
GitHub
Aug 03, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2789 from AlessandroMinoccheri/fix_array_short_declarations
Use short array declarations
parents
49d44a73
80f42dc7
Changes
87
Hide whitespace changes
Inline
Side-by-side
Showing
87 changed files
with
500 additions
and
499 deletions
+500
-499
ArrayStatement.php
lib/Doctrine/DBAL/Cache/ArrayStatement.php
+1
-1
ResultCacheStatement.php
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
+3
-3
Configuration.php
lib/Doctrine/DBAL/Configuration.php
+1
-1
Connection.php
lib/Doctrine/DBAL/Connection.php
+22
-22
MasterSlaveConnection.php
lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
+1
-1
DBALException.php
lib/Doctrine/DBAL/DBALException.php
+1
-1
Driver.php
lib/Doctrine/DBAL/Driver.php
+1
-1
DriverManager.php
lib/Doctrine/DBAL/DriverManager.php
+1
-1
MysqlSessionInit.php
lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
+1
-1
OracleSessionInit.php
lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
+5
-5
SQLSessionInit.php
lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php
+1
-1
SchemaAlterTableAddColumnEventArgs.php
...octrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
+1
-1
SchemaAlterTableChangeColumnEventArgs.php
...rine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
+1
-1
SchemaAlterTableEventArgs.php
lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php
+1
-1
SchemaAlterTableRemoveColumnEventArgs.php
...rine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php
+1
-1
SchemaAlterTableRenameColumnEventArgs.php
...rine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php
+1
-1
SchemaCreateTableColumnEventArgs.php
lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php
+1
-1
SchemaCreateTableEventArgs.php
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
+1
-1
TableGenerator.php
lib/Doctrine/DBAL/Id/TableGenerator.php
+6
-6
TableGeneratorSchemaVisitor.php
lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php
+2
-2
DebugStack.php
lib/Doctrine/DBAL/Logging/DebugStack.php
+2
-2
LoggerChain.php
lib/Doctrine/DBAL/Logging/LoggerChain.php
+1
-1
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+19
-19
DB2Platform.php
lib/Doctrine/DBAL/Platforms/DB2Platform.php
+15
-15
DrizzlePlatform.php
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
+8
-8
DB2Keywords.php
lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
+2
-2
DrizzleKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php
+2
-2
MySQL57Keywords.php
lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php
+2
-2
MySQLKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php
+2
-2
OracleKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php
+2
-2
PostgreSQL91Keywords.php
...Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php
+2
-2
PostgreSQL92Keywords.php
...Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php
+2
-2
PostgreSQL94Keywords.php
...Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php
+4
-4
PostgreSQLKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
+2
-2
ReservedKeywordsValidator.php
...ine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
+3
-3
SQLAnywhere11Keywords.php
...octrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php
+3
-3
SQLAnywhere12Keywords.php
...octrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php
+4
-4
SQLAnywhere16Keywords.php
...octrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php
+2
-2
SQLAnywhereKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php
+2
-2
SQLServer2005Keywords.php
...octrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php
+2
-2
SQLServer2008Keywords.php
...octrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php
+2
-2
SQLServer2012Keywords.php
...octrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php
+2
-2
SQLServerKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php
+2
-2
SQLiteKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php
+2
-2
MySQL57Platform.php
lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
+4
-4
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+18
-18
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+18
-18
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+16
-16
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+12
-12
SQLServer2012Platform.php
lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
+1
-1
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+15
-15
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+20
-20
Connection.php
lib/Doctrine/DBAL/Portability/Connection.php
+1
-1
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+1
-1
QueryBuilder.php
lib/Doctrine/DBAL/Query/QueryBuilder.php
+4
-4
SQLParserUtils.php
lib/Doctrine/DBAL/SQLParserUtils.php
+9
-9
AbstractAsset.php
lib/Doctrine/DBAL/Schema/AbstractAsset.php
+1
-1
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+24
-24
Column.php
lib/Doctrine/DBAL/Schema/Column.php
+5
-5
ColumnDiff.php
lib/Doctrine/DBAL/Schema/ColumnDiff.php
+2
-2
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+8
-8
DB2SchemaManager.php
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
+11
-11
DrizzleSchemaManager.php
lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
+7
-7
ForeignKeyConstraint.php
lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
+8
-8
Index.php
lib/Doctrine/DBAL/Schema/Index.php
+6
-6
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+14
-14
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+14
-14
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+13
-13
SQLAnywhereSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php
+12
-11
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+13
-13
Schema.php
lib/Doctrine/DBAL/Schema/Schema.php
+6
-6
SchemaConfig.php
lib/Doctrine/DBAL/Schema/SchemaConfig.php
+1
-1
SchemaDiff.php
lib/Doctrine/DBAL/Schema/SchemaDiff.php
+12
-12
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+19
-19
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+18
-18
TableDiff.php
lib/Doctrine/DBAL/Schema/TableDiff.php
+13
-13
CreateSchemaSqlCollector.php
...Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php
+8
-8
DropSchemaSqlCollector.php
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
+1
-1
Graphviz.php
lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php
+4
-4
SQLAzureFederationsSynchronizer.php
...BAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php
+2
-2
MultiTenantVisitor.php
...rine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php
+1
-1
Statement.php
lib/Doctrine/DBAL/Statement.php
+4
-4
ImportCommand.php
lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php
+2
-2
ReservedWordsCommand.php
...trine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+4
-4
JsonArrayType.php
lib/Doctrine/DBAL/Types/JsonArrayType.php
+1
-1
SimpleArrayType.php
lib/Doctrine/DBAL/Types/SimpleArrayType.php
+1
-1
Type.php
lib/Doctrine/DBAL/Types/Type.php
+4
-4
No files found.
lib/Doctrine/DBAL/Cache/ArrayStatement.php
View file @
4f7c1b72
...
...
@@ -124,7 +124,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
*/
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
$rows
=
array
()
;
$rows
=
[]
;
while
(
$row
=
$this
->
fetch
(
$fetchMode
))
{
$rows
[]
=
$row
;
}
...
...
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
View file @
4f7c1b72
...
...
@@ -107,7 +107,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
if
(
$this
->
emptied
&&
$this
->
data
!==
null
)
{
$data
=
$this
->
resultCache
->
fetch
(
$this
->
cacheKey
);
if
(
!
$data
)
{
$data
=
array
()
;
$data
=
[]
;
}
$data
[
$this
->
realKey
]
=
$this
->
data
;
...
...
@@ -150,7 +150,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
public
function
fetch
(
$fetchMode
=
null
,
$cursorOrientation
=
\PDO
::
FETCH_ORI_NEXT
,
$cursorOffset
=
0
)
{
if
(
$this
->
data
===
null
)
{
$this
->
data
=
array
()
;
$this
->
data
=
[]
;
}
$row
=
$this
->
statement
->
fetch
(
PDO
::
FETCH_ASSOC
);
...
...
@@ -181,7 +181,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
*/
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
$rows
=
array
()
;
$rows
=
[]
;
while
(
$row
=
$this
->
fetch
(
$fetchMode
))
{
$rows
[]
=
$row
;
}
...
...
lib/Doctrine/DBAL/Configuration.php
View file @
4f7c1b72
...
...
@@ -40,7 +40,7 @@ class Configuration
*
* @var array
*/
protected
$_attributes
=
array
()
;
protected
$_attributes
=
[]
;
/**
* Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
...
...
lib/Doctrine/DBAL/Connection.php
View file @
4f7c1b72
...
...
@@ -153,7 +153,7 @@ class Connection implements DriverConnection
*
* @var array
*/
private
$_params
=
array
()
;
private
$_params
=
[]
;
/**
* The DatabasePlatform object that provides information about the
...
...
@@ -357,7 +357,7 @@ class Connection implements DriverConnection
}
$driverOptions
=
isset
(
$this
->
_params
[
'driverOptions'
])
?
$this
->
_params
[
'driverOptions'
]
:
array
()
;
$this
->
_params
[
'driverOptions'
]
:
[]
;
$user
=
isset
(
$this
->
_params
[
'user'
])
?
$this
->
_params
[
'user'
]
:
null
;
$password
=
isset
(
$this
->
_params
[
'password'
])
?
$this
->
_params
[
'password'
]
:
null
;
...
...
@@ -552,7 +552,7 @@ class Connection implements DriverConnection
*
* @throws \Doctrine\DBAL\DBALException
*/
public
function
fetchAssoc
(
$statement
,
array
$params
=
array
(),
array
$types
=
array
()
)
public
function
fetchAssoc
(
$statement
,
array
$params
=
[],
array
$types
=
[]
)
{
return
$this
->
executeQuery
(
$statement
,
$params
,
$types
)
->
fetch
(
PDO
::
FETCH_ASSOC
);
}
...
...
@@ -567,7 +567,7 @@ class Connection implements DriverConnection
*
* @return array|bool False is returned if no rows are found.
*/
public
function
fetchArray
(
$statement
,
array
$params
=
array
(),
array
$types
=
array
()
)
public
function
fetchArray
(
$statement
,
array
$params
=
[],
array
$types
=
[]
)
{
return
$this
->
executeQuery
(
$statement
,
$params
,
$types
)
->
fetch
(
PDO
::
FETCH_NUM
);
}
...
...
@@ -585,7 +585,7 @@ class Connection implements DriverConnection
*
* @throws \Doctrine\DBAL\DBALException
*/
public
function
fetchColumn
(
$statement
,
array
$params
=
array
(),
$column
=
0
,
array
$types
=
array
()
)
public
function
fetchColumn
(
$statement
,
array
$params
=
[],
$column
=
0
,
array
$types
=
[]
)
{
return
$this
->
executeQuery
(
$statement
,
$params
,
$types
)
->
fetchColumn
(
$column
);
}
...
...
@@ -654,7 +654,7 @@ class Connection implements DriverConnection
* @throws \Doctrine\DBAL\DBALException
* @throws InvalidArgumentException
*/
public
function
delete
(
$tableExpression
,
array
$identifier
,
array
$types
=
array
()
)
public
function
delete
(
$tableExpression
,
array
$identifier
,
array
$types
=
[]
)
{
if
(
empty
(
$identifier
))
{
throw
InvalidArgumentException
::
fromEmptyCriteria
();
...
...
@@ -723,11 +723,11 @@ class Connection implements DriverConnection
*
* @throws \Doctrine\DBAL\DBALException
*/
public
function
update
(
$tableExpression
,
array
$data
,
array
$identifier
,
array
$types
=
array
()
)
public
function
update
(
$tableExpression
,
array
$data
,
array
$identifier
,
array
$types
=
[]
)
{
$setColumns
=
array
()
;
$setValues
=
array
()
;
$set
=
array
()
;
$setColumns
=
[]
;
$setValues
=
[]
;
$set
=
[]
;
foreach
(
$data
as
$columnName
=>
$value
)
{
$setColumns
[]
=
$columnName
;
...
...
@@ -762,15 +762,15 @@ class Connection implements DriverConnection
*
* @throws \Doctrine\DBAL\DBALException
*/
public
function
insert
(
$tableExpression
,
array
$data
,
array
$types
=
array
()
)
public
function
insert
(
$tableExpression
,
array
$data
,
array
$types
=
[]
)
{
if
(
empty
(
$data
))
{
return
$this
->
executeUpdate
(
'INSERT INTO '
.
$tableExpression
.
' ()'
.
' VALUES ()'
);
}
$columns
=
array
()
;
$values
=
array
()
;
$set
=
array
()
;
$columns
=
[]
;
$values
=
[]
;
$set
=
[]
;
foreach
(
$data
as
$columnName
=>
$value
)
{
$columns
[]
=
$columnName
;
...
...
@@ -796,7 +796,7 @@ class Connection implements DriverConnection
*/
private
function
extractTypeValues
(
array
$columnList
,
array
$types
)
{
$typeValues
=
array
()
;
$typeValues
=
[]
;
foreach
(
$columnList
as
$columnIndex
=>
$columnName
)
{
$typeValues
[]
=
isset
(
$types
[
$columnName
])
...
...
@@ -852,7 +852,7 @@ class Connection implements DriverConnection
*
* @return array
*/
public
function
fetchAll
(
$sql
,
array
$params
=
array
(),
$types
=
array
()
)
public
function
fetchAll
(
$sql
,
array
$params
=
[],
$types
=
[]
)
{
return
$this
->
executeQuery
(
$sql
,
$params
,
$types
)
->
fetchAll
();
}
...
...
@@ -894,7 +894,7 @@ class Connection implements DriverConnection
*
* @throws \Doctrine\DBAL\DBALException
*/
public
function
executeQuery
(
$query
,
array
$params
=
array
(),
$types
=
array
()
,
QueryCacheProfile
$qcp
=
null
)
public
function
executeQuery
(
$query
,
array
$params
=
[],
$types
=
[]
,
QueryCacheProfile
$qcp
=
null
)
{
if
(
$qcp
!==
null
)
{
return
$this
->
executeCacheQuery
(
$query
,
$params
,
$types
,
$qcp
);
...
...
@@ -961,7 +961,7 @@ class Connection implements DriverConnection
if
(
isset
(
$data
[
$realKey
]))
{
$stmt
=
new
ArrayStatement
(
$data
[
$realKey
]);
}
elseif
(
array_key_exists
(
$realKey
,
$data
))
{
$stmt
=
new
ArrayStatement
(
array
()
);
$stmt
=
new
ArrayStatement
(
[]
);
}
}
...
...
@@ -988,7 +988,7 @@ class Connection implements DriverConnection
*/
public
function
project
(
$query
,
array
$params
,
Closure
$function
)
{
$result
=
array
()
;
$result
=
[]
;
$stmt
=
$this
->
executeQuery
(
$query
,
$params
);
while
(
$row
=
$stmt
->
fetch
())
{
...
...
@@ -1047,7 +1047,7 @@ class Connection implements DriverConnection
*
* @throws \Doctrine\DBAL\DBALException
*/
public
function
executeUpdate
(
$query
,
array
$params
=
array
(),
array
$types
=
array
()
)
public
function
executeUpdate
(
$query
,
array
$params
=
[],
array
$types
=
[]
)
{
$this
->
connect
();
...
...
@@ -1588,7 +1588,7 @@ class Connection implements DriverConnection
$bindingType
=
$type
;
// PDO::PARAM_* constants
}
return
array
(
$value
,
$bindingType
)
;
return
[
$value
,
$bindingType
]
;
}
/**
...
...
@@ -1604,7 +1604,7 @@ class Connection implements DriverConnection
*/
public
function
resolveParams
(
array
$params
,
array
$types
)
{
$resolvedParams
=
array
()
;
$resolvedParams
=
[]
;
// Check whether parameters are positional or named. Mixing is not allowed, just like in PDO.
if
(
is_int
(
key
(
$params
)))
{
...
...
lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
View file @
4f7c1b72
...
...
@@ -288,7 +288,7 @@ class MasterSlaveConnection extends Connection
parent
::
close
();
$this
->
_conn
=
null
;
$this
->
connections
=
array
(
'master'
=>
null
,
'slave'
=>
null
)
;
$this
->
connections
=
[
'master'
=>
null
,
'slave'
=>
null
]
;
}
/**
...
...
lib/Doctrine/DBAL/DBALException.php
View file @
4f7c1b72
...
...
@@ -117,7 +117,7 @@ class DBALException extends \Exception
*
* @return \Doctrine\DBAL\DBALException
*/
public
static
function
driverExceptionDuringQuery
(
Driver
$driver
,
\Exception
$driverEx
,
$sql
,
array
$params
=
array
()
)
public
static
function
driverExceptionDuringQuery
(
Driver
$driver
,
\Exception
$driverEx
,
$sql
,
array
$params
=
[]
)
{
$msg
=
"An exception occurred while executing '"
.
$sql
.
"'"
;
if
(
$params
)
{
...
...
lib/Doctrine/DBAL/Driver.php
View file @
4f7c1b72
...
...
@@ -37,7 +37,7 @@ interface Driver
*
* @return \Doctrine\DBAL\Driver\Connection The database connection.
*/
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
()
);
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
[]
);
/**
* Gets the DatabasePlatform instance that provides all the metadata about
...
...
lib/Doctrine/DBAL/DriverManager.php
View file @
4f7c1b72
...
...
@@ -334,7 +334,7 @@ final class DriverManager
return
$params
;
}
$query
=
array
()
;
$query
=
[]
;
parse_str
(
$url
[
'query'
],
$query
);
// simply ingest query as extra params, e.g. charset or sslmode
...
...
lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
View file @
4f7c1b72
...
...
@@ -75,6 +75,6 @@ class MysqlSessionInit implements EventSubscriber
*/
public
function
getSubscribedEvents
()
{
return
array
(
Events
::
postConnect
)
;
return
[
Events
::
postConnect
]
;
}
}
lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
View file @
4f7c1b72
...
...
@@ -42,18 +42,18 @@ class OracleSessionInit implements EventSubscriber
/**
* @var array
*/
protected
$_defaultSessionVars
=
array
(
protected
$_defaultSessionVars
=
[
'NLS_TIME_FORMAT'
=>
"HH24:MI:SS"
,
'NLS_DATE_FORMAT'
=>
"YYYY-MM-DD HH24:MI:SS"
,
'NLS_TIMESTAMP_FORMAT'
=>
"YYYY-MM-DD HH24:MI:SS"
,
'NLS_TIMESTAMP_TZ_FORMAT'
=>
"YYYY-MM-DD HH24:MI:SS TZH:TZM"
,
'NLS_NUMERIC_CHARACTERS'
=>
".,"
,
)
;
]
;
/**
* @param array $oracleSessionVars
*/
public
function
__construct
(
array
$oracleSessionVars
=
array
()
)
public
function
__construct
(
array
$oracleSessionVars
=
[]
)
{
$this
->
_defaultSessionVars
=
array_merge
(
$this
->
_defaultSessionVars
,
$oracleSessionVars
);
}
...
...
@@ -67,7 +67,7 @@ class OracleSessionInit implements EventSubscriber
{
if
(
count
(
$this
->
_defaultSessionVars
))
{
array_change_key_case
(
$this
->
_defaultSessionVars
,
\CASE_UPPER
);
$vars
=
array
()
;
$vars
=
[]
;
foreach
(
$this
->
_defaultSessionVars
as
$option
=>
$value
)
{
if
(
$option
===
'CURRENT_SCHEMA'
)
{
$vars
[]
=
$option
.
" = "
.
$value
;
...
...
@@ -85,6 +85,6 @@ class OracleSessionInit implements EventSubscriber
*/
public
function
getSubscribedEvents
()
{
return
array
(
Events
::
postConnect
)
;
return
[
Events
::
postConnect
]
;
}
}
lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php
View file @
4f7c1b72
...
...
@@ -61,6 +61,6 @@ class SQLSessionInit implements EventSubscriber
*/
public
function
getSubscribedEvents
()
{
return
array
(
Events
::
postConnect
)
;
return
[
Events
::
postConnect
]
;
}
}
lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
View file @
4f7c1b72
...
...
@@ -50,7 +50,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private
$_sql
=
array
()
;
private
$_sql
=
[]
;
/**
* @param \Doctrine\DBAL\Schema\Column $column
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
View file @
4f7c1b72
...
...
@@ -50,7 +50,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private
$_sql
=
array
()
;
private
$_sql
=
[]
;
/**
* @param \Doctrine\DBAL\Schema\ColumnDiff $columnDiff
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php
View file @
4f7c1b72
...
...
@@ -44,7 +44,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs
/**
* @var array
*/
private
$_sql
=
array
()
;
private
$_sql
=
[]
;
/**
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php
View file @
4f7c1b72
...
...
@@ -50,7 +50,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private
$_sql
=
array
()
;
private
$_sql
=
[]
;
/**
* @param \Doctrine\DBAL\Schema\Column $column
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php
View file @
4f7c1b72
...
...
@@ -55,7 +55,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private
$_sql
=
array
()
;
private
$_sql
=
[]
;
/**
* @param string $oldColumnName
...
...
lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php
View file @
4f7c1b72
...
...
@@ -50,7 +50,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
/**
* @var array
*/
private
$_sql
=
array
()
;
private
$_sql
=
[]
;
/**
* @param \Doctrine\DBAL\Schema\Column $column
...
...
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
View file @
4f7c1b72
...
...
@@ -54,7 +54,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
/**
* @var array
*/
private
$_sql
=
array
()
;
private
$_sql
=
[]
;
/**
* @param \Doctrine\DBAL\Schema\Table $table
...
...
lib/Doctrine/DBAL/Id/TableGenerator.php
View file @
4f7c1b72
...
...
@@ -76,7 +76,7 @@ class TableGenerator
/**
* @var array
*/
private
$sequences
=
array
()
;
private
$sequences
=
[]
;
/**
* @param \Doctrine\DBAL\Connection $conn
...
...
@@ -122,7 +122,7 @@ class TableGenerator
$sql
=
"SELECT sequence_value, sequence_increment_by "
.
"FROM "
.
$platform
->
appendLockHint
(
$this
->
generatorTableName
,
\Doctrine\DBAL\LockMode
::
PESSIMISTIC_WRITE
)
.
" "
.
"WHERE sequence_name = ? "
.
$platform
->
getWriteLockSQL
();
$stmt
=
$this
->
conn
->
executeQuery
(
$sql
,
array
(
$sequenceName
)
);
$stmt
=
$this
->
conn
->
executeQuery
(
$sql
,
[
$sequenceName
]
);
if
(
$row
=
$stmt
->
fetch
(
\PDO
::
FETCH_ASSOC
))
{
$row
=
array_change_key_case
(
$row
,
CASE_LOWER
);
...
...
@@ -131,16 +131,16 @@ class TableGenerator
$value
++
;
if
(
$row
[
'sequence_increment_by'
]
>
1
)
{
$this
->
sequences
[
$sequenceName
]
=
array
(
$this
->
sequences
[
$sequenceName
]
=
[
'value'
=>
$value
,
'max'
=>
$row
[
'sequence_value'
]
+
$row
[
'sequence_increment_by'
]
)
;
]
;
}
$sql
=
"UPDATE "
.
$this
->
generatorTableName
.
" "
.
"SET sequence_value = sequence_value + sequence_increment_by "
.
"WHERE sequence_name = ? AND sequence_value = ?"
;
$rows
=
$this
->
conn
->
executeUpdate
(
$sql
,
array
(
$sequenceName
,
$row
[
'sequence_value'
])
);
$rows
=
$this
->
conn
->
executeUpdate
(
$sql
,
[
$sequenceName
,
$row
[
'sequence_value'
]]
);
if
(
$rows
!=
1
)
{
throw
new
\Doctrine\DBAL\DBALException
(
"Race-condition detected while updating sequence. Aborting generation"
);
...
...
@@ -148,7 +148,7 @@ class TableGenerator
}
else
{
$this
->
conn
->
insert
(
$this
->
generatorTableName
,
array
(
'sequence_name'
=>
$sequenceName
,
'sequence_value'
=>
1
,
'sequence_increment_by'
=>
1
)
[
'sequence_name'
=>
$sequenceName
,
'sequence_value'
=>
1
,
'sequence_increment_by'
=>
1
]
);
$value
=
1
;
}
...
...
lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php
View file @
4f7c1b72
...
...
@@ -48,8 +48,8 @@ class TableGeneratorSchemaVisitor implements \Doctrine\DBAL\Schema\Visitor\Visit
{
$table
=
$schema
->
createTable
(
$this
->
generatorTableName
);
$table
->
addColumn
(
'sequence_name'
,
'string'
);
$table
->
addColumn
(
'sequence_value'
,
'integer'
,
array
(
'default'
=>
1
)
);
$table
->
addColumn
(
'sequence_increment_by'
,
'integer'
,
array
(
'default'
=>
1
)
);
$table
->
addColumn
(
'sequence_value'
,
'integer'
,
[
'default'
=>
1
]
);
$table
->
addColumn
(
'sequence_increment_by'
,
'integer'
,
[
'default'
=>
1
]
);
}
/**
...
...
lib/Doctrine/DBAL/Logging/DebugStack.php
View file @
4f7c1b72
...
...
@@ -36,7 +36,7 @@ class DebugStack implements SQLLogger
*
* @var array
*/
public
$queries
=
array
()
;
public
$queries
=
[]
;
/**
* If Debug Stack is enabled (log queries) or not.
...
...
@@ -62,7 +62,7 @@ class DebugStack implements SQLLogger
{
if
(
$this
->
enabled
)
{
$this
->
start
=
microtime
(
true
);
$this
->
queries
[
++
$this
->
currentQuery
]
=
array
(
'sql'
=>
$sql
,
'params'
=>
$params
,
'types'
=>
$types
,
'executionMS'
=>
0
)
;
$this
->
queries
[
++
$this
->
currentQuery
]
=
[
'sql'
=>
$sql
,
'params'
=>
$params
,
'types'
=>
$types
,
'executionMS'
=>
0
]
;
}
}
...
...
lib/Doctrine/DBAL/Logging/LoggerChain.php
View file @
4f7c1b72
...
...
@@ -31,7 +31,7 @@ class LoggerChain implements SQLLogger
/**
* @var \Doctrine\DBAL\Logging\SQLLogger[]
*/
private
$loggers
=
array
()
;
private
$loggers
=
[]
;
/**
* Adds a logger in the chain.
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
4f7c1b72
...
...
@@ -457,7 +457,7 @@ abstract class AbstractPlatform
*/
protected
function
initializeCommentedDoctrineTypes
()
{
$this
->
doctrineTypeComments
=
array
()
;
$this
->
doctrineTypeComments
=
[]
;
foreach
(
Type
::
getTypesMap
()
as
$typeName
=>
$className
)
{
$type
=
Type
::
getType
(
$typeName
);
...
...
@@ -607,7 +607,7 @@ abstract class AbstractPlatform
*/
public
function
getWildcards
()
{
return
array
(
'%'
,
'_'
)
;
return
[
'%'
,
'_'
]
;
}
/**
...
...
@@ -1518,9 +1518,9 @@ abstract class AbstractPlatform
$tableName
=
$table
->
getQuotedName
(
$this
);
$options
=
$table
->
getOptions
();
$options
[
'uniqueConstraints'
]
=
array
()
;
$options
[
'indexes'
]
=
array
()
;
$options
[
'primary'
]
=
array
()
;
$options
[
'uniqueConstraints'
]
=
[]
;
$options
[
'indexes'
]
=
[]
;
$options
[
'primary'
]
=
[]
;
if
((
$createFlags
&
self
::
CREATE_INDEXES
)
>
0
)
{
foreach
(
$table
->
getIndexes
()
as
$index
)
{
...
...
@@ -1534,8 +1534,8 @@ abstract class AbstractPlatform
}
}
$columnSql
=
array
()
;
$columns
=
array
()
;
$columnSql
=
[]
;
$columns
=
[]
;
foreach
(
$table
->
getColumns
()
as
$column
)
{
/* @var \Doctrine\DBAL\Schema\Column $column */
...
...
@@ -1568,7 +1568,7 @@ abstract class AbstractPlatform
}
if
((
$createFlags
&
self
::
CREATE_FOREIGNKEYS
)
>
0
)
{
$options
[
'foreignKeys'
]
=
array
()
;
$options
[
'foreignKeys'
]
=
[]
;
foreach
(
$table
->
getForeignKeys
()
as
$fkConstraint
)
{
$options
[
'foreignKeys'
][]
=
$fkConstraint
;
}
...
...
@@ -1641,7 +1641,7 @@ abstract class AbstractPlatform
*
* @return array
*/
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
[]
)
{
$columnListSql
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
...
...
@@ -1860,7 +1860,7 @@ abstract class AbstractPlatform
public
function
quoteIdentifier
(
$str
)
{
if
(
strpos
(
$str
,
"."
)
!==
false
)
{
$parts
=
array_map
(
array
(
$this
,
"quoteSingleIdentifier"
)
,
explode
(
"."
,
$str
));
$parts
=
array_map
(
[
$this
,
"quoteSingleIdentifier"
]
,
explode
(
"."
,
$str
));
return
implode
(
"."
,
$parts
);
}
...
...
@@ -2051,7 +2051,7 @@ abstract class AbstractPlatform
{
$tableName
=
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
);
$sql
=
array
()
;
$sql
=
[]
;
if
(
$this
->
supportsForeignKeyConstraints
())
{
foreach
(
$diff
->
removedForeignKeys
as
$foreignKey
)
{
$sql
[]
=
$this
->
getDropForeignKeySQL
(
$foreignKey
,
$tableName
);
...
...
@@ -2082,7 +2082,7 @@ abstract class AbstractPlatform
?
$diff
->
getNewName
()
->
getQuotedName
(
$this
)
:
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
);
$sql
=
array
()
;
$sql
=
[]
;
if
(
$this
->
supportsForeignKeyConstraints
())
{
foreach
(
$diff
->
addedForeignKeys
as
$foreignKey
)
{
...
...
@@ -2124,10 +2124,10 @@ abstract class AbstractPlatform
*/
protected
function
getRenameIndexSQL
(
$oldIndexName
,
Index
$index
,
$tableName
)
{
return
array
(
return
[
$this
->
getDropIndexSQL
(
$oldIndexName
,
$tableName
),
$this
->
getCreateIndexSQL
(
$index
,
$tableName
)
)
;
]
;
}
/**
...
...
@@ -2173,7 +2173,7 @@ abstract class AbstractPlatform
*/
public
function
getColumnDeclarationListSQL
(
array
$fields
)
{
$queryFields
=
array
()
;
$queryFields
=
[]
;
foreach
(
$fields
as
$fieldName
=>
$field
)
{
$queryFields
[]
=
$this
->
getColumnDeclarationSQL
(
$fieldName
,
$field
);
...
...
@@ -2279,9 +2279,9 @@ abstract class AbstractPlatform
if
(
isset
(
$field
[
'default'
]))
{
$default
=
" DEFAULT '"
.
$field
[
'default'
]
.
"'"
;
if
(
isset
(
$field
[
'type'
]))
{
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
"Integer"
,
"BigInt"
,
"SmallInt"
)
))
{
if
(
in_array
((
string
)
$field
[
'type'
],
[
"Integer"
,
"BigInt"
,
"SmallInt"
]
))
{
$default
=
" DEFAULT "
.
$field
[
'default'
];
}
elseif
(
in_array
((
string
)
$field
[
'type'
],
array
(
'DateTime'
,
'DateTimeTz'
)
)
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
}
elseif
(
in_array
((
string
)
$field
[
'type'
],
[
'DateTime'
,
'DateTimeTz'
]
)
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
$default
=
" DEFAULT "
.
$this
->
getCurrentTimestampSQL
();
}
elseif
((
string
)
$field
[
'type'
]
==
'Time'
&&
$field
[
'default'
]
==
$this
->
getCurrentTimeSQL
())
{
$default
=
" DEFAULT "
.
$this
->
getCurrentTimeSQL
();
...
...
@@ -2306,7 +2306,7 @@ abstract class AbstractPlatform
*/
public
function
getCheckDeclarationSQL
(
array
$definition
)
{
$constraints
=
array
()
;
$constraints
=
[]
;
foreach
(
$definition
as
$field
=>
$def
)
{
if
(
is_string
(
$def
))
{
$constraints
[]
=
'CHECK ('
.
$def
.
')'
;
...
...
@@ -2398,7 +2398,7 @@ abstract class AbstractPlatform
*/
public
function
getIndexFieldDeclarationListSQL
(
array
$fields
)
{
$ret
=
array
()
;
$ret
=
[]
;
foreach
(
$fields
as
$field
=>
$definition
)
{
if
(
is_array
(
$definition
))
{
...
...
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
4f7c1b72
...
...
@@ -59,7 +59,7 @@ class DB2Platform extends AbstractPlatform
*/
public
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'smallint'
=>
'smallint'
,
'bigint'
=>
'bigint'
,
'integer'
=>
'integer'
,
...
...
@@ -75,7 +75,7 @@ class DB2Platform extends AbstractPlatform
'double'
=>
'float'
,
'real'
=>
'float'
,
'timestamp'
=>
'datetime'
,
)
;
]
;
}
/**
...
...
@@ -477,13 +477,13 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
[]
)
{
$indexes
=
array
()
;
$indexes
=
[]
;
if
(
isset
(
$options
[
'indexes'
]))
{
$indexes
=
$options
[
'indexes'
];
}
$options
[
'indexes'
]
=
array
()
;
$options
[
'indexes'
]
=
[]
;
$sqls
=
parent
::
_getCreateTableSQL
(
$tableName
,
$columns
,
$options
);
...
...
@@ -498,11 +498,11 @@ class DB2Platform extends AbstractPlatform
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$columnSql
=
array
()
;
$commentsSQL
=
array
()
;
$sql
=
[]
;
$columnSql
=
[]
;
$commentsSQL
=
[]
;
$queryParts
=
array
()
;
$queryParts
=
[]
;
foreach
(
$diff
->
addedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
...
...
@@ -571,7 +571,7 @@ class DB2Platform extends AbstractPlatform
' TO '
.
$column
->
getQuotedName
(
$this
);
}
$tableSql
=
array
()
;
$tableSql
=
[]
;
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
count
(
$queryParts
)
>
0
)
{
...
...
@@ -644,10 +644,10 @@ class DB2Platform extends AbstractPlatform
$alterClause
=
'ALTER COLUMN '
.
$columnDiff
->
column
->
getQuotedName
(
$this
);
if
(
$column
[
'columnDefinition'
])
{
return
array
(
$alterClause
.
' '
.
$column
[
'columnDefinition'
])
;
return
[
$alterClause
.
' '
.
$column
[
'columnDefinition'
]]
;
}
$clauses
=
array
()
;
$clauses
=
[]
;
if
(
$columnDiff
->
hasChanged
(
'type'
)
||
$columnDiff
->
hasChanged
(
'length'
)
||
...
...
@@ -682,7 +682,7 @@ class DB2Platform extends AbstractPlatform
*/
protected
function
getPreAlterTableIndexForeignKeySQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$sql
=
[]
;
$table
=
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
);
foreach
(
$diff
->
removedIndexes
as
$remKey
=>
$remIndex
)
{
...
...
@@ -721,7 +721,7 @@ class DB2Platform extends AbstractPlatform
$oldIndexName
=
$schema
.
'.'
.
$oldIndexName
;
}
return
array
(
'RENAME INDEX '
.
$oldIndexName
.
' TO '
.
$index
->
getQuotedName
(
$this
))
;
return
[
'RENAME INDEX '
.
$oldIndexName
.
' TO '
.
$index
->
getQuotedName
(
$this
)]
;
}
/**
...
...
@@ -771,7 +771,7 @@ class DB2Platform extends AbstractPlatform
*/
protected
function
doModifyLimitQuery
(
$query
,
$limit
,
$offset
=
null
)
{
$where
=
array
()
;
$where
=
[]
;
if
(
$offset
>
0
)
{
$where
[]
=
sprintf
(
'db22.DC_ROWNUM >= %d'
,
$offset
+
1
);
...
...
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
View file @
4f7c1b72
...
...
@@ -142,7 +142,7 @@ class DrizzlePlatform extends AbstractPlatform
*/
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'boolean'
=>
'boolean'
,
'varchar'
=>
'string'
,
'varbinary'
=>
'binary'
,
...
...
@@ -156,7 +156,7 @@ class DrizzlePlatform extends AbstractPlatform
'timestamp'
=>
'datetime'
,
'double'
=>
'float'
,
'bigint'
=>
'bigint'
,
)
;
]
;
}
/**
...
...
@@ -194,7 +194,7 @@ class DrizzlePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
[]
)
{
$queryFields
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
...
...
@@ -251,7 +251,7 @@ class DrizzlePlatform extends AbstractPlatform
return
$options
[
'table_options'
];
}
$tableOptions
=
array
()
;
$tableOptions
=
[]
;
// Collate
if
(
!
isset
(
$options
[
'collate'
]))
{
...
...
@@ -483,8 +483,8 @@ class DrizzlePlatform extends AbstractPlatform
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
$columnSql
=
array
()
;
$queryParts
=
array
()
;
$columnSql
=
[]
;
$queryParts
=
[]
;
if
(
$diff
->
newName
!==
false
)
{
$queryParts
[]
=
'RENAME TO '
.
$diff
->
getNewName
()
->
getQuotedName
(
$this
);
...
...
@@ -545,8 +545,8 @@ class DrizzlePlatform extends AbstractPlatform
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
}
$sql
=
array
()
;
$tableSql
=
array
()
;
$sql
=
[]
;
$tableSql
=
[]
;
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
count
(
$queryParts
)
>
0
)
{
...
...
lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
View file @
4f7c1b72
...
...
@@ -41,7 +41,7 @@ class DB2Keywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ACTIVATE'
,
'ADD'
,
'AFTER'
,
...
...
@@ -436,6 +436,6 @@ class DB2Keywords extends KeywordList
'LOCATORS'
,
'ROLLBACK'
,
'YEARS'
,
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php
View file @
4f7c1b72
...
...
@@ -39,7 +39,7 @@ class DrizzleKeywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ABS'
,
'ALL'
,
'ALLOCATE'
,
...
...
@@ -340,6 +340,6 @@ class DrizzleKeywords extends KeywordList
'XMLROOT'
,
'XMLSERIALIZE'
,
'YEAR'
,
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php
View file @
4f7c1b72
...
...
@@ -43,7 +43,7 @@ class MySQL57Keywords extends MySQLKeywords
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ACCESSIBLE'
,
'ADD'
,
'ALL'
,
...
...
@@ -279,6 +279,6 @@ class MySQL57Keywords extends MySQLKeywords
'XOR'
,
'YEAR_MONTH'
,
'ZEROFILL'
,
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php
View file @
4f7c1b72
...
...
@@ -42,7 +42,7 @@ class MySQLKeywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ACCESSIBLE'
,
'ADD'
,
'ALL'
,
...
...
@@ -282,6 +282,6 @@ class MySQLKeywords extends KeywordList
'XOR'
,
'YEAR_MONTH'
,
'ZEROFILL'
,
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php
View file @
4f7c1b72
...
...
@@ -42,7 +42,7 @@ class OracleKeywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ACCESS'
,
'ELSE'
,
'MODIFY'
,
...
...
@@ -156,6 +156,6 @@ class OracleKeywords extends KeywordList
'ROWS'
,
'WITH'
,
'RANGE'
,
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php
View file @
4f7c1b72
...
...
@@ -44,7 +44,7 @@ class PostgreSQL91Keywords extends PostgreSQLKeywords
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ALL'
,
'ANALYSE'
,
'ANALYZE'
,
...
...
@@ -143,6 +143,6 @@ class PostgreSQL91Keywords extends PostgreSQLKeywords
'WHERE'
,
'WINDOW'
,
'WITH'
,
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php
View file @
4f7c1b72
...
...
@@ -43,8 +43,8 @@ class PostgreSQL92Keywords extends PostgreSQL91Keywords
*/
protected
function
getKeywords
()
{
return
array_merge
(
parent
::
getKeywords
(),
array
(
return
array_merge
(
parent
::
getKeywords
(),
[
'COLLATION'
,
)
);
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php
View file @
4f7c1b72
...
...
@@ -43,12 +43,12 @@ class PostgreSQL94Keywords extends PostgreSQL92Keywords
*/
protected
function
getKeywords
()
{
$parentKeywords
=
array_diff
(
parent
::
getKeywords
(),
array
(
$parentKeywords
=
array_diff
(
parent
::
getKeywords
(),
[
'OVER'
,
)
);
]
);
return
array_merge
(
$parentKeywords
,
array
(
return
array_merge
(
$parentKeywords
,
[
'LATERAL'
,
)
);
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
View file @
4f7c1b72
...
...
@@ -42,7 +42,7 @@ class PostgreSQLKeywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ALL'
,
'ANALYSE'
,
'ANALYZE'
,
...
...
@@ -130,6 +130,6 @@ class PostgreSQLKeywords extends KeywordList
'VERBOSE'
,
'WHEN'
,
'WHERE'
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
View file @
4f7c1b72
...
...
@@ -32,12 +32,12 @@ class ReservedKeywordsValidator implements Visitor
/**
* @var KeywordList[]
*/
private
$keywordLists
=
array
()
;
private
$keywordLists
=
[]
;
/**
* @var array
*/
private
$violations
=
array
()
;
private
$violations
=
[]
;
/**
* @param \Doctrine\DBAL\Platforms\Keywords\KeywordList[] $keywordLists
...
...
@@ -66,7 +66,7 @@ class ReservedKeywordsValidator implements Visitor
$word
=
str_replace
(
'`'
,
''
,
$word
);
}
$keywordLists
=
array
()
;
$keywordLists
=
[]
;
foreach
(
$this
->
keywordLists
as
$keywordList
)
{
if
(
$keywordList
->
isKeyword
(
$word
))
{
$keywordLists
[]
=
$keywordList
->
getName
();
...
...
lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php
View file @
4f7c1b72
...
...
@@ -44,12 +44,12 @@ class SQLAnywhere11Keywords extends SQLAnywhereKeywords
return
array_merge
(
array_diff
(
parent
::
getKeywords
(),
array
(
'IQ'
)
[
'IQ'
]
),
array
(
[
'MERGE'
,
'OPENSTRING'
)
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php
View file @
4f7c1b72
...
...
@@ -44,21 +44,21 @@ class SQLAnywhere12Keywords extends SQLAnywhere11Keywords
return
array_merge
(
array_diff
(
parent
::
getKeywords
(),
array
(
[
'INDEX_LPAREN'
,
'SYNTAX_ERROR'
,
'WITH_CUBE'
,
'WITH_LPAREN'
,
'WITH_ROLLUP'
)
]
),
array
(
[
'DATETIMEOFFSET'
,
'LIMIT'
,
'OPENXML'
,
'SPATIAL'
,
'TREAT'
)
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php
View file @
4f7c1b72
...
...
@@ -43,14 +43,14 @@ class SQLAnywhere16Keywords extends SQLAnywhere12Keywords
{
return
array_merge
(
parent
::
getKeywords
(),
array
(
[
'ARRAY'
,
'JSON'
,
'ROW'
,
'ROWTYPE'
,
'UNNEST'
,
'VARRAY'
)
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php
View file @
4f7c1b72
...
...
@@ -41,7 +41,7 @@ class SQLAnywhereKeywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ADD'
,
'ALL'
,
'ALTER'
,
...
...
@@ -276,6 +276,6 @@ class SQLAnywhereKeywords extends KeywordList
'WORK'
,
'WRITETEXT'
,
'XML'
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php
View file @
4f7c1b72
...
...
@@ -44,13 +44,13 @@ class SQLServer2005Keywords extends SQLServerKeywords
*/
protected
function
getKeywords
()
{
return
array_merge
(
array_diff
(
parent
::
getKeywords
(),
array
(
'DUMMY'
)),
array
(
return
array_merge
(
array_diff
(
parent
::
getKeywords
(),
[
'DUMMY'
]),
[
'EXTERNAL'
,
'PIVOT'
,
'REVERT'
,
'SECURITYAUDIT'
,
'TABLESAMPLE'
,
'UNPIVOT'
)
);
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php
View file @
4f7c1b72
...
...
@@ -44,8 +44,8 @@ class SQLServer2008Keywords extends SQLServer2005Keywords
*/
protected
function
getKeywords
()
{
return
array_merge
(
parent
::
getKeywords
(),
array
(
return
array_merge
(
parent
::
getKeywords
(),
[
'MERGE'
)
);
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php
View file @
4f7c1b72
...
...
@@ -44,12 +44,12 @@ class SQLServer2012Keywords extends SQLServer2008Keywords
*/
protected
function
getKeywords
()
{
return
array_merge
(
parent
::
getKeywords
(),
array
(
return
array_merge
(
parent
::
getKeywords
(),
[
'SEMANTICKEYPHRASETABLE'
,
'SEMANTICSIMILARITYDETAILSTABLE'
,
'SEMANTICSIMILARITYTABLE'
,
'TRY_CONVERT'
,
'WITHIN GROUP'
)
);
]
);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php
View file @
4f7c1b72
...
...
@@ -46,7 +46,7 @@ class SQLServerKeywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ADD'
,
'ALL'
,
'ALTER'
,
...
...
@@ -226,6 +226,6 @@ class SQLServerKeywords extends KeywordList
'WHILE'
,
'WITH'
,
'WRITETEXT'
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php
View file @
4f7c1b72
...
...
@@ -41,7 +41,7 @@ class SQLiteKeywords extends KeywordList
*/
protected
function
getKeywords
()
{
return
array
(
return
[
'ABORT'
,
'ACTION'
,
'ADD'
,
...
...
@@ -163,6 +163,6 @@ class SQLiteKeywords extends KeywordList
'VIRTUAL'
,
'WHEN'
,
'WHERE'
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
View file @
4f7c1b72
...
...
@@ -54,7 +54,7 @@ class MySQL57Platform extends MySqlPlatform
*/
protected
function
getPreAlterTableRenameIndexForeignKeySQL
(
TableDiff
$diff
)
{
return
array
()
;
return
[]
;
}
/**
...
...
@@ -62,7 +62,7 @@ class MySQL57Platform extends MySqlPlatform
*/
protected
function
getPostAlterTableRenameIndexForeignKeySQL
(
TableDiff
$diff
)
{
return
array
()
;
return
[]
;
}
/**
...
...
@@ -70,9 +70,9 @@ class MySQL57Platform extends MySqlPlatform
*/
protected
function
getRenameIndexSQL
(
$oldIndexName
,
Index
$index
,
$tableName
)
{
return
array
(
return
[
'ALTER TABLE '
.
$tableName
.
' RENAME INDEX '
.
$oldIndexName
.
' TO '
.
$index
->
getQuotedName
(
$this
)
)
;
]
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
4f7c1b72
...
...
@@ -409,7 +409,7 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
[]
)
{
$queryFields
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
...
...
@@ -485,7 +485,7 @@ class MySqlPlatform extends AbstractPlatform
return
$options
[
'table_options'
];
}
$tableOptions
=
array
()
;
$tableOptions
=
[]
;
// Charset
if
(
!
isset
(
$options
[
'charset'
]))
{
...
...
@@ -547,8 +547,8 @@ class MySqlPlatform extends AbstractPlatform
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
$columnSql
=
array
()
;
$queryParts
=
array
()
;
$columnSql
=
[]
;
$queryParts
=
[]
;
if
(
$diff
->
newName
!==
false
)
{
$queryParts
[]
=
'RENAME TO '
.
$diff
->
getNewName
()
->
getQuotedName
(
$this
);
}
...
...
@@ -611,8 +611,8 @@ class MySqlPlatform extends AbstractPlatform
unset
(
$diff
->
addedIndexes
[
'primary'
]);
}
$sql
=
array
()
;
$tableSql
=
array
()
;
$sql
=
[]
;
$tableSql
=
[]
;
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
count
(
$queryParts
)
>
0
)
{
...
...
@@ -633,7 +633,7 @@ class MySqlPlatform extends AbstractPlatform
*/
protected
function
getPreAlterTableIndexForeignKeySQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$sql
=
[]
;
$table
=
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
);
foreach
(
$diff
->
changedIndexes
as
$changedIndex
)
{
...
...
@@ -676,9 +676,9 @@ class MySqlPlatform extends AbstractPlatform
// Suppress foreign key constraint propagation on non-supporting engines.
if
(
'INNODB'
!==
$engine
)
{
$diff
->
addedForeignKeys
=
array
()
;
$diff
->
changedForeignKeys
=
array
()
;
$diff
->
removedForeignKeys
=
array
()
;
$diff
->
addedForeignKeys
=
[]
;
$diff
->
changedForeignKeys
=
[]
;
$diff
->
removedForeignKeys
=
[]
;
}
$sql
=
array_merge
(
...
...
@@ -699,7 +699,7 @@ class MySqlPlatform extends AbstractPlatform
*/
private
function
getPreAlterTableAlterPrimaryKeySQL
(
TableDiff
$diff
,
Index
$index
)
{
$sql
=
array
()
;
$sql
=
[]
;
if
(
!
$index
->
isPrimary
()
||
!
$diff
->
fromTable
instanceof
Table
)
{
return
$sql
;
...
...
@@ -736,7 +736,7 @@ class MySqlPlatform extends AbstractPlatform
*/
private
function
getPreAlterTableAlterIndexForeignKeySQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$sql
=
[]
;
$table
=
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
);
foreach
(
$diff
->
changedIndexes
as
$changedIndex
)
{
...
...
@@ -772,7 +772,7 @@ class MySqlPlatform extends AbstractPlatform
*/
protected
function
getPreAlterTableRenameIndexForeignKeySQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$sql
=
[]
;
$tableName
=
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
);
foreach
(
$this
->
getRemainingForeignKeyConstraintsRequiringRenamedIndexes
(
$diff
)
as
$foreignKey
)
{
...
...
@@ -797,10 +797,10 @@ class MySqlPlatform extends AbstractPlatform
private
function
getRemainingForeignKeyConstraintsRequiringRenamedIndexes
(
TableDiff
$diff
)
{
if
(
empty
(
$diff
->
renamedIndexes
)
||
!
$diff
->
fromTable
instanceof
Table
)
{
return
array
()
;
return
[]
;
}
$foreignKeys
=
array
()
;
$foreignKeys
=
[]
;
/** @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[] $remainingForeignKeys */
$remainingForeignKeys
=
array_diff_key
(
$diff
->
fromTable
->
getForeignKeys
(),
...
...
@@ -838,7 +838,7 @@ class MySqlPlatform extends AbstractPlatform
*/
protected
function
getPostAlterTableRenameIndexForeignKeySQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$sql
=
[]
;
$tableName
=
(
false
!==
$diff
->
newName
)
?
$diff
->
getNewName
()
->
getQuotedName
(
$this
)
:
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
);
...
...
@@ -1015,7 +1015,7 @@ class MySqlPlatform extends AbstractPlatform
*/
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'tinyint'
=>
'boolean'
,
'smallint'
=>
'smallint'
,
'mediumint'
=>
'integer'
,
...
...
@@ -1046,7 +1046,7 @@ class MySqlPlatform extends AbstractPlatform
'binary'
=>
'binary'
,
'varbinary'
=>
'binary'
,
'set'
=>
'simple_array'
,
)
;
]
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
4f7c1b72
...
...
@@ -384,10 +384,10 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$table
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$table
,
array
$columns
,
array
$options
=
[]
)
{
$indexes
=
isset
(
$options
[
'indexes'
])
?
$options
[
'indexes'
]
:
array
()
;
$options
[
'indexes'
]
=
array
()
;
$indexes
=
isset
(
$options
[
'indexes'
])
?
$options
[
'indexes'
]
:
[]
;
$options
[
'indexes'
]
=
[]
;
$sql
=
parent
::
_getCreateTableSQL
(
$table
,
$columns
,
$options
);
foreach
(
$columns
as
$name
=>
$column
)
{
...
...
@@ -499,11 +499,11 @@ class OraclePlatform extends AbstractPlatform
$quotedName
=
$nameIdentifier
->
getQuotedName
(
$this
);
$unquotedName
=
$nameIdentifier
->
getName
();
$sql
=
array
()
;
$sql
=
[]
;
$autoincrementIdentifierName
=
$this
->
getAutoincrementIdentifierName
(
$tableIdentifier
);
$idx
=
new
Index
(
$autoincrementIdentifierName
,
array
(
$quotedName
)
,
true
,
true
);
$idx
=
new
Index
(
$autoincrementIdentifierName
,
[
$quotedName
]
,
true
,
true
);
$sql
[]
=
'DECLARE
constraints_Count NUMBER;
...
...
@@ -562,11 +562,11 @@ END;';
''
);
return
array
(
return
[
'DROP TRIGGER '
.
$autoincrementIdentifierName
,
$this
->
getDropSequenceSQL
(
$identitySequenceName
),
$this
->
getDropConstraintSQL
(
$autoincrementIdentifierName
,
$table
->
getQuotedName
(
$this
)),
)
;
]
;
}
/**
...
...
@@ -764,11 +764,11 @@ END;';
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$commentsSQL
=
array
()
;
$columnSql
=
array
()
;
$sql
=
[]
;
$commentsSQL
=
[]
;
$columnSql
=
[]
;
$fields
=
array
()
;
$fields
=
[]
;
foreach
(
$diff
->
addedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
...
...
@@ -789,7 +789,7 @@ END;';
$sql
[]
=
'ALTER TABLE '
.
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
)
.
' ADD ('
.
implode
(
', '
,
$fields
)
.
')'
;
}
$fields
=
array
()
;
$fields
=
[]
;
foreach
(
$diff
->
changedColumns
as
$columnDiff
)
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
continue
;
...
...
@@ -847,7 +847,7 @@ END;';
' RENAME COLUMN '
.
$oldColumnName
->
getQuotedName
(
$this
)
.
' TO '
.
$column
->
getQuotedName
(
$this
);
}
$fields
=
array
()
;
$fields
=
[]
;
foreach
(
$diff
->
removedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
...
...
@@ -860,7 +860,7 @@ END;';
$sql
[]
=
'ALTER TABLE '
.
$diff
->
getName
(
$this
)
->
getQuotedName
(
$this
)
.
' DROP ('
.
implode
(
', '
,
$fields
)
.
')'
;
}
$tableSql
=
array
()
;
$tableSql
=
[]
;
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
$sql
=
array_merge
(
$sql
,
$commentsSQL
);
...
...
@@ -918,7 +918,7 @@ END;';
$oldIndexName
=
$schema
.
'.'
.
$oldIndexName
;
}
return
array
(
'ALTER INDEX '
.
$oldIndexName
.
' RENAME TO '
.
$index
->
getQuotedName
(
$this
))
;
return
[
'ALTER INDEX '
.
$oldIndexName
.
' RENAME TO '
.
$index
->
getQuotedName
(
$this
)]
;
}
/**
...
...
@@ -986,7 +986,7 @@ END;';
$query
.=
" FROM dual"
;
}
$columns
=
array
(
'a.*'
)
;
$columns
=
[
'a.*'
]
;
if
(
$offset
>
0
)
{
$columns
[]
=
'ROWNUM AS doctrine_rownum'
;
...
...
@@ -1116,7 +1116,7 @@ END;';
*/
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'integer'
=>
'integer'
,
'number'
=>
'integer'
,
'pls_integer'
=>
'boolean'
,
...
...
@@ -1140,7 +1140,7 @@ END;';
'rowid'
=>
'string'
,
'urowid'
=>
'string'
,
'blob'
=>
'blob'
,
)
;
]
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
4f7c1b72
...
...
@@ -47,24 +47,24 @@ class PostgreSqlPlatform extends AbstractPlatform
/**
* @var array PostgreSQL booleans literals
*/
private
$booleanLiterals
=
array
(
'true'
=>
array
(
private
$booleanLiterals
=
[
'true'
=>
[
't'
,
'true'
,
'y'
,
'yes'
,
'on'
,
'1'
)
,
'false'
=>
array
(
]
,
'false'
=>
[
'f'
,
'false'
,
'n'
,
'no'
,
'off'
,
'0'
)
)
;
]
]
;
/**
* PostgreSQL has different behavior with some drivers
...
...
@@ -486,9 +486,9 @@ class PostgreSqlPlatform extends AbstractPlatform
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$commentsSQL
=
array
()
;
$columnSql
=
array
()
;
$sql
=
[]
;
$commentsSQL
=
[]
;
$columnSql
=
[]
;
foreach
(
$diff
->
addedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
...
...
@@ -593,7 +593,7 @@ class PostgreSqlPlatform extends AbstractPlatform
' RENAME COLUMN '
.
$oldColumnName
->
getQuotedName
(
$this
)
.
' TO '
.
$column
->
getQuotedName
(
$this
);
}
$tableSql
=
array
()
;
$tableSql
=
[]
;
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
$sql
=
array_merge
(
$sql
,
$commentsSQL
);
...
...
@@ -643,14 +643,14 @@ class PostgreSqlPlatform extends AbstractPlatform
return
false
;
}
return
count
(
array_diff
(
$columnDiff
->
changedProperties
,
array
(
'type'
,
'length'
,
'fixed'
)
))
===
0
;
return
count
(
array_diff
(
$columnDiff
->
changedProperties
,
[
'type'
,
'length'
,
'fixed'
]
))
===
0
;
}
if
(
$columnDiff
->
hasChanged
(
'type'
))
{
return
false
;
}
return
count
(
array_diff
(
$columnDiff
->
changedProperties
,
array
(
'length'
,
'fixed'
)
))
===
0
;
return
count
(
array_diff
(
$columnDiff
->
changedProperties
,
[
'length'
,
'fixed'
]
))
===
0
;
}
/**
...
...
@@ -663,7 +663,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$oldIndexName
=
$schema
.
'.'
.
$oldIndexName
;
}
return
array
(
'ALTER INDEX '
.
$oldIndexName
.
' RENAME TO '
.
$index
->
getQuotedName
(
$this
))
;
return
[
'ALTER INDEX '
.
$oldIndexName
.
' RENAME TO '
.
$index
->
getQuotedName
(
$this
)]
;
}
/**
...
...
@@ -748,7 +748,7 @@ class PostgreSqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
[]
)
{
$queryFields
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
...
...
@@ -1094,7 +1094,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'smallint'
=>
'smallint'
,
'int2'
=>
'smallint'
,
'serial'
=>
'integer'
,
...
...
@@ -1134,7 +1134,7 @@ class PostgreSqlPlatform extends AbstractPlatform
'year'
=>
'date'
,
'uuid'
=>
'guid'
,
'bytea'
=>
'blob'
,
)
;
]
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
4f7c1b72
...
...
@@ -127,11 +127,11 @@ class SQLAnywherePlatform extends AbstractPlatform
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
$sql
=
array
()
;
$columnSql
=
array
()
;
$commentsSQL
=
array
()
;
$tableSql
=
array
()
;
$alterClauses
=
array
()
;
$sql
=
[]
;
$columnSql
=
[]
;
$commentsSQL
=
[]
;
$tableSql
=
[]
;
$alterClauses
=
[]
;
/** @var \Doctrine\DBAL\Schema\Column $column */
foreach
(
$diff
->
addedColumns
as
$column
)
{
...
...
@@ -1221,10 +1221,10 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
[]
)
{
$columnListSql
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
$indexSql
=
array
()
;
$indexSql
=
[]
;
if
(
!
empty
(
$options
[
'uniqueConstraints'
]))
{
foreach
((
array
)
$options
[
'uniqueConstraints'
]
as
$name
=>
$definition
)
{
...
...
@@ -1264,7 +1264,7 @@ class SQLAnywherePlatform extends AbstractPlatform
$query
.=
')'
;
return
array_merge
(
array
(
$query
)
,
$indexSql
);
return
array_merge
(
[
$query
]
,
$indexSql
);
}
/**
...
...
@@ -1419,9 +1419,9 @@ class SQLAnywherePlatform extends AbstractPlatform
*/
protected
function
getRenameIndexSQL
(
$oldIndexName
,
Index
$index
,
$tableName
)
{
return
array
(
return
[
'ALTER INDEX '
.
$oldIndexName
.
' ON '
.
$tableName
.
' RENAME TO '
.
$index
->
getQuotedName
(
$this
)
)
;
]
;
}
/**
...
...
@@ -1447,7 +1447,7 @@ class SQLAnywherePlatform extends AbstractPlatform
*/
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'char'
=>
'string'
,
'long nvarchar'
=>
'text'
,
'long varchar'
=>
'text'
,
...
...
@@ -1486,6 +1486,6 @@ class SQLAnywherePlatform extends AbstractPlatform
'long binary'
=>
'blob'
,
'uniqueidentifier'
=>
'guid'
,
'varbinary'
=>
'binary'
,
)
;
]
;
}
}
lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
View file @
4f7c1b72
...
...
@@ -116,7 +116,7 @@ class SQLServer2012Platform extends SQLServer2008Platform
// Queries using OFFSET... FETCH MUST have an ORDER BY clause
// Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement
// but can be in a newline
$matches
=
array
()
;
$matches
=
[]
;
$matchesCount
=
preg_match_all
(
"/[
\\
s]+order
\\
s+by
\\
s/im"
,
$query
,
$matches
,
PREG_OFFSET_CAPTURE
);
$orderByPos
=
false
;
if
(
$matchesCount
>
0
)
{
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
4f7c1b72
...
...
@@ -231,10 +231,10 @@ class SQLServerPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$tableName
,
array
$columns
,
array
$options
=
[]
)
{
$defaultConstraintsSql
=
array
()
;
$commentsSql
=
array
()
;
$defaultConstraintsSql
=
[]
;
$commentsSql
=
[]
;
// @todo does other code breaks because of this?
// force primary keys to be not null
...
...
@@ -419,7 +419,7 @@ class SQLServerPlatform extends AbstractPlatform
*/
private
function
_appendUniqueConstraintDefinition
(
$sql
,
Index
$index
)
{
$fields
=
array
()
;
$fields
=
[]
;
foreach
(
$index
->
getQuotedColumns
(
$this
)
as
$field
)
{
$fields
[]
=
$field
.
' IS NOT NULL'
;
...
...
@@ -433,10 +433,10 @@ class SQLServerPlatform extends AbstractPlatform
*/
public
function
getAlterTableSQL
(
TableDiff
$diff
)
{
$queryParts
=
array
()
;
$sql
=
array
()
;
$columnSql
=
array
()
;
$commentsSql
=
array
()
;
$queryParts
=
[]
;
$sql
=
[]
;
$columnSql
=
[]
;
$commentsSql
=
[]
;
/** @var \Doctrine\DBAL\Schema\Column $column */
foreach
(
$diff
->
addedColumns
as
$column
)
{
...
...
@@ -548,7 +548,7 @@ class SQLServerPlatform extends AbstractPlatform
}
}
$tableSql
=
array
()
;
$tableSql
=
[]
;
if
(
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
return
array_merge
(
$tableSql
,
$columnSql
);
...
...
@@ -725,14 +725,14 @@ class SQLServerPlatform extends AbstractPlatform
*/
protected
function
getRenameIndexSQL
(
$oldIndexName
,
Index
$index
,
$tableName
)
{
return
array
(
return
[
sprintf
(
"EXEC sp_RENAME N'%s.%s', N'%s', N'INDEX'"
,
$tableName
,
$oldIndexName
,
$index
->
getQuotedName
(
$this
)
)
)
;
]
;
}
/**
...
...
@@ -1413,7 +1413,7 @@ class SQLServerPlatform extends AbstractPlatform
*/
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'bigint'
=>
'bigint'
,
'numeric'
=>
'decimal'
,
'bit'
=>
'boolean'
,
...
...
@@ -1439,7 +1439,7 @@ class SQLServerPlatform extends AbstractPlatform
'varbinary'
=>
'binary'
,
'image'
=>
'blob'
,
'uniqueidentifier'
=>
'guid'
,
)
;
]
;
}
/**
...
...
@@ -1554,11 +1554,11 @@ class SQLServerPlatform extends AbstractPlatform
return
" DEFAULT '"
.
$field
[
'default'
]
.
"'"
;
}
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
'Integer'
,
'BigInt'
,
'SmallInt'
)
))
{
if
(
in_array
((
string
)
$field
[
'type'
],
[
'Integer'
,
'BigInt'
,
'SmallInt'
]
))
{
return
" DEFAULT "
.
$field
[
'default'
];
}
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
'DateTime'
,
'DateTimeTz'
)
)
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
if
(
in_array
((
string
)
$field
[
'type'
],
[
'DateTime'
,
'DateTimeTz'
]
)
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
return
" DEFAULT "
.
$this
->
getCurrentTimestampSQL
();
}
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
4f7c1b72
...
...
@@ -315,7 +315,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$name
,
array
$columns
,
array
$options
=
array
()
)
protected
function
_getCreateTableSQL
(
$name
,
array
$columns
,
array
$options
=
[]
)
{
$name
=
str_replace
(
'.'
,
'__'
,
$name
);
$queryFields
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
...
...
@@ -592,7 +592,7 @@ class SqlitePlatform extends AbstractPlatform
*/
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
$this
->
doctrineTypeMapping
=
[
'boolean'
=>
'boolean'
,
'tinyint'
=>
'boolean'
,
'smallint'
=>
'smallint'
,
...
...
@@ -625,7 +625,7 @@ class SqlitePlatform extends AbstractPlatform
'decimal'
=>
'decimal'
,
'numeric'
=>
'decimal'
,
'blob'
=>
'blob'
,
)
;
]
;
}
/**
...
...
@@ -645,7 +645,7 @@ class SqlitePlatform extends AbstractPlatform
throw
new
DBALException
(
'Sqlite platform requires for alter table the table diff with reference to original table schema'
);
}
$sql
=
array
()
;
$sql
=
[]
;
foreach
(
$diff
->
fromTable
->
getIndexes
()
as
$index
)
{
if
(
!
$index
->
isPrimary
())
{
$sql
[]
=
$this
->
getDropIndexSQL
(
$index
,
$diff
->
name
);
...
...
@@ -664,7 +664,7 @@ class SqlitePlatform extends AbstractPlatform
throw
new
DBALException
(
'Sqlite platform requires for alter table the table diff with reference to original table schema'
);
}
$sql
=
array
()
;
$sql
=
[]
;
$tableName
=
$diff
->
newName
?
$diff
->
getNewName
()
:
$diff
->
getName
(
$this
);
foreach
(
$this
->
getIndexesInAlteredTable
(
$diff
)
as
$index
)
{
if
(
$index
->
isPrimary
())
{
...
...
@@ -799,10 +799,10 @@ class SqlitePlatform extends AbstractPlatform
$table
=
clone
$fromTable
;
$columns
=
array
()
;
$oldColumnNames
=
array
()
;
$newColumnNames
=
array
()
;
$columnSql
=
array
()
;
$columns
=
[]
;
$oldColumnNames
=
[]
;
$newColumnNames
=
[]
;
$columnSql
=
[]
;
foreach
(
$table
->
getColumns
()
as
$columnName
=>
$column
)
{
$columnName
=
strtolower
(
$columnName
);
...
...
@@ -864,8 +864,8 @@ class SqlitePlatform extends AbstractPlatform
$columns
[
strtolower
(
$columnName
)]
=
$column
;
}
$sql
=
array
()
;
$tableSql
=
array
()
;
$sql
=
[]
;
$tableSql
=
[]
;
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
$dataTable
=
new
Table
(
'__temp__'
.
$table
->
getName
());
...
...
@@ -932,16 +932,16 @@ class SqlitePlatform extends AbstractPlatform
$table
=
new
Table
(
$diff
->
name
);
$sql
=
array
()
;
$tableSql
=
array
()
;
$columnSql
=
array
()
;
$sql
=
[]
;
$tableSql
=
[]
;
$columnSql
=
[]
;
foreach
(
$diff
->
addedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
}
$field
=
array_merge
(
array
(
'unique'
=>
null
,
'autoincrement'
=>
null
,
'default'
=>
null
)
,
$column
->
toArray
());
$field
=
array_merge
(
[
'unique'
=>
null
,
'autoincrement'
=>
null
,
'default'
=>
null
]
,
$column
->
toArray
());
$type
=
(
string
)
$field
[
'type'
];
switch
(
true
)
{
case
isset
(
$field
[
'columnDefinition'
])
||
$field
[
'autoincrement'
]
||
$field
[
'unique'
]
:
...
...
@@ -976,7 +976,7 @@ class SqlitePlatform extends AbstractPlatform
*/
private
function
getColumnNamesInAlteredTable
(
TableDiff
$diff
)
{
$columns
=
array
()
;
$columns
=
[]
;
foreach
(
$diff
->
fromTable
->
getColumns
()
as
$columnName
=>
$column
)
{
$columns
[
strtolower
(
$columnName
)]
=
$column
->
getName
();
...
...
@@ -1026,7 +1026,7 @@ class SqlitePlatform extends AbstractPlatform
}
$changed
=
false
;
$indexColumns
=
array
()
;
$indexColumns
=
[]
;
foreach
(
$index
->
getColumns
()
as
$columnName
)
{
$normalizedColumnName
=
strtolower
(
$columnName
);
if
(
!
isset
(
$columnNames
[
$normalizedColumnName
]))
{
...
...
@@ -1076,7 +1076,7 @@ class SqlitePlatform extends AbstractPlatform
foreach
(
$foreignKeys
as
$key
=>
$constraint
)
{
$changed
=
false
;
$localColumns
=
array
()
;
$localColumns
=
[]
;
foreach
(
$constraint
->
getLocalColumns
()
as
$columnName
)
{
$normalizedColumnName
=
strtolower
(
$columnName
);
if
(
!
isset
(
$columnNames
[
$normalizedColumnName
]))
{
...
...
@@ -1121,11 +1121,11 @@ class SqlitePlatform extends AbstractPlatform
*/
private
function
getPrimaryIndexInAlteredTable
(
TableDiff
$diff
)
{
$primaryIndex
=
array
()
;
$primaryIndex
=
[]
;
foreach
(
$this
->
getIndexesInAlteredTable
(
$diff
)
as
$index
)
{
if
(
$index
->
isPrimary
())
{
$primaryIndex
=
array
(
$index
->
getName
()
=>
$index
)
;
$primaryIndex
=
[
$index
->
getName
()
=>
$index
]
;
}
}
...
...
lib/Doctrine/DBAL/Portability/Connection.php
View file @
4f7c1b72
...
...
@@ -115,7 +115,7 @@ class Connection extends \Doctrine\DBAL\Connection
/**
* {@inheritdoc}
*/
public
function
executeQuery
(
$query
,
array
$params
=
array
(),
$types
=
array
()
,
QueryCacheProfile
$qcp
=
null
)
public
function
executeQuery
(
$query
,
array
$params
=
[],
$types
=
[]
,
QueryCacheProfile
$qcp
=
null
)
{
$stmt
=
new
Statement
(
parent
::
executeQuery
(
$query
,
$params
,
$types
,
$qcp
),
$this
);
$stmt
->
setFetchMode
(
$this
->
defaultFetchMode
);
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
4f7c1b72
...
...
@@ -177,7 +177,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
if
(
$fetchMode
===
PDO
::
FETCH_COLUMN
)
{
foreach
(
$rows
as
$num
=>
$row
)
{
$rows
[
$num
]
=
array
(
$row
)
;
$rows
[
$num
]
=
[
$row
]
;
}
}
...
...
lib/Doctrine/DBAL/Query/QueryBuilder.php
View file @
4f7c1b72
...
...
@@ -420,7 +420,7 @@ class QueryBuilder
$isMultiple
=
is_array
(
$this
->
sqlParts
[
$sqlPartName
]);
if
(
$isMultiple
&&
!
$isArray
)
{
$sqlPart
=
array
(
$sqlPart
)
;
$sqlPart
=
[
$sqlPart
]
;
}
$this
->
state
=
self
::
STATE_DIRTY
;
...
...
@@ -1093,7 +1093,7 @@ class QueryBuilder
public
function
resetQueryPart
(
$queryPartName
)
{
$this
->
sqlParts
[
$queryPartName
]
=
is_array
(
$this
->
sqlParts
[
$queryPartName
])
?
array
()
:
null
;
?
[]
:
null
;
$this
->
state
=
self
::
STATE_DIRTY
;
...
...
@@ -1131,8 +1131,8 @@ class QueryBuilder
*/
private
function
getFromClauses
()
{
$fromClauses
=
array
()
;
$knownAliases
=
array
()
;
$fromClauses
=
[]
;
$knownAliases
=
[]
;
// Loop through all FROM clauses
foreach
(
$this
->
sqlParts
[
'from'
]
as
$from
)
{
...
...
lib/Doctrine/DBAL/SQLParserUtils.php
View file @
4f7c1b72
...
...
@@ -52,11 +52,11 @@ class SQLParserUtils
{
$match
=
(
$isPositional
)
?
'?'
:
':'
;
if
(
strpos
(
$statement
,
$match
)
===
false
)
{
return
array
()
;
return
[]
;
}
$token
=
(
$isPositional
)
?
self
::
POSITIONAL_TOKEN
:
self
::
NAMED_TOKEN
;
$paramMap
=
array
()
;
$paramMap
=
[]
;
foreach
(
self
::
getUnquotedStatementFragments
(
$statement
)
as
$fragment
)
{
preg_match_all
(
"/
$token
/"
,
$fragment
[
0
],
$matches
,
PREG_OFFSET_CAPTURE
);
...
...
@@ -87,7 +87,7 @@ class SQLParserUtils
public
static
function
expandListParameters
(
$query
,
$params
,
$types
)
{
$isPositional
=
is_int
(
key
(
$params
));
$arrayPositions
=
array
()
;
$arrayPositions
=
[]
;
$bindIndex
=
-
1
;
if
(
$isPositional
)
{
...
...
@@ -110,7 +110,7 @@ class SQLParserUtils
}
if
((
!
$arrayPositions
&&
$isPositional
))
{
return
array
(
$query
,
$params
,
$types
)
;
return
[
$query
,
$params
,
$types
]
;
}
$paramPos
=
self
::
getPlaceholderPositions
(
$query
,
$isPositional
);
...
...
@@ -140,7 +140,7 @@ class SQLParserUtils
array_slice
(
$types
,
0
,
$needle
),
$count
?
array_fill
(
0
,
$count
,
$types
[
$needle
]
-
Connection
::
ARRAY_PARAM_OFFSET
)
:
// array needles are at PDO::PARAM_* + 100
array
()
,
[]
,
array_slice
(
$types
,
$needle
+
1
)
);
...
...
@@ -151,12 +151,12 @@ class SQLParserUtils
$queryOffset
+=
(
strlen
(
$expandStr
)
-
1
);
}
return
array
(
$query
,
$params
,
$types
)
;
return
[
$query
,
$params
,
$types
]
;
}
$queryOffset
=
0
;
$typesOrd
=
array
()
;
$paramsOrd
=
array
()
;
$typesOrd
=
[]
;
$paramsOrd
=
[]
;
foreach
(
$paramPos
as
$pos
=>
$paramName
)
{
$paramLen
=
strlen
(
$paramName
)
+
1
;
...
...
@@ -185,7 +185,7 @@ class SQLParserUtils
$query
=
substr
(
$query
,
0
,
$pos
)
.
$expandStr
.
substr
(
$query
,
(
$pos
+
$paramLen
));
}
return
array
(
$query
,
$paramsOrd
,
$typesOrd
)
;
return
[
$query
,
$paramsOrd
,
$typesOrd
]
;
}
/**
...
...
lib/Doctrine/DBAL/Schema/AbstractAsset.php
View file @
4f7c1b72
...
...
@@ -167,7 +167,7 @@ abstract class AbstractAsset
*/
protected
function
trimQuotes
(
$identifier
)
{
return
str_replace
(
array
(
'`'
,
'"'
,
'['
,
']'
)
,
''
,
$identifier
);
return
str_replace
(
[
'`'
,
'"'
,
'['
,
']'
]
,
''
,
$identifier
);
}
/**
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
4f7c1b72
...
...
@@ -94,7 +94,7 @@ abstract class AbstractSchemaManager
$args
=
array_values
(
$args
);
try
{
return
call_user_func_array
(
array
(
$this
,
$method
)
,
$args
);
return
call_user_func_array
(
[
$this
,
$method
]
,
$args
);
}
catch
(
\Exception
$e
)
{
return
false
;
}
...
...
@@ -263,7 +263,7 @@ abstract class AbstractSchemaManager
{
$tableNames
=
$this
->
listTableNames
();
$tables
=
array
()
;
$tables
=
[]
;
foreach
(
$tableNames
as
$tableName
)
{
$tables
[]
=
$this
->
listTableDetails
(
$tableName
);
}
...
...
@@ -279,13 +279,13 @@ abstract class AbstractSchemaManager
public
function
listTableDetails
(
$tableName
)
{
$columns
=
$this
->
listTableColumns
(
$tableName
);
$foreignKeys
=
array
()
;
$foreignKeys
=
[]
;
if
(
$this
->
_platform
->
supportsForeignKeyConstraints
())
{
$foreignKeys
=
$this
->
listTableForeignKeys
(
$tableName
);
}
$indexes
=
$this
->
listTableIndexes
(
$tableName
);
return
new
Table
(
$tableName
,
$columns
,
$indexes
,
$foreignKeys
,
false
,
array
()
);
return
new
Table
(
$tableName
,
$columns
,
$indexes
,
$foreignKeys
,
false
,
[]
);
}
/**
...
...
@@ -655,7 +655,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableDatabasesList
(
$databases
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$databases
as
$value
)
{
if
(
$value
=
$this
->
_getPortableDatabaseDefinition
(
$value
))
{
$list
[]
=
$value
;
...
...
@@ -674,7 +674,7 @@ abstract class AbstractSchemaManager
*/
protected
function
getPortableNamespacesList
(
array
$namespaces
)
{
$namespacesList
=
array
()
;
$namespacesList
=
[]
;
foreach
(
$namespaces
as
$namespace
)
{
$namespacesList
[]
=
$this
->
getPortableNamespaceDefinition
(
$namespace
);
...
...
@@ -712,7 +712,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableFunctionsList
(
$functions
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$functions
as
$value
)
{
if
(
$value
=
$this
->
_getPortableFunctionDefinition
(
$value
))
{
$list
[]
=
$value
;
...
...
@@ -739,7 +739,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableTriggersList
(
$triggers
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$triggers
as
$value
)
{
if
(
$value
=
$this
->
_getPortableTriggerDefinition
(
$value
))
{
$list
[]
=
$value
;
...
...
@@ -766,7 +766,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableSequencesList
(
$sequences
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$sequences
as
$value
)
{
if
(
$value
=
$this
->
_getPortableSequenceDefinition
(
$value
))
{
$list
[]
=
$value
;
...
...
@@ -803,7 +803,7 @@ abstract class AbstractSchemaManager
{
$eventManager
=
$this
->
_platform
->
getEventManager
();
$list
=
array
()
;
$list
=
[]
;
foreach
(
$tableColumns
as
$tableColumn
)
{
$column
=
null
;
$defaultPrevented
=
false
;
...
...
@@ -848,7 +848,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableTableIndexesList
(
$tableIndexRows
,
$tableName
=
null
)
{
$result
=
array
()
;
$result
=
[]
;
foreach
(
$tableIndexRows
as
$tableIndex
)
{
$indexName
=
$keyName
=
$tableIndex
[
'key_name'
];
if
(
$tableIndex
[
'primary'
])
{
...
...
@@ -857,14 +857,14 @@ abstract class AbstractSchemaManager
$keyName
=
strtolower
(
$keyName
);
if
(
!
isset
(
$result
[
$keyName
]))
{
$result
[
$keyName
]
=
array
(
$result
[
$keyName
]
=
[
'name'
=>
$indexName
,
'columns'
=>
array
(
$tableIndex
[
'column_name'
])
,
'columns'
=>
[
$tableIndex
[
'column_name'
]]
,
'unique'
=>
$tableIndex
[
'non_unique'
]
?
false
:
true
,
'primary'
=>
$tableIndex
[
'primary'
],
'flags'
=>
isset
(
$tableIndex
[
'flags'
])
?
$tableIndex
[
'flags'
]
:
array
()
,
'options'
=>
isset
(
$tableIndex
[
'where'
])
?
array
(
'where'
=>
$tableIndex
[
'where'
])
:
array
()
,
)
;
'flags'
=>
isset
(
$tableIndex
[
'flags'
])
?
$tableIndex
[
'flags'
]
:
[]
,
'options'
=>
isset
(
$tableIndex
[
'where'
])
?
[
'where'
=>
$tableIndex
[
'where'
]]
:
[]
,
]
;
}
else
{
$result
[
$keyName
][
'columns'
][]
=
$tableIndex
[
'column_name'
];
}
...
...
@@ -872,7 +872,7 @@ abstract class AbstractSchemaManager
$eventManager
=
$this
->
_platform
->
getEventManager
();
$indexes
=
array
()
;
$indexes
=
[]
;
foreach
(
$result
as
$indexKey
=>
$data
)
{
$index
=
null
;
$defaultPrevented
=
false
;
...
...
@@ -904,7 +904,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableTablesList
(
$tables
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$tables
as
$value
)
{
if
(
$value
=
$this
->
_getPortableTableDefinition
(
$value
))
{
$list
[]
=
$value
;
...
...
@@ -931,7 +931,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableUsersList
(
$users
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$users
as
$value
)
{
if
(
$value
=
$this
->
_getPortableUserDefinition
(
$value
))
{
$list
[]
=
$value
;
...
...
@@ -958,7 +958,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableViewsList
(
$views
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$views
as
$value
)
{
if
(
$view
=
$this
->
_getPortableViewDefinition
(
$value
))
{
$viewName
=
strtolower
(
$view
->
getQuotedName
(
$this
->
_platform
));
...
...
@@ -986,7 +986,7 @@ abstract class AbstractSchemaManager
*/
protected
function
_getPortableTableForeignKeysList
(
$tableForeignKeys
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$tableForeignKeys
as
$value
)
{
if
(
$value
=
$this
->
_getPortableTableForeignKeyDefinition
(
$value
))
{
$list
[]
=
$value
;
...
...
@@ -1025,13 +1025,13 @@ abstract class AbstractSchemaManager
*/
public
function
createSchema
()
{
$namespaces
=
array
()
;
$namespaces
=
[]
;
if
(
$this
->
_platform
->
supportsSchemas
())
{
$namespaces
=
$this
->
listNamespaceNames
();
}
$sequences
=
array
()
;
$sequences
=
[]
;
if
(
$this
->
_platform
->
supportsSequences
())
{
$sequences
=
$this
->
listSequences
();
...
...
@@ -1079,7 +1079,7 @@ abstract class AbstractSchemaManager
*/
public
function
getSchemaSearchPaths
()
{
return
array
(
$this
->
_conn
->
getDatabase
())
;
return
[
$this
->
_conn
->
getDatabase
()]
;
}
/**
...
...
lib/Doctrine/DBAL/Schema/Column.php
View file @
4f7c1b72
...
...
@@ -78,7 +78,7 @@ class Column extends AbstractAsset
/**
* @var array
*/
protected
$_platformOptions
=
array
()
;
protected
$_platformOptions
=
[]
;
/**
* @var string|null
...
...
@@ -93,7 +93,7 @@ class Column extends AbstractAsset
/**
* @var array
*/
protected
$_customSchemaOptions
=
array
()
;
protected
$_customSchemaOptions
=
[]
;
/**
* Creates a new Column.
...
...
@@ -102,7 +102,7 @@ class Column extends AbstractAsset
* @param Type $type
* @param array $options
*/
public
function
__construct
(
$columnName
,
Type
$type
,
array
$options
=
array
()
)
public
function
__construct
(
$columnName
,
Type
$type
,
array
$options
=
[]
)
{
$this
->
_setName
(
$columnName
);
$this
->
setType
(
$type
);
...
...
@@ -469,7 +469,7 @@ class Column extends AbstractAsset
*/
public
function
toArray
()
{
return
array_merge
(
array
(
return
array_merge
(
[
'name'
=>
$this
->
_name
,
'type'
=>
$this
->
_type
,
'default'
=>
$this
->
_default
,
...
...
@@ -482,6 +482,6 @@ class Column extends AbstractAsset
'autoincrement'
=>
$this
->
_autoincrement
,
'columnDefinition'
=>
$this
->
_columnDefinition
,
'comment'
=>
$this
->
_comment
,
)
,
$this
->
_platformOptions
,
$this
->
_customSchemaOptions
);
]
,
$this
->
_platformOptions
,
$this
->
_customSchemaOptions
);
}
}
lib/Doctrine/DBAL/Schema/ColumnDiff.php
View file @
4f7c1b72
...
...
@@ -41,7 +41,7 @@ class ColumnDiff
/**
* @var array
*/
public
$changedProperties
=
array
()
;
public
$changedProperties
=
[]
;
/**
* @var Column
...
...
@@ -54,7 +54,7 @@ class ColumnDiff
* @param string[] $changedProperties
* @param Column $fromColumn
*/
public
function
__construct
(
$oldColumnName
,
Column
$column
,
array
$changedProperties
=
array
()
,
Column
$fromColumn
=
null
)
public
function
__construct
(
$oldColumnName
,
Column
$column
,
array
$changedProperties
=
[]
,
Column
$fromColumn
=
null
)
{
$this
->
oldColumnName
=
$oldColumnName
;
$this
->
column
=
$column
;
...
...
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
4f7c1b72
...
...
@@ -60,7 +60,7 @@ class Comparator
$diff
=
new
SchemaDiff
();
$diff
->
fromSchema
=
$fromSchema
;
$foreignKeysToTable
=
array
()
;
$foreignKeysToTable
=
[]
;
foreach
(
$toSchema
->
getNamespaces
()
as
$namespace
)
{
if
(
!
$fromSchema
->
hasNamespace
(
$namespace
))
{
...
...
@@ -99,7 +99,7 @@ class Comparator
foreach
(
$table
->
getForeignKeys
()
as
$foreignKey
)
{
$foreignTable
=
strtolower
(
$foreignKey
->
getForeignTableName
());
if
(
!
isset
(
$foreignKeysToTable
[
$foreignTable
]))
{
$foreignKeysToTable
[
$foreignTable
]
=
array
()
;
$foreignKeysToTable
[
$foreignTable
]
=
[]
;
}
$foreignKeysToTable
[
$foreignTable
][]
=
$foreignKey
;
}
...
...
@@ -315,11 +315,11 @@ class Comparator
*/
private
function
detectColumnRenamings
(
TableDiff
$tableDifferences
)
{
$renameCandidates
=
array
()
;
$renameCandidates
=
[]
;
foreach
(
$tableDifferences
->
addedColumns
as
$addedColumnName
=>
$addedColumn
)
{
foreach
(
$tableDifferences
->
removedColumns
as
$removedColumn
)
{
if
(
count
(
$this
->
diffColumn
(
$addedColumn
,
$removedColumn
))
==
0
)
{
$renameCandidates
[
$addedColumn
->
getName
()][]
=
array
(
$removedColumn
,
$addedColumn
,
$addedColumnName
)
;
$renameCandidates
[
$addedColumn
->
getName
()][]
=
[
$removedColumn
,
$addedColumn
,
$addedColumnName
]
;
}
}
}
...
...
@@ -349,13 +349,13 @@ class Comparator
*/
private
function
detectIndexRenamings
(
TableDiff
$tableDifferences
)
{
$renameCandidates
=
array
()
;
$renameCandidates
=
[]
;
// Gather possible rename candidates by comparing each added and removed index based on semantics.
foreach
(
$tableDifferences
->
addedIndexes
as
$addedIndexName
=>
$addedIndex
)
{
foreach
(
$tableDifferences
->
removedIndexes
as
$removedIndex
)
{
if
(
!
$this
->
diffIndex
(
$addedIndex
,
$removedIndex
))
{
$renameCandidates
[
$addedIndex
->
getName
()][]
=
array
(
$removedIndex
,
$addedIndex
,
$addedIndexName
)
;
$renameCandidates
[
$addedIndex
->
getName
()][]
=
[
$removedIndex
,
$addedIndex
,
$addedIndexName
]
;
}
}
}
...
...
@@ -427,9 +427,9 @@ class Comparator
$properties1
=
$column1
->
toArray
();
$properties2
=
$column2
->
toArray
();
$changedProperties
=
array
()
;
$changedProperties
=
[]
;
foreach
(
array
(
'type'
,
'notnull'
,
'unsigned'
,
'autoincrement'
)
as
$property
)
{
foreach
(
[
'type'
,
'notnull'
,
'unsigned'
,
'autoincrement'
]
as
$property
)
{
if
(
$properties1
[
$property
]
!=
$properties2
[
$property
])
{
$changedProperties
[]
=
$property
;
}
...
...
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
View file @
4f7c1b72
...
...
@@ -90,7 +90,7 @@ class DB2SchemaManager extends AbstractSchemaManager
break
;
}
$options
=
array
(
$options
=
[
'length'
=>
$length
,
'unsigned'
=>
(
bool
)
$unsigned
,
'fixed'
=>
(
bool
)
$fixed
,
...
...
@@ -102,8 +102,8 @@ class DB2SchemaManager extends AbstractSchemaManager
'comment'
=>
isset
(
$tableColumn
[
'comment'
])
&&
$tableColumn
[
'comment'
]
!==
''
?
$tableColumn
[
'comment'
]
:
null
,
'platformOptions'
=>
array
()
,
)
;
'platformOptions'
=>
[]
,
]
;
if
(
$scale
!==
null
&&
$precision
!==
null
)
{
$options
[
'scale'
]
=
$scale
;
...
...
@@ -118,7 +118,7 @@ class DB2SchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTablesList
(
$tables
)
{
$tableNames
=
array
()
;
$tableNames
=
[]
;
foreach
(
$tables
as
$tableRow
)
{
$tableRow
=
array_change_key_case
(
$tableRow
,
\CASE_LOWER
);
$tableNames
[]
=
$tableRow
[
'name'
];
...
...
@@ -159,22 +159,22 @@ class DB2SchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableForeignKeysList
(
$tableForeignKeys
)
{
$foreignKeys
=
array
()
;
$foreignKeys
=
[]
;
foreach
(
$tableForeignKeys
as
$tableForeignKey
)
{
$tableForeignKey
=
array_change_key_case
(
$tableForeignKey
,
\CASE_LOWER
);
if
(
!
isset
(
$foreignKeys
[
$tableForeignKey
[
'index_name'
]]))
{
$foreignKeys
[
$tableForeignKey
[
'index_name'
]]
=
array
(
'local_columns'
=>
array
(
$tableForeignKey
[
'local_column'
])
,
$foreignKeys
[
$tableForeignKey
[
'index_name'
]]
=
[
'local_columns'
=>
[
$tableForeignKey
[
'local_column'
]]
,
'foreign_table'
=>
$tableForeignKey
[
'foreign_table'
],
'foreign_columns'
=>
array
(
$tableForeignKey
[
'foreign_column'
])
,
'foreign_columns'
=>
[
$tableForeignKey
[
'foreign_column'
]]
,
'name'
=>
$tableForeignKey
[
'index_name'
],
'options'
=>
array
(
'options'
=>
[
'onUpdate'
=>
$tableForeignKey
[
'on_update'
],
'onDelete'
=>
$tableForeignKey
[
'on_delete'
],
)
)
;
]
]
;
}
else
{
$foreignKeys
[
$tableForeignKey
[
'index_name'
]][
'local_columns'
][]
=
$tableForeignKey
[
'local_column'
];
$foreignKeys
[
$tableForeignKey
[
'index_name'
]][
'foreign_columns'
][]
=
$tableForeignKey
[
'foreign_column'
];
...
...
lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
View file @
4f7c1b72
...
...
@@ -39,7 +39,7 @@ class DrizzleSchemaManager extends AbstractSchemaManager
$type
=
$this
->
extractDoctrineTypeFromComment
(
$tableColumn
[
'COLUMN_COMMENT'
],
$type
);
$tableColumn
[
'COLUMN_COMMENT'
]
=
$this
->
removeDoctrineTypeFromComment
(
$tableColumn
[
'COLUMN_COMMENT'
],
$type
);
$options
=
array
(
$options
=
[
'notnull'
=>
!
(
bool
)
$tableColumn
[
'IS_NULLABLE'
],
'length'
=>
(
int
)
$tableColumn
[
'CHARACTER_MAXIMUM_LENGTH'
],
'default'
=>
isset
(
$tableColumn
[
'COLUMN_DEFAULT'
])
?
$tableColumn
[
'COLUMN_DEFAULT'
]
:
null
,
...
...
@@ -49,7 +49,7 @@ class DrizzleSchemaManager extends AbstractSchemaManager
'comment'
=>
isset
(
$tableColumn
[
'COLUMN_COMMENT'
])
&&
''
!==
$tableColumn
[
'COLUMN_COMMENT'
]
?
$tableColumn
[
'COLUMN_COMMENT'
]
:
null
,
)
;
]
;
$column
=
new
Column
(
$tableColumn
[
'COLUMN_NAME'
],
Type
::
getType
(
$type
),
$options
);
...
...
@@ -81,12 +81,12 @@ class DrizzleSchemaManager extends AbstractSchemaManager
*/
public
function
_getPortableTableForeignKeyDefinition
(
$tableForeignKey
)
{
$columns
=
array
()
;
$columns
=
[]
;
foreach
(
explode
(
','
,
$tableForeignKey
[
'CONSTRAINT_COLUMNS'
])
as
$value
)
{
$columns
[]
=
trim
(
$value
,
' `'
);
}
$refColumns
=
array
()
;
$refColumns
=
[]
;
foreach
(
explode
(
','
,
$tableForeignKey
[
'REFERENCED_TABLE_COLUMNS'
])
as
$value
)
{
$refColumns
[]
=
trim
(
$value
,
' `'
);
}
...
...
@@ -96,10 +96,10 @@ class DrizzleSchemaManager extends AbstractSchemaManager
$tableForeignKey
[
'REFERENCED_TABLE_NAME'
],
$refColumns
,
$tableForeignKey
[
'CONSTRAINT_NAME'
],
array
(
[
'onUpdate'
=>
$tableForeignKey
[
'UPDATE_RULE'
],
'onDelete'
=>
$tableForeignKey
[
'DELETE_RULE'
],
)
]
);
}
...
...
@@ -108,7 +108,7 @@ class DrizzleSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
{
$indexes
=
array
()
;
$indexes
=
[]
;
foreach
(
$tableIndexes
as
$k
)
{
$k
[
'primary'
]
=
(
boolean
)
$k
[
'primary'
];
$indexes
[]
=
$k
;
...
...
lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
View file @
4f7c1b72
...
...
@@ -75,7 +75,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
* @param string|null $name Name of the foreign key constraint.
* @param array $options Options associated with the foreign key constraint.
*/
public
function
__construct
(
array
$localColumnNames
,
$foreignTableName
,
array
$foreignColumnNames
,
$name
=
null
,
array
$options
=
array
()
)
public
function
__construct
(
array
$localColumnNames
,
$foreignTableName
,
array
$foreignColumnNames
,
$name
=
null
,
array
$options
=
[]
)
{
$this
->
_setName
(
$name
);
$identifierConstructorCallback
=
function
(
$column
)
{
...
...
@@ -83,7 +83,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
};
$this
->
_localColumnNames
=
$localColumnNames
?
array_combine
(
$localColumnNames
,
array_map
(
$identifierConstructorCallback
,
$localColumnNames
))
:
array
()
;
:
[]
;
if
(
$foreignTableName
instanceof
Table
)
{
$this
->
_foreignTableName
=
$foreignTableName
;
...
...
@@ -93,7 +93,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
$this
->
_foreignColumnNames
=
$foreignColumnNames
?
array_combine
(
$foreignColumnNames
,
array_map
(
$identifierConstructorCallback
,
$foreignColumnNames
))
:
array
()
;
:
[]
;
$this
->
_options
=
$options
;
}
...
...
@@ -154,7 +154,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
*/
public
function
getQuotedLocalColumns
(
AbstractPlatform
$platform
)
{
$columns
=
array
()
;
$columns
=
[]
;
foreach
(
$this
->
_localColumnNames
as
$column
)
{
$columns
[]
=
$column
->
getQuotedName
(
$platform
);
...
...
@@ -170,7 +170,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
*/
public
function
getUnquotedLocalColumns
()
{
return
array_map
(
array
(
$this
,
'trimQuotes'
)
,
$this
->
getLocalColumns
());
return
array_map
(
[
$this
,
'trimQuotes'
]
,
$this
->
getLocalColumns
());
}
/**
...
...
@@ -180,7 +180,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
*/
public
function
getUnquotedForeignColumns
()
{
return
array_map
(
array
(
$this
,
'trimQuotes'
)
,
$this
->
getForeignColumns
());
return
array_map
(
[
$this
,
'trimQuotes'
]
,
$this
->
getForeignColumns
());
}
/**
...
...
@@ -277,7 +277,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
*/
public
function
getQuotedForeignColumns
(
AbstractPlatform
$platform
)
{
$columns
=
array
()
;
$columns
=
[]
;
foreach
(
$this
->
_foreignColumnNames
as
$column
)
{
$columns
[]
=
$column
->
getQuotedName
(
$platform
);
...
...
@@ -356,7 +356,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
if
(
isset
(
$this
->
_options
[
$event
]))
{
$onEvent
=
strtoupper
(
$this
->
_options
[
$event
]);
if
(
!
in_array
(
$onEvent
,
array
(
'NO ACTION'
,
'RESTRICT'
)
))
{
if
(
!
in_array
(
$onEvent
,
[
'NO ACTION'
,
'RESTRICT'
]
))
{
return
$onEvent
;
}
}
...
...
lib/Doctrine/DBAL/Schema/Index.php
View file @
4f7c1b72
...
...
@@ -29,7 +29,7 @@ class Index extends AbstractAsset implements Constraint
*
* @var Identifier[]
*/
protected
$_columns
=
array
()
;
protected
$_columns
=
[]
;
/**
* @var boolean
...
...
@@ -47,7 +47,7 @@ class Index extends AbstractAsset implements Constraint
*
* @var array
*/
protected
$_flags
=
array
()
;
protected
$_flags
=
[]
;
/**
* Platform specific options
...
...
@@ -56,7 +56,7 @@ class Index extends AbstractAsset implements Constraint
*
* @var array
*/
private
$options
=
array
()
;
private
$options
=
[]
;
/**
* @param string $indexName
...
...
@@ -66,7 +66,7 @@ class Index extends AbstractAsset implements Constraint
* @param string[] $flags
* @param array $options
*/
public
function
__construct
(
$indexName
,
array
$columns
,
$isUnique
=
false
,
$isPrimary
=
false
,
array
$flags
=
array
(),
array
$options
=
array
()
)
public
function
__construct
(
$indexName
,
array
$columns
,
$isUnique
=
false
,
$isPrimary
=
false
,
array
$flags
=
[],
array
$options
=
[]
)
{
$isUnique
=
$isUnique
||
$isPrimary
;
...
...
@@ -112,7 +112,7 @@ class Index extends AbstractAsset implements Constraint
*/
public
function
getQuotedColumns
(
AbstractPlatform
$platform
)
{
$columns
=
array
()
;
$columns
=
[]
;
foreach
(
$this
->
_columns
as
$column
)
{
$columns
[]
=
$column
->
getQuotedName
(
$platform
);
...
...
@@ -126,7 +126,7 @@ class Index extends AbstractAsset implements Constraint
*/
public
function
getUnquotedColumns
()
{
return
array_map
(
array
(
$this
,
'trimQuotes'
)
,
$this
->
getColumns
());
return
array_map
(
[
$this
,
'trimQuotes'
]
,
$this
->
getColumns
());
}
/**
...
...
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
4f7c1b72
...
...
@@ -54,10 +54,10 @@ class MySqlSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableUserDefinition
(
$user
)
{
return
array
(
return
[
'user'
=>
$user
[
'User'
],
'password'
=>
$user
[
'Password'
],
)
;
]
;
}
/**
...
...
@@ -73,9 +73,9 @@ class MySqlSchemaManager extends AbstractSchemaManager
$v
[
'primary'
]
=
false
;
}
if
(
strpos
(
$v
[
'index_type'
],
'FULLTEXT'
)
!==
false
)
{
$v
[
'flags'
]
=
array
(
'FULLTEXT'
)
;
$v
[
'flags'
]
=
[
'FULLTEXT'
]
;
}
elseif
(
strpos
(
$v
[
'index_type'
],
'SPATIAL'
)
!==
false
)
{
$v
[
'flags'
]
=
array
(
'SPATIAL'
)
;
$v
[
'flags'
]
=
[
'SPATIAL'
]
;
}
$tableIndexes
[
$k
]
=
$v
;
}
...
...
@@ -178,7 +178,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
$length
=
((
int
)
$length
==
0
)
?
null
:
(
int
)
$length
;
$options
=
array
(
$options
=
[
'length'
=>
$length
,
'unsigned'
=>
(
bool
)
(
strpos
(
$tableColumn
[
'type'
],
'unsigned'
)
!==
false
),
'fixed'
=>
(
bool
)
$fixed
,
...
...
@@ -190,7 +190,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
'comment'
=>
isset
(
$tableColumn
[
'comment'
])
&&
$tableColumn
[
'comment'
]
!==
''
?
$tableColumn
[
'comment'
]
:
null
,
)
;
]
;
if
(
$scale
!==
null
&&
$precision
!==
null
)
{
$options
[
'scale'
]
=
$scale
;
...
...
@@ -211,7 +211,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableForeignKeysList
(
$tableForeignKeys
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$tableForeignKeys
as
$value
)
{
$value
=
array_change_key_case
(
$value
,
CASE_LOWER
);
if
(
!
isset
(
$list
[
$value
[
'constraint_name'
]]))
{
...
...
@@ -222,28 +222,28 @@ class MySqlSchemaManager extends AbstractSchemaManager
$value
[
'update_rule'
]
=
null
;
}
$list
[
$value
[
'constraint_name'
]]
=
array
(
$list
[
$value
[
'constraint_name'
]]
=
[
'name'
=>
$value
[
'constraint_name'
],
'local'
=>
array
()
,
'foreign'
=>
array
()
,
'local'
=>
[]
,
'foreign'
=>
[]
,
'foreignTable'
=>
$value
[
'referenced_table_name'
],
'onDelete'
=>
$value
[
'delete_rule'
],
'onUpdate'
=>
$value
[
'update_rule'
],
)
;
]
;
}
$list
[
$value
[
'constraint_name'
]][
'local'
][]
=
$value
[
'column_name'
];
$list
[
$value
[
'constraint_name'
]][
'foreign'
][]
=
$value
[
'referenced_column_name'
];
}
$result
=
array
()
;
$result
=
[]
;
foreach
(
$list
as
$constraint
)
{
$result
[]
=
new
ForeignKeyConstraint
(
array_values
(
$constraint
[
'local'
]),
$constraint
[
'foreignTable'
],
array_values
(
$constraint
[
'foreign'
]),
$constraint
[
'name'
],
array
(
[
'onDelete'
=>
$constraint
[
'onDelete'
],
'onUpdate'
=>
$constraint
[
'onUpdate'
],
)
]
);
}
...
...
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
4f7c1b72
...
...
@@ -78,9 +78,9 @@ class OracleSchemaManager extends AbstractSchemaManager
{
$user
=
\array_change_key_case
(
$user
,
CASE_LOWER
);
return
array
(
return
[
'user'
=>
$user
[
'username'
],
)
;
]
;
}
/**
...
...
@@ -101,7 +101,7 @@ class OracleSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
{
$indexBuffer
=
array
()
;
$indexBuffer
=
[]
;
foreach
(
$tableIndexes
as
$tableIndex
)
{
$tableIndex
=
\array_change_key_case
(
$tableIndex
,
CASE_LOWER
);
...
...
@@ -227,7 +227,7 @@ class OracleSchemaManager extends AbstractSchemaManager
$length
=
null
;
}
$options
=
array
(
$options
=
[
'notnull'
=>
(
bool
)
(
$tableColumn
[
'nullable'
]
===
'N'
),
'fixed'
=>
(
bool
)
$fixed
,
'unsigned'
=>
(
bool
)
$unsigned
,
...
...
@@ -238,8 +238,8 @@ class OracleSchemaManager extends AbstractSchemaManager
'comment'
=>
isset
(
$tableColumn
[
'comments'
])
&&
''
!==
$tableColumn
[
'comments'
]
?
$tableColumn
[
'comments'
]
:
null
,
'platformDetails'
=>
array
()
,
)
;
'platformDetails'
=>
[]
,
]
;
return
new
Column
(
$this
->
getQuotedIdentifierName
(
$tableColumn
[
'column_name'
]),
Type
::
getType
(
$type
),
$options
);
}
...
...
@@ -249,7 +249,7 @@ class OracleSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableForeignKeysList
(
$tableForeignKeys
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$tableForeignKeys
as
$value
)
{
$value
=
\array_change_key_case
(
$value
,
CASE_LOWER
);
if
(
!
isset
(
$list
[
$value
[
'constraint_name'
]]))
{
...
...
@@ -257,13 +257,13 @@ class OracleSchemaManager extends AbstractSchemaManager
$value
[
'delete_rule'
]
=
null
;
}
$list
[
$value
[
'constraint_name'
]]
=
array
(
$list
[
$value
[
'constraint_name'
]]
=
[
'name'
=>
$this
->
getQuotedIdentifierName
(
$value
[
'constraint_name'
]),
'local'
=>
array
()
,
'foreign'
=>
array
()
,
'local'
=>
[]
,
'foreign'
=>
[]
,
'foreignTable'
=>
$value
[
'references_table'
],
'onDelete'
=>
$value
[
'delete_rule'
],
)
;
]
;
}
$localColumn
=
$this
->
getQuotedIdentifierName
(
$value
[
'local_column'
]);
...
...
@@ -273,12 +273,12 @@ class OracleSchemaManager extends AbstractSchemaManager
$list
[
$value
[
'constraint_name'
]][
'foreign'
][
$value
[
'position'
]]
=
$foreignColumn
;
}
$result
=
array
()
;
$result
=
[]
;
foreach
(
$list
as
$constraint
)
{
$result
[]
=
new
ForeignKeyConstraint
(
array_values
(
$constraint
[
'local'
]),
$this
->
getQuotedIdentifierName
(
$constraint
[
'foreignTable'
]),
array_values
(
$constraint
[
'foreign'
]),
$this
->
getQuotedIdentifierName
(
$constraint
[
'name'
]),
array
(
'onDelete'
=>
$constraint
[
'onDelete'
])
[
'onDelete'
=>
$constraint
[
'onDelete'
]]
);
}
...
...
@@ -408,7 +408,7 @@ WHERE
AND p.addr(+) = s.paddr
SQL;
$activeUserSessions
=
$this
->
_conn
->
fetchAll
(
$sql
,
array
(
strtoupper
(
$user
))
);
$activeUserSessions
=
$this
->
_conn
->
fetchAll
(
$sql
,
[
strtoupper
(
$user
)]
);
foreach
(
$activeUserSessions
as
$activeUserSession
)
{
$activeUserSession
=
array_change_key_case
(
$activeUserSession
,
\CASE_LOWER
);
...
...
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
4f7c1b72
...
...
@@ -118,10 +118,10 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
}
$this
->
_execSql
(
array
(
[
$this
->
_platform
->
getDisallowDatabaseConnectionsSQL
(
$database
),
$this
->
_platform
->
getCloseActiveDatabaseConnectionsSQL
(
$database
),
)
]
);
parent
::
dropDatabase
(
$database
);
...
...
@@ -153,7 +153,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
return
new
ForeignKeyConstraint
(
$localColumns
,
$foreignTable
,
$foreignColumns
,
$tableForeignKey
[
'conname'
],
array
(
'onUpdate'
=>
$onUpdate
,
'onDelete'
=>
$onDelete
)
[
'onUpdate'
=>
$onUpdate
,
'onDelete'
=>
$onDelete
]
);
}
...
...
@@ -178,10 +178,10 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableUserDefinition
(
$user
)
{
return
array
(
return
[
'user'
=>
$user
[
'usename'
],
'password'
=>
$user
[
'passwd'
]
)
;
]
;
}
/**
...
...
@@ -207,7 +207,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
{
$buffer
=
array
()
;
$buffer
=
[]
;
foreach
(
$tableIndexes
as
$row
)
{
$colNumbers
=
explode
(
' '
,
$row
[
'indkey'
]);
$colNumbersSql
=
'IN ('
.
join
(
' ,'
,
$colNumbers
)
.
' )'
;
...
...
@@ -221,13 +221,13 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
foreach
(
$colNumbers
as
$colNum
)
{
foreach
(
$indexColumns
as
$colRow
)
{
if
(
$colNum
==
$colRow
[
'attnum'
])
{
$buffer
[]
=
array
(
$buffer
[]
=
[
'key_name'
=>
$row
[
'relname'
],
'column_name'
=>
trim
(
$colRow
[
'attname'
]),
'non_unique'
=>
!
$row
[
'indisunique'
],
'primary'
=>
$row
[
'indisprimary'
],
'where'
=>
$row
[
'where'
],
)
;
]
;
}
}
}
...
...
@@ -249,7 +249,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableSequencesList
(
$sequences
)
{
$sequenceDefinitions
=
array
()
;
$sequenceDefinitions
=
[]
;
foreach
(
$sequences
as
$sequence
)
{
if
(
$sequence
[
'schemaname'
]
!=
'public'
)
{
...
...
@@ -261,7 +261,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$sequenceDefinitions
[
$sequenceName
]
=
$sequence
;
}
$list
=
array
()
;
$list
=
[]
;
foreach
(
$this
->
filterAssetNames
(
array_keys
(
$sequenceDefinitions
))
as
$sequenceName
)
{
$list
[]
=
$this
->
_getPortableSequenceDefinition
(
$sequenceDefinitions
[
$sequenceName
]);
...
...
@@ -307,7 +307,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$tableColumn
[
'length'
]
=
$length
;
}
$matches
=
array
()
;
$matches
=
[]
;
$autoincrement
=
false
;
if
(
preg_match
(
"/^nextval\('(.*)'(::.*)?\)$/"
,
$tableColumn
[
'default'
],
$matches
))
{
...
...
@@ -423,7 +423,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$tableColumn
[
'default'
]
=
$match
[
1
];
}
$options
=
array
(
$options
=
[
'length'
=>
$length
,
'notnull'
=>
(
bool
)
$tableColumn
[
'isnotnull'
],
'default'
=>
$tableColumn
[
'default'
],
...
...
@@ -436,7 +436,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
'comment'
=>
isset
(
$tableColumn
[
'comment'
])
&&
$tableColumn
[
'comment'
]
!==
''
?
$tableColumn
[
'comment'
]
:
null
,
)
;
]
;
$column
=
new
Column
(
$tableColumn
[
'field'
],
Type
::
getType
(
$type
),
$options
);
...
...
lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php
View file @
4f7c1b72
...
...
@@ -111,7 +111,7 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
if
(
null
!==
$tableColumn
[
'default'
])
{
// Strip quotes from default value.
$default
=
preg_replace
(
array
(
"/^'(.*)'$/"
,
"/''/"
),
array
(
"$1"
,
"'"
)
,
$tableColumn
[
'default'
]);
$default
=
preg_replace
(
[
"/^'(.*)'$/"
,
"/''/"
],
[
"$1"
,
"'"
]
,
$tableColumn
[
'default'
]);
if
(
'autoincrement'
==
$default
)
{
$default
=
null
;
...
...
@@ -135,7 +135,7 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
return
new
Column
(
$tableColumn
[
'column_name'
],
Type
::
getType
(
$type
),
array
(
[
'length'
=>
$type
==
'string'
?
$tableColumn
[
'length'
]
:
null
,
'precision'
=>
$precision
,
'scale'
=>
$scale
,
...
...
@@ -147,7 +147,8 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
'comment'
=>
isset
(
$tableColumn
[
'comment'
])
&&
''
!==
$tableColumn
[
'comment'
]
?
$tableColumn
[
'comment'
]
:
null
,
));
]
);
}
/**
...
...
@@ -177,16 +178,16 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableForeignKeysList
(
$tableForeignKeys
)
{
$foreignKeys
=
array
()
;
$foreignKeys
=
[]
;
foreach
(
$tableForeignKeys
as
$tableForeignKey
)
{
if
(
!
isset
(
$foreignKeys
[
$tableForeignKey
[
'index_name'
]]))
{
$foreignKeys
[
$tableForeignKey
[
'index_name'
]]
=
array
(
'local_columns'
=>
array
(
$tableForeignKey
[
'local_column'
])
,
$foreignKeys
[
$tableForeignKey
[
'index_name'
]]
=
[
'local_columns'
=>
[
$tableForeignKey
[
'local_column'
]]
,
'foreign_table'
=>
$tableForeignKey
[
'foreign_table'
],
'foreign_columns'
=>
array
(
$tableForeignKey
[
'foreign_column'
])
,
'foreign_columns'
=>
[
$tableForeignKey
[
'foreign_column'
]]
,
'name'
=>
$tableForeignKey
[
'index_name'
],
'options'
=>
array
(
'options'
=>
[
'notnull'
=>
$tableForeignKey
[
'notnull'
],
'match'
=>
$tableForeignKey
[
'match'
],
'onUpdate'
=>
$tableForeignKey
[
'on_update'
],
...
...
@@ -194,8 +195,8 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
'check_on_commit'
=>
$tableForeignKey
[
'check_on_commit'
],
'clustered'
=>
$tableForeignKey
[
'clustered'
],
'for_olap_workload'
=>
$tableForeignKey
[
'for_olap_workload'
]
)
)
;
]
]
;
}
else
{
$foreignKeys
[
$tableForeignKey
[
'index_name'
]][
'local_columns'
][]
=
$tableForeignKey
[
'local_column'
];
$foreignKeys
[
$tableForeignKey
[
'index_name'
]][
'foreign_columns'
][]
=
$tableForeignKey
[
'foreign_column'
];
...
...
@@ -212,7 +213,7 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
{
foreach
(
$tableIndexRows
as
&
$tableIndex
)
{
$tableIndex
[
'primary'
]
=
(
boolean
)
$tableIndex
[
'primary'
];
$tableIndex
[
'flags'
]
=
array
()
;
$tableIndex
[
'flags'
]
=
[]
;
if
(
$tableIndex
[
'clustered'
])
{
$tableIndex
[
'flags'
][]
=
'clustered'
;
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
4f7c1b72
...
...
@@ -116,8 +116,8 @@ class SQLServerSchemaManager extends AbstractSchemaManager
$type
=
$this
->
extractDoctrineTypeFromComment
(
$tableColumn
[
'comment'
],
$type
);
$tableColumn
[
'comment'
]
=
$this
->
removeDoctrineTypeFromComment
(
$tableColumn
[
'comment'
],
$type
);
$options
=
array
(
'length'
=>
(
$length
==
0
||
!
in_array
(
$type
,
array
(
'text'
,
'string'
)
))
?
null
:
$length
,
$options
=
[
'length'
=>
(
$length
==
0
||
!
in_array
(
$type
,
[
'text'
,
'string'
]
))
?
null
:
$length
,
'unsigned'
=>
false
,
'fixed'
=>
(
bool
)
$fixed
,
'default'
=>
$default
!==
'NULL'
?
$default
:
null
,
...
...
@@ -126,7 +126,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
'precision'
=>
$tableColumn
[
'precision'
],
'autoincrement'
=>
(
bool
)
$tableColumn
[
'autoincrement'
],
'comment'
=>
$tableColumn
[
'comment'
]
!==
''
?
$tableColumn
[
'comment'
]
:
null
,
)
;
]
;
$column
=
new
Column
(
$tableColumn
[
'name'
],
Type
::
getType
(
$type
),
$options
);
...
...
@@ -142,20 +142,20 @@ class SQLServerSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableForeignKeysList
(
$tableForeignKeys
)
{
$foreignKeys
=
array
()
;
$foreignKeys
=
[]
;
foreach
(
$tableForeignKeys
as
$tableForeignKey
)
{
if
(
!
isset
(
$foreignKeys
[
$tableForeignKey
[
'ForeignKey'
]]))
{
$foreignKeys
[
$tableForeignKey
[
'ForeignKey'
]]
=
array
(
'local_columns'
=>
array
(
$tableForeignKey
[
'ColumnName'
])
,
$foreignKeys
[
$tableForeignKey
[
'ForeignKey'
]]
=
[
'local_columns'
=>
[
$tableForeignKey
[
'ColumnName'
]]
,
'foreign_table'
=>
$tableForeignKey
[
'ReferenceTableName'
],
'foreign_columns'
=>
array
(
$tableForeignKey
[
'ReferenceColumnName'
])
,
'foreign_columns'
=>
[
$tableForeignKey
[
'ReferenceColumnName'
]]
,
'name'
=>
$tableForeignKey
[
'ForeignKey'
],
'options'
=>
array
(
'options'
=>
[
'onUpdate'
=>
str_replace
(
'_'
,
' '
,
$tableForeignKey
[
'update_referential_action_desc'
]),
'onDelete'
=>
str_replace
(
'_'
,
' '
,
$tableForeignKey
[
'delete_referential_action_desc'
])
)
)
;
]
]
;
}
else
{
$foreignKeys
[
$tableForeignKey
[
'ForeignKey'
]][
'local_columns'
][]
=
$tableForeignKey
[
'ColumnName'
];
$foreignKeys
[
$tableForeignKey
[
'ForeignKey'
]][
'foreign_columns'
][]
=
$tableForeignKey
[
'ReferenceColumnName'
];
...
...
@@ -173,7 +173,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
foreach
(
$tableIndexRows
as
&
$tableIndex
)
{
$tableIndex
[
'non_unique'
]
=
(
boolean
)
$tableIndex
[
'non_unique'
];
$tableIndex
[
'primary'
]
=
(
boolean
)
$tableIndex
[
'primary'
];
$tableIndex
[
'flags'
]
=
$tableIndex
[
'flags'
]
?
array
(
$tableIndex
[
'flags'
])
:
null
;
$tableIndex
[
'flags'
]
=
$tableIndex
[
'flags'
]
?
[
$tableIndex
[
'flags'
]]
:
null
;
}
return
parent
::
_getPortableTableIndexesList
(
$tableIndexRows
,
$tableName
);
...
...
@@ -237,13 +237,13 @@ class SQLServerSchemaManager extends AbstractSchemaManager
$tableIndexes
=
$this
->
_conn
->
fetchAll
(
$sql
);
}
catch
(
\PDOException
$e
)
{
if
(
$e
->
getCode
()
==
"IMSSP"
)
{
return
array
()
;
return
[]
;
}
else
{
throw
$e
;
}
}
catch
(
DBALException
$e
)
{
if
(
strpos
(
$e
->
getMessage
(),
'SQLSTATE [01000, 15472]'
)
===
0
)
{
return
array
()
;
return
[]
;
}
else
{
throw
$e
;
}
...
...
lib/Doctrine/DBAL/Schema/Schema.php
View file @
4f7c1b72
...
...
@@ -60,17 +60,17 @@ class Schema extends AbstractAsset
*
* @var array
*/
private
$namespaces
=
array
()
;
private
$namespaces
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\Table[]
*/
protected
$_tables
=
array
()
;
protected
$_tables
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\Sequence[]
*/
protected
$_sequences
=
array
()
;
protected
$_sequences
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\SchemaConfig
...
...
@@ -84,10 +84,10 @@ class Schema extends AbstractAsset
* @param array $namespaces
*/
public
function
__construct
(
array
$tables
=
array
()
,
array
$sequences
=
array
()
,
array
$tables
=
[]
,
array
$sequences
=
[]
,
SchemaConfig
$schemaConfig
=
null
,
array
$namespaces
=
array
()
array
$namespaces
=
[]
)
{
if
(
$schemaConfig
==
null
)
{
$schemaConfig
=
new
SchemaConfig
();
...
...
lib/Doctrine/DBAL/Schema/SchemaConfig.php
View file @
4f7c1b72
...
...
@@ -46,7 +46,7 @@ class SchemaConfig
/**
* @var array
*/
protected
$defaultTableOptions
=
array
()
;
protected
$defaultTableOptions
=
[]
;
/**
* @return boolean
...
...
lib/Doctrine/DBAL/Schema/SchemaDiff.php
View file @
4f7c1b72
...
...
@@ -42,55 +42,55 @@ class SchemaDiff
*
* @var string[]
*/
public
$newNamespaces
=
array
()
;
public
$newNamespaces
=
[]
;
/**
* All removed namespaces.
*
* @var string[]
*/
public
$removedNamespaces
=
array
()
;
public
$removedNamespaces
=
[]
;
/**
* All added tables.
*
* @var \Doctrine\DBAL\Schema\Table[]
*/
public
$newTables
=
array
()
;
public
$newTables
=
[]
;
/**
* All changed tables.
*
* @var \Doctrine\DBAL\Schema\TableDiff[]
*/
public
$changedTables
=
array
()
;
public
$changedTables
=
[]
;
/**
* All removed tables.
*
* @var \Doctrine\DBAL\Schema\Table[]
*/
public
$removedTables
=
array
()
;
public
$removedTables
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\Sequence[]
*/
public
$newSequences
=
array
()
;
public
$newSequences
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\Sequence[]
*/
public
$changedSequences
=
array
()
;
public
$changedSequences
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\Sequence[]
*/
public
$removedSequences
=
array
()
;
public
$removedSequences
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[]
*/
public
$orphanedForeignKeys
=
array
()
;
public
$orphanedForeignKeys
=
[]
;
/**
* Constructs an SchemaDiff object.
...
...
@@ -100,7 +100,7 @@ class SchemaDiff
* @param \Doctrine\DBAL\Schema\Table[] $removedTables
* @param \Doctrine\DBAL\Schema\Schema|null $fromSchema
*/
public
function
__construct
(
$newTables
=
array
(),
$changedTables
=
array
(),
$removedTables
=
array
()
,
Schema
$fromSchema
=
null
)
public
function
__construct
(
$newTables
=
[],
$changedTables
=
[],
$removedTables
=
[]
,
Schema
$fromSchema
=
null
)
{
$this
->
newTables
=
$newTables
;
$this
->
changedTables
=
$changedTables
;
...
...
@@ -144,7 +144,7 @@ class SchemaDiff
*/
protected
function
_toSql
(
AbstractPlatform
$platform
,
$saveMode
=
false
)
{
$sql
=
array
()
;
$sql
=
[]
;
if
(
$platform
->
supportsSchemas
())
{
foreach
(
$this
->
newNamespaces
as
$newNamespace
)
{
...
...
@@ -174,7 +174,7 @@ class SchemaDiff
}
}
$foreignKeySql
=
array
()
;
$foreignKeySql
=
[]
;
foreach
(
$this
->
newTables
as
$table
)
{
$sql
=
array_merge
(
$sql
,
...
...
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
4f7c1b72
...
...
@@ -52,10 +52,10 @@ class SqliteSchemaManager extends AbstractSchemaManager
{
$params
=
$this
->
_conn
->
getParams
();
$driver
=
$params
[
'driver'
];
$options
=
array
(
$options
=
[
'driver'
=>
$driver
,
'path'
=>
$database
)
;
]
;
$conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$options
);
$conn
->
connect
();
$conn
->
close
();
...
...
@@ -135,7 +135,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
$deferrable
=
array_reverse
(
$match
[
2
]);
$deferred
=
array_reverse
(
$match
[
3
]);
}
else
{
$names
=
$deferrable
=
$deferred
=
array
()
;
$names
=
$deferrable
=
$deferred
=
[]
;
}
foreach
(
$tableForeignKeys
as
$key
=>
$value
)
{
...
...
@@ -165,7 +165,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
{
$indexBuffer
=
array
()
;
$indexBuffer
=
[]
;
// fetch primary
$stmt
=
$this
->
_conn
->
executeQuery
(
"PRAGMA TABLE_INFO ('
$tableName
')"
);
...
...
@@ -180,12 +180,12 @@ class SqliteSchemaManager extends AbstractSchemaManager
});
foreach
(
$indexArray
as
$indexColumnRow
)
{
if
(
$indexColumnRow
[
'pk'
]
!=
"0"
)
{
$indexBuffer
[]
=
array
(
$indexBuffer
[]
=
[
'key_name'
=>
'primary'
,
'primary'
=>
true
,
'non_unique'
=>
false
,
'column_name'
=>
$indexColumnRow
[
'name'
]
)
;
]
;
}
}
...
...
@@ -194,7 +194,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
// Ignore indexes with reserved names, e.g. autoindexes
if
(
strpos
(
$tableIndex
[
'name'
],
'sqlite_'
)
!==
0
)
{
$keyName
=
$tableIndex
[
'name'
];
$idx
=
array
()
;
$idx
=
[]
;
$idx
[
'key_name'
]
=
$keyName
;
$idx
[
'primary'
]
=
false
;
$idx
[
'non_unique'
]
=
$tableIndex
[
'unique'
]
?
false
:
true
;
...
...
@@ -217,10 +217,10 @@ class SqliteSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableIndexDefinition
(
$tableIndex
)
{
return
array
(
return
[
'name'
=>
$tableIndex
[
'name'
],
'unique'
=>
(
bool
)
$tableIndex
[
'unique'
]
)
;
]
;
}
/**
...
...
@@ -339,7 +339,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
break
;
}
$options
=
array
(
$options
=
[
'length'
=>
$length
,
'unsigned'
=>
(
bool
)
$unsigned
,
'fixed'
=>
$fixed
,
...
...
@@ -348,7 +348,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
'precision'
=>
$precision
,
'scale'
=>
$scale
,
'autoincrement'
=>
false
,
)
;
]
;
return
new
Column
(
$tableColumn
[
'name'
],
\Doctrine\DBAL\Types\Type
::
getType
(
$type
),
$options
);
}
...
...
@@ -366,7 +366,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableForeignKeysList
(
$tableForeignKeys
)
{
$list
=
array
()
;
$list
=
[]
;
foreach
(
$tableForeignKeys
as
$value
)
{
$value
=
array_change_key_case
(
$value
,
CASE_LOWER
);
$name
=
$value
[
'constraint_name'
];
...
...
@@ -378,32 +378,32 @@ class SqliteSchemaManager extends AbstractSchemaManager
$value
[
'on_update'
]
=
null
;
}
$list
[
$name
]
=
array
(
$list
[
$name
]
=
[
'name'
=>
$name
,
'local'
=>
array
()
,
'foreign'
=>
array
()
,
'local'
=>
[]
,
'foreign'
=>
[]
,
'foreignTable'
=>
$value
[
'table'
],
'onDelete'
=>
$value
[
'on_delete'
],
'onUpdate'
=>
$value
[
'on_update'
],
'deferrable'
=>
$value
[
'deferrable'
],
'deferred'
=>
$value
[
'deferred'
],
)
;
]
;
}
$list
[
$name
][
'local'
][]
=
$value
[
'from'
];
$list
[
$name
][
'foreign'
][]
=
$value
[
'to'
];
}
$result
=
array
()
;
$result
=
[]
;
foreach
(
$list
as
$constraint
)
{
$result
[]
=
new
ForeignKeyConstraint
(
array_values
(
$constraint
[
'local'
]),
$constraint
[
'foreignTable'
],
array_values
(
$constraint
[
'foreign'
]),
$constraint
[
'name'
],
array
(
[
'onDelete'
=>
$constraint
[
'onDelete'
],
'onUpdate'
=>
$constraint
[
'onUpdate'
],
'deferrable'
=>
$constraint
[
'deferrable'
],
'deferred'
=>
$constraint
[
'deferred'
],
)
]
);
}
...
...
lib/Doctrine/DBAL/Schema/Table.php
View file @
4f7c1b72
...
...
@@ -40,17 +40,17 @@ class Table extends AbstractAsset
/**
* @var Column[]
*/
protected
$_columns
=
array
()
;
protected
$_columns
=
[]
;
/**
* @var Index[]
*/
private
$implicitIndexes
=
array
()
;
private
$implicitIndexes
=
[]
;
/**
* @var Index[]
*/
protected
$_indexes
=
array
()
;
protected
$_indexes
=
[]
;
/**
* @var string
...
...
@@ -60,12 +60,12 @@ class Table extends AbstractAsset
/**
* @var ForeignKeyConstraint[]
*/
protected
$_fkConstraints
=
array
()
;
protected
$_fkConstraints
=
[]
;
/**
* @var array
*/
protected
$_options
=
array
()
;
protected
$_options
=
[]
;
/**
* @var SchemaConfig
...
...
@@ -82,7 +82,7 @@ class Table extends AbstractAsset
*
* @throws DBALException
*/
public
function
__construct
(
$tableName
,
array
$columns
=
array
(),
array
$indexes
=
array
(),
array
$fkConstraints
=
array
(),
$idGeneratorType
=
0
,
array
$options
=
array
()
)
public
function
__construct
(
$tableName
,
array
$columns
=
[],
array
$indexes
=
[],
array
$fkConstraints
=
[],
$idGeneratorType
=
0
,
array
$options
=
[]
)
{
if
(
strlen
(
$tableName
)
==
0
)
{
throw
DBALException
::
invalidTableName
(
$tableName
);
...
...
@@ -155,11 +155,11 @@ class Table extends AbstractAsset
*
* @return self
*/
public
function
addIndex
(
array
$columnNames
,
$indexName
=
null
,
array
$flags
=
array
(),
array
$options
=
array
()
)
public
function
addIndex
(
array
$columnNames
,
$indexName
=
null
,
array
$flags
=
[],
array
$options
=
[]
)
{
if
(
$indexName
==
null
)
{
$indexName
=
$this
->
_generateIdentifierName
(
array_merge
(
array
(
$this
->
getName
())
,
$columnNames
),
"idx"
,
$this
->
_getMaxIdentifierLength
()
array_merge
(
[
$this
->
getName
()]
,
$columnNames
),
"idx"
,
$this
->
_getMaxIdentifierLength
()
);
}
...
...
@@ -202,15 +202,15 @@ class Table extends AbstractAsset
*
* @return self
*/
public
function
addUniqueIndex
(
array
$columnNames
,
$indexName
=
null
,
array
$options
=
array
()
)
public
function
addUniqueIndex
(
array
$columnNames
,
$indexName
=
null
,
array
$options
=
[]
)
{
if
(
$indexName
===
null
)
{
$indexName
=
$this
->
_generateIdentifierName
(
array_merge
(
array
(
$this
->
getName
())
,
$columnNames
),
"uniq"
,
$this
->
_getMaxIdentifierLength
()
array_merge
(
[
$this
->
getName
()]
,
$columnNames
),
"uniq"
,
$this
->
_getMaxIdentifierLength
()
);
}
return
$this
->
_addIndex
(
$this
->
_createIndex
(
$columnNames
,
$indexName
,
true
,
false
,
array
()
,
$options
));
return
$this
->
_addIndex
(
$this
->
_createIndex
(
$columnNames
,
$indexName
,
true
,
false
,
[]
,
$options
));
}
/**
...
...
@@ -290,7 +290,7 @@ class Table extends AbstractAsset
*
* @throws SchemaException
*/
private
function
_createIndex
(
array
$columnNames
,
$indexName
,
$isUnique
,
$isPrimary
,
array
$flags
=
array
(),
array
$options
=
array
()
)
private
function
_createIndex
(
array
$columnNames
,
$indexName
,
$isUnique
,
$isPrimary
,
array
$flags
=
[],
array
$options
=
[]
)
{
if
(
preg_match
(
'(([^a-zA-Z0-9_]+))'
,
$this
->
normalizeIdentifier
(
$indexName
)))
{
throw
SchemaException
::
indexNameInvalid
(
$indexName
);
...
...
@@ -316,7 +316,7 @@ class Table extends AbstractAsset
*
* @return Column
*/
public
function
addColumn
(
$columnName
,
$typeName
,
array
$options
=
array
()
)
public
function
addColumn
(
$columnName
,
$typeName
,
array
$options
=
[]
)
{
$column
=
new
Column
(
$columnName
,
Type
::
getType
(
$typeName
),
$options
);
...
...
@@ -386,7 +386,7 @@ class Table extends AbstractAsset
*
* @return self
*/
public
function
addForeignKeyConstraint
(
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
array
()
,
$constraintName
=
null
)
public
function
addForeignKeyConstraint
(
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
[]
,
$constraintName
=
null
)
{
$constraintName
=
$constraintName
?:
$this
->
_generateIdentifierName
(
array_merge
((
array
)
$this
->
getName
(),
$localColumnNames
),
"fk"
,
$this
->
_getMaxIdentifierLength
());
...
...
@@ -407,7 +407,7 @@ class Table extends AbstractAsset
*
* @return self
*/
public
function
addUnnamedForeignKeyConstraint
(
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
array
()
)
public
function
addUnnamedForeignKeyConstraint
(
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
[]
)
{
return
$this
->
addForeignKeyConstraint
(
$foreignTable
,
$localColumnNames
,
$foreignColumnNames
,
$options
);
}
...
...
@@ -427,7 +427,7 @@ class Table extends AbstractAsset
*
* @throws SchemaException
*/
public
function
addNamedForeignKeyConstraint
(
$name
,
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
array
()
)
public
function
addNamedForeignKeyConstraint
(
$name
,
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
[]
)
{
if
(
$foreignTable
instanceof
Table
)
{
foreach
(
$foreignColumnNames
as
$columnName
)
{
...
...
@@ -496,7 +496,7 @@ class Table extends AbstractAsset
{
$indexName
=
$indexCandidate
->
getName
();
$indexName
=
$this
->
normalizeIdentifier
(
$indexName
);
$replacedImplicitIndexes
=
array
()
;
$replacedImplicitIndexes
=
[]
;
foreach
(
$this
->
implicitIndexes
as
$name
=>
$implicitIndex
)
{
if
(
$implicitIndex
->
isFullfilledBy
(
$indexCandidate
)
&&
isset
(
$this
->
_indexes
[
$name
]))
{
...
...
@@ -547,7 +547,7 @@ class Table extends AbstractAsset
// In the case of __construct calling this method during hydration from schema-details all the explicitly added indexes
// lead to duplicates. This creates computation overhead in this case, however no duplicate indexes are ever added (based on columns).
$indexName
=
$this
->
_generateIdentifierName
(
array_merge
(
array
(
$this
->
getName
())
,
$constraint
->
getColumns
()),
array_merge
(
[
$this
->
getName
()]
,
$constraint
->
getColumns
()),
"idx"
,
$this
->
_getMaxIdentifierLength
()
);
...
...
lib/Doctrine/DBAL/Schema/TableDiff.php
View file @
4f7c1b72
...
...
@@ -52,70 +52,70 @@ class TableDiff
*
* @var \Doctrine\DBAL\Schema\ColumnDiff[]
*/
public
$changedColumns
=
array
()
;
public
$changedColumns
=
[]
;
/**
* All removed fields.
*
* @var \Doctrine\DBAL\Schema\Column[]
*/
public
$removedColumns
=
array
()
;
public
$removedColumns
=
[]
;
/**
* Columns that are only renamed from key to column instance name.
*
* @var \Doctrine\DBAL\Schema\Column[]
*/
public
$renamedColumns
=
array
()
;
public
$renamedColumns
=
[]
;
/**
* All added indexes.
*
* @var \Doctrine\DBAL\Schema\Index[]
*/
public
$addedIndexes
=
array
()
;
public
$addedIndexes
=
[]
;
/**
* All changed indexes.
*
* @var \Doctrine\DBAL\Schema\Index[]
*/
public
$changedIndexes
=
array
()
;
public
$changedIndexes
=
[]
;
/**
* All removed indexes
*
* @var \Doctrine\DBAL\Schema\Index[]
*/
public
$removedIndexes
=
array
()
;
public
$removedIndexes
=
[]
;
/**
* Indexes that are only renamed but are identical otherwise.
*
* @var \Doctrine\DBAL\Schema\Index[]
*/
public
$renamedIndexes
=
array
()
;
public
$renamedIndexes
=
[]
;
/**
* All added foreign key definitions
*
* @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[]
*/
public
$addedForeignKeys
=
array
()
;
public
$addedForeignKeys
=
[]
;
/**
* All changed foreign keys
*
* @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[]
*/
public
$changedForeignKeys
=
array
()
;
public
$changedForeignKeys
=
[]
;
/**
* All removed foreign keys
*
* @var \Doctrine\DBAL\Schema\ForeignKeyConstraint[]
*/
public
$removedForeignKeys
=
array
()
;
public
$removedForeignKeys
=
[]
;
/**
* @var \Doctrine\DBAL\Schema\Table
...
...
@@ -134,9 +134,9 @@ class TableDiff
* @param \Doctrine\DBAL\Schema\Index[] $removedIndexes
* @param \Doctrine\DBAL\Schema\Table|null $fromTable
*/
public
function
__construct
(
$tableName
,
$addedColumns
=
array
()
,
$changedColumns
=
array
(),
$removedColumns
=
array
(),
$addedIndexes
=
array
()
,
$changedIndexes
=
array
(),
$removedIndexes
=
array
()
,
Table
$fromTable
=
null
)
public
function
__construct
(
$tableName
,
$addedColumns
=
[]
,
$changedColumns
=
[],
$removedColumns
=
[],
$addedIndexes
=
[]
,
$changedIndexes
=
[],
$removedIndexes
=
[]
,
Table
$fromTable
=
null
)
{
$this
->
name
=
$tableName
;
$this
->
addedColumns
=
$addedColumns
;
...
...
lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php
View file @
4f7c1b72
...
...
@@ -29,22 +29,22 @@ class CreateSchemaSqlCollector extends AbstractVisitor
/**
* @var array
*/
private
$createNamespaceQueries
=
array
()
;
private
$createNamespaceQueries
=
[]
;
/**
* @var array
*/
private
$createTableQueries
=
array
()
;
private
$createTableQueries
=
[]
;
/**
* @var array
*/
private
$createSequenceQueries
=
array
()
;
private
$createSequenceQueries
=
[]
;
/**
* @var array
*/
private
$createFkConstraintQueries
=
array
()
;
private
$createFkConstraintQueries
=
[]
;
/**
*
...
...
@@ -101,10 +101,10 @@ class CreateSchemaSqlCollector extends AbstractVisitor
*/
public
function
resetQueries
()
{
$this
->
createNamespaceQueries
=
array
()
;
$this
->
createTableQueries
=
array
()
;
$this
->
createSequenceQueries
=
array
()
;
$this
->
createFkConstraintQueries
=
array
()
;
$this
->
createNamespaceQueries
=
[]
;
$this
->
createTableQueries
=
[]
;
$this
->
createSequenceQueries
=
[]
;
$this
->
createFkConstraintQueries
=
[]
;
}
/**
...
...
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
View file @
4f7c1b72
...
...
@@ -106,7 +106,7 @@ class DropSchemaSqlCollector extends AbstractVisitor
*/
public
function
getQueries
()
{
$sql
=
array
()
;
$sql
=
[]
;
foreach
(
$this
->
constraints
as
$fkConstraint
)
{
$localTable
=
$this
->
constraints
[
$fkConstraint
];
...
...
lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php
View file @
4f7c1b72
...
...
@@ -41,11 +41,11 @@ class Graphviz extends AbstractVisitor
$this
->
output
.=
$this
->
createNodeRelation
(
$fkConstraint
->
getLocalTableName
()
.
":col"
.
current
(
$fkConstraint
->
getLocalColumns
())
.
":se"
,
$fkConstraint
->
getForeignTableName
()
.
":col"
.
current
(
$fkConstraint
->
getForeignColumns
())
.
":se"
,
array
(
[
'dir'
=>
'back'
,
'arrowtail'
=>
'dot'
,
'arrowhead'
=>
'normal'
,
)
]
);
}
...
...
@@ -69,10 +69,10 @@ class Graphviz extends AbstractVisitor
{
$this
->
output
.=
$this
->
createNode
(
$table
->
getName
(),
array
(
[
'label'
=>
$this
->
createTableLabel
(
$table
),
'shape'
=>
'plaintext'
,
)
]
);
}
...
...
lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php
View file @
4f7c1b72
...
...
@@ -183,10 +183,10 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
*/
private
function
partitionSchema
(
Schema
$schema
)
{
return
array
(
return
[
$this
->
extractSchemaFederation
(
$schema
,
false
),
$this
->
extractSchemaFederation
(
$schema
,
true
),
)
;
]
;
}
/**
...
...
lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php
View file @
4f7c1b72
...
...
@@ -53,7 +53,7 @@ class MultiTenantVisitor implements Visitor
/**
* @var array
*/
private
$excludedTables
=
array
()
;
private
$excludedTables
=
[]
;
/**
* @var string
...
...
lib/Doctrine/DBAL/Statement.php
View file @
4f7c1b72
...
...
@@ -44,14 +44,14 @@ class Statement implements \IteratorAggregate, DriverStatement
*
* @var array
*/
protected
$params
=
array
()
;
protected
$params
=
[]
;
/**
* The parameter types.
*
* @var array
*/
protected
$types
=
array
()
;
protected
$types
=
[]
;
/**
* The underlying driver statement.
...
...
@@ -181,8 +181,8 @@ class Statement implements \IteratorAggregate, DriverStatement
if
(
$logger
)
{
$logger
->
stopQuery
();
}
$this
->
params
=
array
()
;
$this
->
types
=
array
()
;
$this
->
params
=
[]
;
$this
->
types
=
[]
;
return
$stmt
;
}
...
...
lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php
View file @
4f7c1b72
...
...
@@ -45,11 +45,11 @@ class ImportCommand extends Command
$this
->
setName
(
'dbal:import'
)
->
setDescription
(
'Import SQL file(s) directly to Database.'
)
->
setDefinition
(
array
(
->
setDefinition
(
[
new
InputArgument
(
'file'
,
InputArgument
::
REQUIRED
|
InputArgument
::
IS_ARRAY
,
'File path(s) of SQL to be executed.'
)
)
)
]
)
->
setHelp
(
<<<EOT
Import SQL file(s) directly to Database.
EOT
...
...
lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
View file @
4f7c1b72
...
...
@@ -30,7 +30,7 @@ class ReservedWordsCommand extends Command
/**
* @var array
*/
private
$keywordListClasses
=
array
(
private
$keywordListClasses
=
[
'mysql'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords'
,
'mysql57'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords'
,
'sqlserver'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords'
,
...
...
@@ -47,7 +47,7 @@ class ReservedWordsCommand extends Command
'sqlanywhere11'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords'
,
'sqlanywhere12'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords'
,
'sqlanywhere16'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords'
,
)
;
]
;
/**
* If you want to add or replace a keywords list use this command.
...
...
@@ -120,7 +120,7 @@ EOT
$keywordLists
=
(
array
)
$input
->
getOption
(
'list'
);
if
(
!
$keywordLists
)
{
$keywordLists
=
array
(
$keywordLists
=
[
'mysql'
,
'mysql57'
,
'pgsql'
,
...
...
@@ -135,7 +135,7 @@ EOT
'sqlanywhere11'
,
'sqlanywhere12'
,
'sqlanywhere16'
,
)
;
]
;
}
$keywords
=
[];
...
...
lib/Doctrine/DBAL/Types/JsonArrayType.php
View file @
4f7c1b72
...
...
@@ -36,7 +36,7 @@ class JsonArrayType extends JsonType
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
if
(
$value
===
null
||
$value
===
''
)
{
return
array
()
;
return
[]
;
}
$value
=
(
is_resource
(
$value
))
?
stream_get_contents
(
$value
)
:
$value
;
...
...
lib/Doctrine/DBAL/Types/SimpleArrayType.php
View file @
4f7c1b72
...
...
@@ -57,7 +57,7 @@ class SimpleArrayType extends Type
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
if
(
$value
===
null
)
{
return
array
()
;
return
[]
;
}
$value
=
(
is_resource
(
$value
))
?
stream_get_contents
(
$value
)
:
$value
;
...
...
lib/Doctrine/DBAL/Types/Type.php
View file @
4f7c1b72
...
...
@@ -64,14 +64,14 @@ abstract class Type
*
* @var array
*/
private
static
$_typeObjects
=
array
()
;
private
static
$_typeObjects
=
[]
;
/**
* The map of supported doctrine mapping types.
*
* @var array
*/
private
static
$_typesMap
=
array
(
private
static
$_typesMap
=
[
self
::
TARRAY
=>
ArrayType
::
class
,
self
::
SIMPLE_ARRAY
=>
SimpleArrayType
::
class
,
self
::
JSON_ARRAY
=>
JsonArrayType
::
class
,
...
...
@@ -97,7 +97,7 @@ abstract class Type
self
::
BLOB
=>
BlobType
::
class
,
self
::
GUID
=>
GuidType
::
class
,
self
::
DATEINTERVAL
=>
DateIntervalType
::
class
,
)
;
]
;
/**
* Prevents instantiation and forces use of the factory method.
...
...
@@ -333,7 +333,7 @@ abstract class Type
*/
public
function
getMappedDatabaseTypes
(
AbstractPlatform
$platform
)
{
return
array
()
;
return
[]
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment