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
20c5931c
Unverified
Commit
20c5931c
authored
Apr 03, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Variable method call on an object
parent
e6765782
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
9 deletions
+38
-9
phpstan.neon.dist
phpstan.neon.dist
+7
-0
ConnectionTest.php
tests/ConnectionTest.php
+31
-9
No files found.
phpstan.neon.dist
View file @
20c5931c
...
...
@@ -103,5 +103,12 @@ parameters:
message: '~^Variable property access on object\.~'
paths:
- %currentWorkingDirectory%/src/Driver/*/*Statement.php
# Some APIs use variable method calls internally
-
message: '~^Variable method call on .*~'
paths:
- %currentWorkingDirectory%/src/Schema/AbstractSchemaManager.php
- %currentWorkingDirectory%/src/Schema/Column.php
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
tests/ConnectionTest.php
View file @
20c5931c
...
...
@@ -183,7 +183,7 @@ class ConnectionTest extends TestCase
* @requires extension pdo_sqlite
* @dataProvider getQueryMethods
*/
public
function
testDriverExceptionIsWrapped
(
string
$method
)
:
void
public
function
testDriverExceptionIsWrapped
(
callable
$callback
)
:
void
{
$this
->
expectException
(
DBALException
::
class
);
$this
->
expectExceptionMessage
(
"An exception occurred while executing 'MUUHAAAAHAAAA':
\n\n
SQLSTATE[HY000]: General error: 1 near
\"
MUUHAAAAHAAAA
\"
"
);
...
...
@@ -193,20 +193,42 @@ class ConnectionTest extends TestCase
'memory'
=>
true
,
]);
$c
onnection
->
$method
(
'MUUHAAAAHAAAA'
);
$c
allback
(
$connection
,
'MUUHAAAAHAAAA'
);
}
/**
* @return
array<int, array<int, mixed
>>
* @return
iterable<string, array<int, callable
>>
*/
public
static
function
getQueryMethods
()
:
iterable
{
return
[
[
'exec'
],
[
'query'
],
[
'executeQuery'
],
[
'executeUpdate'
],
[
'prepare'
],
yield
'exec'
=>
[
static
function
(
Connection
$connection
,
string
$statement
)
:
void
{
$connection
->
exec
(
$statement
);
},
];
yield
'query'
=>
[
static
function
(
Connection
$connection
,
string
$statement
)
:
void
{
$connection
->
query
(
$statement
);
},
];
yield
'executeQuery'
=>
[
static
function
(
Connection
$connection
,
string
$statement
)
:
void
{
$connection
->
executeQuery
(
$statement
);
},
];
yield
'executeUpdate'
=>
[
static
function
(
Connection
$connection
,
string
$statement
)
:
void
{
$connection
->
executeUpdate
(
$statement
);
},
];
yield
'prepare'
=>
[
static
function
(
Connection
$connection
,
string
$statement
)
:
void
{
$connection
->
prepare
(
$statement
);
},
];
}
...
...
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