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
8d7874f5
Unverified
Commit
8d7874f5
authored
May 30, 2019
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3576 from jwage/types-root-namespace
Add proper types to root Doctrine\DBAL namespace.
parents
1e2d36b2
663975d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
44 deletions
+17
-44
Configuration.php
lib/Doctrine/DBAL/Configuration.php
+10
-21
DBALException.php
lib/Doctrine/DBAL/DBALException.php
+4
-13
SQLParserUtils.php
lib/Doctrine/DBAL/SQLParserUtils.php
+3
-6
ConfigurationTest.php
tests/Doctrine/Tests/DBAL/ConfigurationTest.php
+0
-4
No files found.
lib/Doctrine/DBAL/Configuration.php
View file @
8d7874f5
...
...
@@ -44,20 +44,16 @@ class Configuration
/**
* Gets the cache driver implementation that is used for query result caching.
*
* @return Cache|null
*/
public
function
getResultCacheImpl
()
public
function
getResultCacheImpl
()
:
?
Cache
{
return
$this
->
_attributes
[
'resultCacheImpl'
]
??
null
;
}
/**
* Sets the cache driver implementation that is used for query result caching.
*
* @return void
*/
public
function
setResultCacheImpl
(
Cache
$cacheImpl
)
public
function
setResultCacheImpl
(
Cache
$cacheImpl
)
:
void
{
$this
->
_attributes
[
'resultCacheImpl'
]
=
$cacheImpl
;
}
...
...
@@ -70,12 +66,8 @@ class Configuration
* {AbstractSchemaManager#createSchema()}.
*
* @deprecated Use Configuration::setSchemaAssetsFilter() instead
*
* @param string $filterExpression
*
* @return void
*/
public
function
setFilterSchemaAssetsExpression
(
$filterExpression
)
public
function
setFilterSchemaAssetsExpression
(
?
string
$filterExpression
)
:
void
{
$this
->
_attributes
[
'filterSchemaAssetsExpression'
]
=
$filterExpression
;
if
(
$filterExpression
)
{
...
...
@@ -85,17 +77,14 @@ class Configuration
}
}
/**
* @param string $filterExpression
*/
private
function
buildSchemaAssetsFilterFromExpression
(
$filterExpression
)
:
callable
private
function
buildSchemaAssetsFilterFromExpression
(
string
$filterExpression
)
:
callable
{
return
static
function
(
$assetName
)
use
(
$filterExpression
)
{
return
static
function
(
$assetName
)
use
(
$filterExpression
)
:
bool
{
if
(
$assetName
instanceof
AbstractAsset
)
{
$assetName
=
$assetName
->
getName
();
}
return
preg_match
(
$filterExpression
,
$assetName
);
return
preg_match
(
$filterExpression
,
$assetName
)
>
0
;
};
}
...
...
@@ -124,13 +113,13 @@ class Configuration
* transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either
* the method commit or the method rollback. By default, new connections are in auto-commit mode.
*
* @see
getAutoCommit
* @see getAutoCommit
*
* @param bool $autoCommit True to enable auto-commit mode; false to disable it.
*/
public
function
setAutoCommit
(
$autoCommit
)
public
function
setAutoCommit
(
bool
$autoCommit
)
:
void
{
$this
->
_attributes
[
'autoCommit'
]
=
(
bool
)
$autoCommit
;
$this
->
_attributes
[
'autoCommit'
]
=
$autoCommit
;
}
/**
...
...
@@ -140,7 +129,7 @@ class Configuration
*
* @return bool True if auto-commit mode is enabled by default for connections, false otherwise.
*/
public
function
getAutoCommit
()
public
function
getAutoCommit
()
:
bool
{
return
$this
->
_attributes
[
'autoCommit'
]
??
true
;
}
...
...
lib/Doctrine/DBAL/DBALException.php
View file @
8d7874f5
...
...
@@ -21,12 +21,9 @@ use function sprintf;
class
DBALException
extends
Exception
{
/**
* @param string $sql
* @param mixed[] $params
*
* @return self
*/
public
static
function
driverExceptionDuringQuery
(
Driver
$driver
,
Throwable
$driverEx
,
$sql
,
array
$params
=
[])
public
static
function
driverExceptionDuringQuery
(
Driver
$driver
,
Throwable
$driverEx
,
string
$sql
,
array
$params
=
[])
:
self
{
$messageFormat
=
<<<'MESSAGE'
An exception occurred while executing "%s"%s:
...
...
@@ -44,18 +41,12 @@ MESSAGE;
return
static
::
wrapException
(
$driver
,
$driverEx
,
$message
);
}
/**
* @return self
*/
public
static
function
driverException
(
Driver
$driver
,
Throwable
$driverEx
)
public
static
function
driverException
(
Driver
$driver
,
Throwable
$driverEx
)
:
self
{
return
static
::
wrapException
(
$driver
,
$driverEx
,
sprintf
(
'An exception occurred in driver with message: %s'
,
$driverEx
->
getMessage
()));
}
/**
* @return self
*/
private
static
function
wrapException
(
Driver
$driver
,
Throwable
$driverEx
,
$msg
)
private
static
function
wrapException
(
Driver
$driver
,
Throwable
$driverEx
,
string
$msg
)
:
self
{
if
(
$driverEx
instanceof
DriverException
)
{
return
$driverEx
;
...
...
@@ -75,7 +66,7 @@ MESSAGE;
*/
private
static
function
formatParameters
(
array
$params
)
:
string
{
return
'['
.
implode
(
', '
,
array_map
(
static
function
(
$param
)
{
return
'['
.
implode
(
', '
,
array_map
(
static
function
(
$param
)
:
string
{
if
(
is_resource
(
$param
))
{
return
(
string
)
$param
;
}
...
...
lib/Doctrine/DBAL/SQLParserUtils.php
View file @
8d7874f5
...
...
@@ -109,7 +109,7 @@ class SQLParserUtils
*
* @throws SQLParserUtilsException
*/
public
static
function
expandListParameters
(
$query
,
$params
,
$types
)
public
static
function
expandListParameters
(
string
$query
,
array
$params
,
array
$types
)
:
array
{
$isPositional
=
is_int
(
key
(
$params
));
$arrayPositions
=
[];
...
...
@@ -225,11 +225,9 @@ class SQLParserUtils
* 0 => matched fragment string,
* 1 => offset of fragment in $statement
*
* @param string $statement
*
* @return mixed[][]
*/
private
static
function
getUnquotedStatementFragments
(
$statement
)
private
static
function
getUnquotedStatementFragments
(
string
$statement
)
:
array
{
$literal
=
self
::
ESCAPED_SINGLE_QUOTED_TEXT
.
'|'
.
self
::
ESCAPED_DOUBLE_QUOTED_TEXT
.
'|'
.
...
...
@@ -245,14 +243,13 @@ class SQLParserUtils
/**
* @param string $paramName The name of the parameter (without a colon in front)
* @param mixed $paramsOrTypes A hash of parameters or types
* @param bool $isParam
* @param mixed $defaultValue An optional default value. If omitted, an exception is thrown
*
* @return mixed
*
* @throws SQLParserUtilsException
*/
private
static
function
extractParam
(
$paramName
,
$paramsOrTypes
,
$isParam
,
$defaultValue
=
null
)
private
static
function
extractParam
(
string
$paramName
,
$paramsOrTypes
,
bool
$isParam
,
$defaultValue
=
null
)
{
if
(
array_key_exists
(
$paramName
,
$paramsOrTypes
))
{
return
$paramsOrTypes
[
$paramName
];
...
...
tests/Doctrine/Tests/DBAL/ConfigurationTest.php
View file @
8d7874f5
...
...
@@ -47,9 +47,5 @@ class ConfigurationTest extends DbalTestCase
$this
->
config
->
setAutoCommit
(
false
);
self
::
assertFalse
(
$this
->
config
->
getAutoCommit
());
$this
->
config
->
setAutoCommit
(
0
);
self
::
assertFalse
(
$this
->
config
->
getAutoCommit
());
}
}
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