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
6350b9df
Unverified
Commit
6350b9df
authored
Oct 01, 2018
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced class names represented by strings with the ::class syntax
parent
1cbadb3e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
48 deletions
+75
-48
DBALException.php
lib/Doctrine/DBAL/DBALException.php
+2
-4
PDOConnection.php
lib/Doctrine/DBAL/Driver/PDOConnection.php
+1
-1
Driver.php
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
+4
-3
DriverManager.php
lib/Doctrine/DBAL/DriverManager.php
+24
-13
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+2
-4
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+4
-3
ReservedWordsCommand.php
...trine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+34
-17
StatementTest.php
tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
+4
-3
No files found.
lib/Doctrine/DBAL/DBALException.php
View file @
6350b9df
...
...
@@ -35,8 +35,7 @@ class DBALException extends Exception
public
static
function
invalidPlatformSpecified
()
:
self
{
return
new
self
(
"Invalid 'platform' option specified, need to give an instance of "
.
'\Doctrine\DBAL\Platforms\AbstractPlatform.'
"Invalid 'platform' option specified, need to give an instance of "
.
AbstractPlatform
::
class
.
'.'
);
}
...
...
@@ -217,8 +216,7 @@ class DBALException extends Exception
*/
public
static
function
invalidDriverClass
(
$driverClass
)
{
return
new
self
(
"The given 'driverClass' "
.
$driverClass
.
' has to implement the '
.
'\Doctrine\DBAL\Driver interface.'
);
return
new
self
(
"The given 'driverClass' "
.
$driverClass
.
' has to implement the '
.
Driver
::
class
.
' interface.'
);
}
/**
...
...
lib/Doctrine/DBAL/Driver/PDOConnection.php
View file @
6350b9df
...
...
@@ -25,7 +25,7 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
try
{
parent
::
__construct
(
$dsn
,
$user
,
$password
,
$options
);
$this
->
setAttribute
(
PDO
::
ATTR_STATEMENT_CLASS
,
[
'Doctrine\DBAL\Driver\PDOStatement'
,
[]]);
$this
->
setAttribute
(
PDO
::
ATTR_STATEMENT_CLASS
,
[
PDOStatement
::
class
,
[]]);
$this
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
}
catch
(
\PDOException
$exception
)
{
throw
new
PDOException
(
$exception
);
...
...
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
View file @
6350b9df
...
...
@@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Driver\PDOSqlite;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\Driver\AbstractSQLiteDriver
;
use
Doctrine\DBAL\Driver\PDOConnection
;
use
Doctrine\DBAL\Platforms\SqlitePlatform
;
use
PDOException
;
use
function
array_merge
;
...
...
@@ -15,9 +16,9 @@ class Driver extends AbstractSQLiteDriver
{
/** @var mixed[] */
protected
$_userDefinedFunctions
=
[
'sqrt'
=>
[
'callback'
=>
[
'Doctrine\DBAL\Platforms\SqlitePlatform'
,
'udfSqrt'
],
'numArgs'
=>
1
],
'mod'
=>
[
'callback'
=>
[
'Doctrine\DBAL\Platforms\SqlitePlatform'
,
'udfMod'
],
'numArgs'
=>
2
],
'locate'
=>
[
'callback'
=>
[
'Doctrine\DBAL\Platforms\SqlitePlatform'
,
'udfLocate'
],
'numArgs'
=>
-
1
],
'sqrt'
=>
[
'callback'
=>
[
SqlitePlatform
::
class
,
'udfSqrt'
],
'numArgs'
=>
1
],
'mod'
=>
[
'callback'
=>
[
SqlitePlatform
::
class
,
'udfMod'
],
'numArgs'
=>
2
],
'locate'
=>
[
'callback'
=>
[
SqlitePlatform
::
class
,
'udfLocate'
],
'numArgs'
=>
-
1
],
];
/**
...
...
lib/Doctrine/DBAL/DriverManager.php
View file @
6350b9df
...
...
@@ -3,6 +3,17 @@
namespace
Doctrine\DBAL
;
use
Doctrine\Common\EventManager
;
use
Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver
as
DrizzlePDOMySQLDriver
;
use
Doctrine\DBAL\Driver\IBMDB2\DB2Driver
;
use
Doctrine\DBAL\Driver\Mysqli\Driver
as
MySQLiDriver
;
use
Doctrine\DBAL\Driver\OCI8\Driver
as
OCI8Driver
;
use
Doctrine\DBAL\Driver\PDOMySql\Driver
as
PDOMySQLDriver
;
use
Doctrine\DBAL\Driver\PDOOracle\Driver
as
PDOOCIDriver
;
use
Doctrine\DBAL\Driver\PDOPgSql\Driver
as
PDOPgSQLDriver
;
use
Doctrine\DBAL\Driver\PDOSqlite\Driver
as
PDOSQLiteDriver
;
use
Doctrine\DBAL\Driver\PDOSqlsrv\Driver
as
PDOSQLSrvDriver
;
use
Doctrine\DBAL\Driver\SQLAnywhere\Driver
as
SQLAnywhereDriver
;
use
Doctrine\DBAL\Driver\SQLSrv\Driver
as
SQLSrvDriver
;
use
PDO
;
use
function
array_keys
;
use
function
array_map
;
...
...
@@ -31,17 +42,17 @@ final class DriverManager
* @var string[]
*/
private
static
$_driverMap
=
[
'pdo_mysql'
=>
'Doctrine\DBAL\Driver\PDOMySql\Driver'
,
'pdo_sqlite'
=>
'Doctrine\DBAL\Driver\PDOSqlite\Driver'
,
'pdo_pgsql'
=>
'Doctrine\DBAL\Driver\PDOPgSql\Driver'
,
'pdo_oci'
=>
'Doctrine\DBAL\Driver\PDOOracle\Driver'
,
'oci8'
=>
'Doctrine\DBAL\Driver\OCI8\Driver'
,
'ibm_db2'
=>
'Doctrine\DBAL\Driver\IBMDB2\DB2Driver'
,
'pdo_sqlsrv'
=>
'Doctrine\DBAL\Driver\PDOSqlsrv\Driver'
,
'mysqli'
=>
'Doctrine\DBAL\Driver\Mysqli\Driver'
,
'drizzle_pdo_mysql'
=>
'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver'
,
'sqlanywhere'
=>
'Doctrine\DBAL\Driver\SQLAnywhere\Driver'
,
'sqlsrv'
=>
'Doctrine\DBAL\Driver\SQLSrv\Driver'
,
'pdo_mysql'
=>
PDOMySQLDriver
::
class
,
'pdo_sqlite'
=>
PDOSQLiteDriver
::
class
,
'pdo_pgsql'
=>
PDOPgSQLDriver
::
class
,
'pdo_oci'
=>
PDOOCIDriver
::
class
,
'oci8'
=>
OCI8Driver
::
class
,
'ibm_db2'
=>
DB2Driver
::
class
,
'pdo_sqlsrv'
=>
PDOSQLSrvDriver
::
class
,
'mysqli'
=>
MySQLiDriver
::
class
,
'drizzle_pdo_mysql'
=>
DrizzlePDOMySQLDriver
::
class
,
'sqlanywhere'
=>
SQLAnywhereDriver
::
class
,
'sqlsrv'
=>
SQLSrvDriver
::
class
,
];
/**
...
...
@@ -172,7 +183,7 @@ final class DriverManager
$driver
=
new
$className
();
$wrapperClass
=
'Doctrine\DBAL\Connection'
;
$wrapperClass
=
Connection
::
class
;
if
(
isset
(
$params
[
'wrapperClass'
]))
{
if
(
!
is_subclass_of
(
$params
[
'wrapperClass'
],
$wrapperClass
))
{
throw
DBALException
::
invalidWrapperClass
(
$params
[
'wrapperClass'
]);
...
...
@@ -217,7 +228,7 @@ final class DriverManager
throw
DBALException
::
unknownDriver
(
$params
[
'driver'
],
array_keys
(
self
::
$_driverMap
));
}
if
(
isset
(
$params
[
'driverClass'
])
&&
!
in_array
(
'Doctrine\DBAL\Driver'
,
class_implements
(
$params
[
'driverClass'
],
true
)))
{
if
(
isset
(
$params
[
'driverClass'
])
&&
!
in_array
(
Driver
::
class
,
class_implements
(
$params
[
'driverClass'
],
true
)))
{
throw
DBALException
::
invalidDriverClass
(
$params
[
'driverClass'
]);
}
}
...
...
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
6350b9df
...
...
@@ -550,8 +550,7 @@ class SQLAnywherePlatform extends AbstractPlatform
if
(
!
is_string
(
$index
))
{
throw
new
InvalidArgumentException
(
'SQLAnywherePlatform::getDropIndexSQL() expects $index parameter to be string or '
.
'\Doctrine\DBAL\Schema\Index.'
'SQLAnywherePlatform::getDropIndexSQL() expects $index parameter to be string or '
.
Index
::
class
.
'.'
);
}
...
...
@@ -565,8 +564,7 @@ class SQLAnywherePlatform extends AbstractPlatform
if
(
!
is_string
(
$table
))
{
throw
new
InvalidArgumentException
(
'SQLAnywherePlatform::getDropIndexSQL() expects $table parameter to be string or '
.
'\Doctrine\DBAL\Schema\Table.'
'SQLAnywherePlatform::getDropIndexSQL() expects $table parameter to be string or '
.
Index
::
class
.
'.'
);
}
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
6350b9df
...
...
@@ -2,6 +2,7 @@
namespace
Doctrine\DBAL\Portability
;
use
Doctrine\DBAL\Driver\Statement
as
DriverStatement
;
use
Doctrine\DBAL\Driver\StatementIterator
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\ParameterType
;
...
...
@@ -16,12 +17,12 @@ use function rtrim;
*
* @link www.doctrine-project.org
*/
class
Statement
implements
IteratorAggregate
,
\Doctrine\DBAL\Driver\
Statement
class
Statement
implements
IteratorAggregate
,
Driver
Statement
{
/** @var int */
private
$portability
;
/** @var
\Doctrine\DBAL\Driver\
Statement */
/** @var
Driver
Statement */
private
$stmt
;
/** @var int */
...
...
@@ -33,7 +34,7 @@ class Statement implements IteratorAggregate, \Doctrine\DBAL\Driver\Statement
/**
* Wraps <tt>Statement</tt> and applies portability measures.
*
* @param
\Doctrine\DBAL\Driver\
Statement $stmt
* @param
Driver
Statement $stmt
*/
public
function
__construct
(
$stmt
,
Connection
$conn
)
{
...
...
lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
View file @
6350b9df
...
...
@@ -3,7 +3,24 @@
namespace
Doctrine\DBAL\Tools\Console\Command
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Platforms\Keywords\DB2Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\MySQLKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\OracleKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator
;
use
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords
;
use
Doctrine\DBAL\Schema\Schema
;
use
InvalidArgumentException
;
use
Symfony\Component\Console\Command\Command
;
...
...
@@ -18,23 +35,23 @@ class ReservedWordsCommand extends Command
{
/** @var string[] */
private
$keywordListClasses
=
[
'mysql'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords'
,
'mysql57'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords'
,
'mysql80'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords'
,
'sqlserver'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords'
,
'sqlserver2005'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords'
,
'sqlserver2008'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords'
,
'sqlserver2012'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords'
,
'sqlite'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords'
,
'pgsql'
=>
'Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords'
,
'pgsql91'
=>
'Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords'
,
'pgsql92'
=>
'Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords'
,
'oracle'
=>
'Doctrine\DBAL\Platforms\Keywords\OracleKeywords'
,
'db2'
=>
'Doctrine\DBAL\Platforms\Keywords\DB2Keywords'
,
'sqlanywhere'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords'
,
'sqlanywhere11'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords'
,
'sqlanywhere12'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords'
,
'sqlanywhere16'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords'
,
'mysql'
=>
MySQLKeywords
::
class
,
'mysql57'
=>
MySQL57Keywords
::
class
,
'mysql80'
=>
MySQL80Keywords
::
class
,
'sqlserver'
=>
SQLServerKeywords
::
class
,
'sqlserver2005'
=>
SQLServer2005Keywords
::
class
,
'sqlserver2008'
=>
SQLServer2008Keywords
::
class
,
'sqlserver2012'
=>
SQLServer2012Keywords
::
class
,
'sqlite'
=>
SQLiteKeywords
::
class
,
'pgsql'
=>
PostgreSQLKeywords
::
class
,
'pgsql91'
=>
PostgreSQL91Keywords
::
class
,
'pgsql92'
=>
PostgreSQL92Keywords
::
class
,
'oracle'
=>
OracleKeywords
::
class
,
'db2'
=>
DB2Keywords
::
class
,
'sqlanywhere'
=>
SQLAnywhereKeywords
::
class
,
'sqlanywhere11'
=>
SQLAnywhere11Keywords
::
class
,
'sqlanywhere12'
=>
SQLAnywhere12Keywords
::
class
,
'sqlanywhere16'
=>
SQLAnywhere16Keywords
::
class
,
];
/**
...
...
tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
View file @
6350b9df
...
...
@@ -2,6 +2,7 @@
namespace
Doctrine\Tests\DBAL\Portability
;
use
Doctrine\DBAL\Driver\Statement
as
DriverStatement
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Portability\Connection
;
...
...
@@ -19,7 +20,7 @@ class StatementTest extends DbalTestCase
/** @var Statement */
protected
$stmt
;
/** @var
\Doctrine\DBAL\Driver\
Statement|PHPUnit_Framework_MockObject_MockObject */
/** @var
Driver
Statement|PHPUnit_Framework_MockObject_MockObject */
protected
$wrappedStmt
;
/**
...
...
@@ -170,13 +171,13 @@ class StatementTest extends DbalTestCase
/**
* @return Statement
*/
protected
function
createStatement
(
\Doctrine\DBAL\Driver\
Statement
$wrappedStatement
,
Connection
$connection
)
protected
function
createStatement
(
Driver
Statement
$wrappedStatement
,
Connection
$connection
)
{
return
new
Statement
(
$wrappedStatement
,
$connection
);
}
/**
* @return
\Doctrine\DBAL\Driver\
Statement|PHPUnit_Framework_MockObject_MockObject
* @return
Driver
Statement|PHPUnit_Framework_MockObject_MockObject
*/
protected
function
createWrappedStatement
()
{
...
...
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