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
5600b867
Unverified
Commit
5600b867
authored
Jan 22, 2019
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPStan Level 5
parent
9b88bf37
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
50 additions
and
35 deletions
+50
-35
ResultCacheStatement.php
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
+5
-2
DBALException.php
lib/Doctrine/DBAL/DBALException.php
+5
-10
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+1
-1
SchemaCreateTableEventArgs.php
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
+4
-5
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+16
-2
ExpressionBuilder.php
lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
+2
-2
SQLParserUtils.php
lib/Doctrine/DBAL/SQLParserUtils.php
+3
-3
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+1
-1
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+1
-1
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+2
-2
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+1
-1
DropSchemaSqlCollector.php
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
+3
-0
Graphviz.php
lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php
+1
-3
PoolingShardConnection.php
lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php
+1
-1
phpstan.neon.dist
phpstan.neon.dist
+4
-1
No files found.
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
View file @
5600b867
...
@@ -12,6 +12,7 @@ use IteratorAggregate;
...
@@ -12,6 +12,7 @@ use IteratorAggregate;
use
PDO
;
use
PDO
;
use
function
array_merge
;
use
function
array_merge
;
use
function
array_values
;
use
function
array_values
;
use
function
assert
;
use
function
reset
;
use
function
reset
;
/**
/**
...
@@ -41,7 +42,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
...
@@ -41,7 +42,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
/** @var int */
/** @var int */
private
$lifetime
;
private
$lifetime
;
/** @var Statement */
/** @var
Result
Statement */
private
$statement
;
private
$statement
;
/**
/**
...
@@ -62,7 +63,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
...
@@ -62,7 +63,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
* @param string $realKey
* @param string $realKey
* @param int $lifetime
* @param int $lifetime
*/
*/
public
function
__construct
(
Statement
$stmt
,
Cache
$resultCache
,
$cacheKey
,
$realKey
,
$lifetime
)
public
function
__construct
(
Result
Statement
$stmt
,
Cache
$resultCache
,
$cacheKey
,
$realKey
,
$lifetime
)
{
{
$this
->
statement
=
$stmt
;
$this
->
statement
=
$stmt
;
$this
->
resultCache
=
$resultCache
;
$this
->
resultCache
=
$resultCache
;
...
@@ -196,6 +197,8 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
...
@@ -196,6 +197,8 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
*/
*/
public
function
rowCount
()
public
function
rowCount
()
{
{
assert
(
$this
->
statement
instanceof
Statement
);
return
$this
->
statement
->
rowCount
();
return
$this
->
statement
->
rowCount
();
}
}
}
}
lib/Doctrine/DBAL/DBALException.php
View file @
5600b867
...
@@ -128,11 +128,10 @@ class DBALException extends Exception
...
@@ -128,11 +128,10 @@ class DBALException extends Exception
}
}
/**
/**
* @param Exception $driverEx
* @param string $sql
* @param string $sql
* @param mixed[] $params
* @param mixed[] $params
*
*
* @return
\Doctrine\DBAL\DBALException
* @return
self
*/
*/
public
static
function
driverExceptionDuringQuery
(
Driver
$driver
,
Throwable
$driverEx
,
$sql
,
array
$params
=
[])
public
static
function
driverExceptionDuringQuery
(
Driver
$driver
,
Throwable
$driverEx
,
$sql
,
array
$params
=
[])
{
{
...
@@ -146,9 +145,7 @@ class DBALException extends Exception
...
@@ -146,9 +145,7 @@ class DBALException extends Exception
}
}
/**
/**
* @param Exception $driverEx
* @return self
*
* @return \Doctrine\DBAL\DBALException
*/
*/
public
static
function
driverException
(
Driver
$driver
,
Throwable
$driverEx
)
public
static
function
driverException
(
Driver
$driver
,
Throwable
$driverEx
)
{
{
...
@@ -156,9 +153,7 @@ class DBALException extends Exception
...
@@ -156,9 +153,7 @@ class DBALException extends Exception
}
}
/**
/**
* @param Exception $driverEx
* @return self
*
* @return \Doctrine\DBAL\DBALException
*/
*/
private
static
function
wrapException
(
Driver
$driver
,
Throwable
$driverEx
,
$msg
)
private
static
function
wrapException
(
Driver
$driver
,
Throwable
$driverEx
,
$msg
)
{
{
...
...
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
5600b867
...
@@ -240,7 +240,7 @@ class OCI8Statement implements IteratorAggregate, Statement
...
@@ -240,7 +240,7 @@ class OCI8Statement implements IteratorAggregate, Statement
* where the token was found.
* where the token was found.
*
*
* @param string $statement The SQL statement to parse
* @param string $statement The SQL statement to parse
* @param
string
$offset The offset to start searching from
* @param
int
$offset The offset to start searching from
* @param string $regex The regex containing token pattern
* @param string $regex The regex containing token pattern
*
*
* @return string|null Token or NULL if not found
* @return string|null Token or NULL if not found
...
...
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
View file @
5600b867
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
namespace
Doctrine\DBAL\Event
;
namespace
Doctrine\DBAL\Event
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Schema\Column
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\Table
;
use
function
array_merge
;
use
function
array_merge
;
use
function
is_array
;
use
function
is_array
;
...
@@ -16,7 +15,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
...
@@ -16,7 +15,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
/** @var Table */
/** @var Table */
private
$table
;
private
$table
;
/** @var
Column
[] */
/** @var
mixed[]
[] */
private
$columns
;
private
$columns
;
/** @var mixed[] */
/** @var mixed[] */
...
@@ -29,8 +28,8 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
...
@@ -29,8 +28,8 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
private
$sql
=
[];
private
$sql
=
[];
/**
/**
* @param
Column
[] $columns
* @param
mixed[]
[] $columns
* @param mixed[] $options
* @param mixed[]
$options
*/
*/
public
function
__construct
(
Table
$table
,
array
$columns
,
array
$options
,
AbstractPlatform
$platform
)
public
function
__construct
(
Table
$table
,
array
$columns
,
array
$options
,
AbstractPlatform
$platform
)
{
{
...
@@ -49,7 +48,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
...
@@ -49,7 +48,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
}
}
/**
/**
* @return
Column
[]
* @return
mixed[]
[]
*/
*/
public
function
getColumns
()
public
function
getColumns
()
{
{
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
5600b867
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
Doctrine\DBAL\Portability
;
namespace
Doctrine\DBAL\Portability
;
use
Doctrine\DBAL\Driver\ResultStatement
;
use
Doctrine\DBAL\Driver\Statement
as
DriverStatement
;
use
Doctrine\DBAL\Driver\Statement
as
DriverStatement
;
use
Doctrine\DBAL\Driver\StatementIterator
;
use
Doctrine\DBAL\Driver\StatementIterator
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\FetchMode
;
...
@@ -9,6 +10,7 @@ use Doctrine\DBAL\ParameterType;
...
@@ -9,6 +10,7 @@ use Doctrine\DBAL\ParameterType;
use
IteratorAggregate
;
use
IteratorAggregate
;
use
PDO
;
use
PDO
;
use
function
array_change_key_case
;
use
function
array_change_key_case
;
use
function
assert
;
use
function
is_string
;
use
function
is_string
;
use
function
rtrim
;
use
function
rtrim
;
...
@@ -20,7 +22,7 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -20,7 +22,7 @@ class Statement implements IteratorAggregate, DriverStatement
/** @var int */
/** @var int */
private
$portability
;
private
$portability
;
/** @var DriverStatement */
/** @var DriverStatement
|ResultStatement
*/
private
$stmt
;
private
$stmt
;
/** @var int */
/** @var int */
...
@@ -32,7 +34,7 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -32,7 +34,7 @@ class Statement implements IteratorAggregate, DriverStatement
/**
/**
* Wraps <tt>Statement</tt> and applies portability measures.
* Wraps <tt>Statement</tt> and applies portability measures.
*
*
* @param DriverStatement $stmt
* @param DriverStatement
|ResultStatement
$stmt
*/
*/
public
function
__construct
(
$stmt
,
Connection
$conn
)
public
function
__construct
(
$stmt
,
Connection
$conn
)
{
{
...
@@ -46,6 +48,8 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -46,6 +48,8 @@ class Statement implements IteratorAggregate, DriverStatement
*/
*/
public
function
bindParam
(
$column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
{
assert
(
$this
->
stmt
instanceof
DriverStatement
);
return
$this
->
stmt
->
bindParam
(
$column
,
$variable
,
$type
,
$length
);
return
$this
->
stmt
->
bindParam
(
$column
,
$variable
,
$type
,
$length
);
}
}
...
@@ -54,6 +58,8 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -54,6 +58,8 @@ class Statement implements IteratorAggregate, DriverStatement
*/
*/
public
function
bindValue
(
$param
,
$value
,
$type
=
ParameterType
::
STRING
)
public
function
bindValue
(
$param
,
$value
,
$type
=
ParameterType
::
STRING
)
{
{
assert
(
$this
->
stmt
instanceof
DriverStatement
);
return
$this
->
stmt
->
bindValue
(
$param
,
$value
,
$type
);
return
$this
->
stmt
->
bindValue
(
$param
,
$value
,
$type
);
}
}
...
@@ -78,6 +84,8 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -78,6 +84,8 @@ class Statement implements IteratorAggregate, DriverStatement
*/
*/
public
function
errorCode
()
public
function
errorCode
()
{
{
assert
(
$this
->
stmt
instanceof
DriverStatement
);
return
$this
->
stmt
->
errorCode
();
return
$this
->
stmt
->
errorCode
();
}
}
...
@@ -86,6 +94,8 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -86,6 +94,8 @@ class Statement implements IteratorAggregate, DriverStatement
*/
*/
public
function
errorInfo
()
public
function
errorInfo
()
{
{
assert
(
$this
->
stmt
instanceof
DriverStatement
);
return
$this
->
stmt
->
errorInfo
();
return
$this
->
stmt
->
errorInfo
();
}
}
...
@@ -94,6 +104,8 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -94,6 +104,8 @@ class Statement implements IteratorAggregate, DriverStatement
*/
*/
public
function
execute
(
$params
=
null
)
public
function
execute
(
$params
=
null
)
{
{
assert
(
$this
->
stmt
instanceof
DriverStatement
);
return
$this
->
stmt
->
execute
(
$params
);
return
$this
->
stmt
->
execute
(
$params
);
}
}
...
@@ -228,6 +240,8 @@ class Statement implements IteratorAggregate, DriverStatement
...
@@ -228,6 +240,8 @@ class Statement implements IteratorAggregate, DriverStatement
*/
*/
public
function
rowCount
()
public
function
rowCount
()
{
{
assert
(
$this
->
stmt
instanceof
DriverStatement
);
return
$this
->
stmt
->
rowCount
();
return
$this
->
stmt
->
rowCount
();
}
}
}
}
lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
View file @
5600b867
...
@@ -286,8 +286,8 @@ class ExpressionBuilder
...
@@ -286,8 +286,8 @@ class ExpressionBuilder
/**
/**
* Quotes a given input parameter.
* Quotes a given input parameter.
*
*
* @param mixed
$input The parameter to be quoted.
* @param mixed $input The parameter to be quoted.
* @param
string
|null $type The type of the parameter.
* @param
int
|null $type The type of the parameter.
*
*
* @return string
* @return string
*/
*/
...
...
lib/Doctrine/DBAL/SQLParserUtils.php
View file @
5600b867
...
@@ -36,13 +36,13 @@ class SQLParserUtils
...
@@ -36,13 +36,13 @@ class SQLParserUtils
/**
/**
* Gets an array of the placeholders in an sql statements as keys and their positions in the query string.
* Gets an array of the placeholders in an sql statements as keys and their positions in the query string.
*
*
*
Returns an integer => integer pair (indexed from zero) for a positional statement
*
For a statement with positional parameters, returns a zero-indexed list of placeholder position.
*
and a string => int[] pair for a named statement
.
*
For a statement with named parameters, returns a map of placeholder positions to their parameter names
.
*
*
* @param string $statement
* @param string $statement
* @param bool $isPositional
* @param bool $isPositional
*
*
* @return int[]
* @return int[]
|string[]
*/
*/
public
static
function
getPlaceholderPositions
(
$statement
,
$isPositional
=
true
)
public
static
function
getPlaceholderPositions
(
$statement
,
$isPositional
=
true
)
{
{
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
5600b867
...
@@ -268,7 +268,7 @@ abstract class AbstractSchemaManager
...
@@ -268,7 +268,7 @@ abstract class AbstractSchemaManager
}
}
$indexes
=
$this
->
listTableIndexes
(
$tableName
);
$indexes
=
$this
->
listTableIndexes
(
$tableName
);
return
new
Table
(
$tableName
,
$columns
,
$indexes
,
$foreignKeys
,
false
,
[]
);
return
new
Table
(
$tableName
,
$columns
,
$indexes
,
$foreignKeys
);
}
}
/**
/**
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
5600b867
...
@@ -216,7 +216,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -216,7 +216,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
protected
function
_getPortableViewDefinition
(
$view
)
protected
function
_getPortableViewDefinition
(
$view
)
{
{
// @todo
// @todo
return
new
View
(
$view
[
'name'
],
null
);
return
new
View
(
$view
[
'name'
],
''
);
}
}
/**
/**
...
...
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
5600b867
...
@@ -283,9 +283,9 @@ class SqliteSchemaManager extends AbstractSchemaManager
...
@@ -283,9 +283,9 @@ class SqliteSchemaManager extends AbstractSchemaManager
continue
;
continue
;
}
}
$type
=
$this
->
extractDoctrineTypeFromComment
(
$comment
,
null
);
$type
=
$this
->
extractDoctrineTypeFromComment
(
$comment
,
''
);
if
(
$type
!==
null
)
{
if
(
$type
!==
''
)
{
$column
->
setType
(
Type
::
getType
(
$type
));
$column
->
setType
(
Type
::
getType
(
$type
));
$comment
=
$this
->
removeDoctrineTypeFromComment
(
$comment
,
$type
);
$comment
=
$this
->
removeDoctrineTypeFromComment
(
$comment
,
$type
);
...
...
lib/Doctrine/DBAL/Schema/Table.php
View file @
5600b867
...
@@ -425,7 +425,7 @@ class Table extends AbstractAsset
...
@@ -425,7 +425,7 @@ class Table extends AbstractAsset
/**
/**
* @param string $name
* @param string $name
* @param
string
$value
* @param
mixed
$value
*
*
* @return self
* @return self
*/
*/
...
...
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
View file @
5600b867
...
@@ -78,15 +78,18 @@ class DropSchemaSqlCollector extends AbstractVisitor
...
@@ -78,15 +78,18 @@ class DropSchemaSqlCollector extends AbstractVisitor
{
{
$sql
=
[];
$sql
=
[];
/** @var ForeignKeyConstraint $fkConstraint */
foreach
(
$this
->
constraints
as
$fkConstraint
)
{
foreach
(
$this
->
constraints
as
$fkConstraint
)
{
$localTable
=
$this
->
constraints
[
$fkConstraint
];
$localTable
=
$this
->
constraints
[
$fkConstraint
];
$sql
[]
=
$this
->
platform
->
getDropForeignKeySQL
(
$fkConstraint
,
$localTable
);
$sql
[]
=
$this
->
platform
->
getDropForeignKeySQL
(
$fkConstraint
,
$localTable
);
}
}
/** @var Sequence $sequence */
foreach
(
$this
->
sequences
as
$sequence
)
{
foreach
(
$this
->
sequences
as
$sequence
)
{
$sql
[]
=
$this
->
platform
->
getDropSequenceSQL
(
$sequence
);
$sql
[]
=
$this
->
platform
->
getDropSequenceSQL
(
$sequence
);
}
}
/** @var Table $table */
foreach
(
$this
->
tables
as
$table
)
{
foreach
(
$this
->
tables
as
$table
)
{
$sql
[]
=
$this
->
platform
->
getDropTableSQL
(
$table
);
$sql
[]
=
$this
->
platform
->
getDropTableSQL
(
$table
);
}
}
...
...
lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php
View file @
5600b867
...
@@ -8,8 +8,6 @@ use Doctrine\DBAL\Schema\Table;
...
@@ -8,8 +8,6 @@ use Doctrine\DBAL\Schema\Table;
use
function
current
;
use
function
current
;
use
function
file_put_contents
;
use
function
file_put_contents
;
use
function
in_array
;
use
function
in_array
;
use
function
mt_rand
;
use
function
sha1
;
use
function
strtolower
;
use
function
strtolower
;
/**
/**
...
@@ -41,7 +39,7 @@ class Graphviz extends AbstractVisitor
...
@@ -41,7 +39,7 @@ class Graphviz extends AbstractVisitor
*/
*/
public
function
acceptSchema
(
Schema
$schema
)
public
function
acceptSchema
(
Schema
$schema
)
{
{
$this
->
output
=
'digraph "'
.
sha1
(
mt_rand
()
)
.
'" {'
.
"
\n
"
;
$this
->
output
=
'digraph "'
.
$schema
->
getName
(
)
.
'" {'
.
"
\n
"
;
$this
->
output
.=
'splines = true;'
.
"
\n
"
;
$this
->
output
.=
'splines = true;'
.
"
\n
"
;
$this
->
output
.=
'overlap = false;'
.
"
\n
"
;
$this
->
output
.=
'overlap = false;'
.
"
\n
"
;
$this
->
output
.=
'outputorder=edgesfirst;'
.
"
\n
"
;
$this
->
output
.=
'outputorder=edgesfirst;'
.
"
\n
"
;
...
...
lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php
View file @
5600b867
...
@@ -205,7 +205,7 @@ class PoolingShardConnection extends Connection
...
@@ -205,7 +205,7 @@ class PoolingShardConnection extends Connection
/**
/**
* Connects to a specific connection.
* Connects to a specific connection.
*
*
* @param string $shardId
* @param string
|int
$shardId
*
*
* @return \Doctrine\DBAL\Driver\Connection
* @return \Doctrine\DBAL\Driver\Connection
*/
*/
...
...
phpstan.neon.dist
View file @
5600b867
parameters:
parameters:
level:
4
level:
5
paths:
paths:
- %currentWorkingDirectory%/lib
- %currentWorkingDirectory%/lib
autoload_files:
autoload_files:
...
@@ -26,6 +26,9 @@ parameters:
...
@@ -26,6 +26,9 @@ parameters:
# http://php.net/manual/en/pdo.sqlitecreatefunction.php
# http://php.net/manual/en/pdo.sqlitecreatefunction.php
- '~^Call to an undefined method Doctrine\\DBAL\\Driver\\PDOConnection::sqliteCreateFunction\(\)\.\z~'
- '~^Call to an undefined method Doctrine\\DBAL\\Driver\\PDOConnection::sqliteCreateFunction\(\)\.\z~'
# https://github.com/JetBrains/phpstorm-stubs/pull/488
- '~^Parameter #1 \$byteCount of function SQLSRV_SQLTYPE_VARBINARY expects int, string given\.\z~'
# legacy variadic-like signature
# legacy variadic-like signature
- '~^Method Doctrine\\DBAL\\Driver\\Connection::query\(\) invoked with \d+ parameters?, 0 required\.\z~'
- '~^Method Doctrine\\DBAL\\Driver\\Connection::query\(\) invoked with \d+ parameters?, 0 required\.\z~'
...
...
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