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
52ad7ab2
Unverified
Commit
52ad7ab2
authored
Jun 06, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix final class member names according to the coding standard
parent
66e9dc34
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
38 deletions
+40
-38
phpstan.neon.dist
phpstan.neon.dist
+1
-1
MysqliStatement.php
src/Driver/Mysqli/MysqliStatement.php
+2
-2
OCI8Connection.php
src/Driver/OCI8/OCI8Connection.php
+15
-13
OCI8Statement.php
src/Driver/OCI8/OCI8Statement.php
+22
-22
No files found.
phpstan.neon.dist
View file @
52ad7ab2
...
@@ -32,7 +32,7 @@ parameters:
...
@@ -32,7 +32,7 @@ parameters:
path: %currentWorkingDirectory%/tests/Functional/DataAccessTest.php
path: %currentWorkingDirectory%/tests/Functional/DataAccessTest.php
# https://github.com/JetBrains/phpstorm-stubs/pull/766
# https://github.com/JetBrains/phpstorm-stubs/pull/766
- '~^Method Doctrine\\DBAL\\Driver\\Mysqli\\MysqliStatement::
_
fetch\(\) never returns null so it can be removed from the return typehint\.$~'
- '~^Method Doctrine\\DBAL\\Driver\\Mysqli\\MysqliStatement::fetch\(\) never returns null so it can be removed from the return typehint\.$~'
# The ReflectionException in the case when the class does not exist is acceptable and does not need to be handled
# The ReflectionException in the case when the class does not exist is acceptable and does not need to be handled
- '~^Parameter #1 \$argument of class ReflectionClass constructor expects class-string<T of object>\|T of object, string given\.$~'
- '~^Parameter #1 \$argument of class ReflectionClass constructor expects class-string<T of object>\|T of object, string given\.$~'
...
...
src/Driver/Mysqli/MysqliStatement.php
View file @
52ad7ab2
...
@@ -301,7 +301,7 @@ final class MysqliStatement implements Statement
...
@@ -301,7 +301,7 @@ final class MysqliStatement implements Statement
/**
/**
* @return mixed[]|false|null
* @return mixed[]|false|null
*/
*/
private
function
_
fetch
()
private
function
fetch
()
{
{
$ret
=
$this
->
stmt
->
fetch
();
$ret
=
$this
->
stmt
->
fetch
();
...
@@ -328,7 +328,7 @@ final class MysqliStatement implements Statement
...
@@ -328,7 +328,7 @@ final class MysqliStatement implements Statement
return
false
;
return
false
;
}
}
$values
=
$this
->
_
fetch
();
$values
=
$this
->
fetch
();
if
(
$values
===
null
)
{
if
(
$values
===
null
)
{
return
false
;
return
false
;
...
...
src/Driver/OCI8/OCI8Connection.php
View file @
52ad7ab2
...
@@ -27,7 +27,7 @@ use const OCI_NO_AUTO_COMMIT;
...
@@ -27,7 +27,7 @@ use const OCI_NO_AUTO_COMMIT;
final
class
OCI8Connection
implements
Connection
,
ServerInfoAwareConnection
final
class
OCI8Connection
implements
Connection
,
ServerInfoAwareConnection
{
{
/** @var resource */
/** @var resource */
pr
otected
$dbh
;
pr
ivate
$connection
;
/** @var ExecutionMode */
/** @var ExecutionMode */
private
$executionMode
;
private
$executionMode
;
...
@@ -45,15 +45,17 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
...
@@ -45,15 +45,17 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
int
$sessionMode
=
OCI_NO_AUTO_COMMIT
,
int
$sessionMode
=
OCI_NO_AUTO_COMMIT
,
bool
$persistent
=
false
bool
$persistent
=
false
)
{
)
{
$dbh
=
$persistent
if
(
$persistent
)
{
?
@
oci_pconnect
(
$username
,
$password
,
$db
,
$charset
,
$sessionMode
)
$connection
=
@
oci_pconnect
(
$username
,
$password
,
$db
,
$charset
,
$sessionMode
);
:
@
oci_connect
(
$username
,
$password
,
$db
,
$charset
,
$sessionMode
);
}
else
{
$connection
=
@
oci_connect
(
$username
,
$password
,
$db
,
$charset
,
$sessionMode
);
}
if
(
$
dbh
===
false
)
{
if
(
$
connection
===
false
)
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
());
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
());
}
}
$this
->
dbh
=
$dbh
;
$this
->
connection
=
$connection
;
$this
->
executionMode
=
new
ExecutionMode
();
$this
->
executionMode
=
new
ExecutionMode
();
}
}
...
@@ -65,10 +67,10 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
...
@@ -65,10 +67,10 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
*/
*/
public
function
getServerVersion
()
:
string
public
function
getServerVersion
()
:
string
{
{
$version
=
oci_server_version
(
$this
->
dbh
);
$version
=
oci_server_version
(
$this
->
connection
);
if
(
$version
===
false
)
{
if
(
$version
===
false
)
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
dbh
));
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
connection
));
}
}
if
(
preg_match
(
'/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/'
,
$version
,
$matches
)
===
0
)
{
if
(
preg_match
(
'/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/'
,
$version
,
$matches
)
===
0
)
{
...
@@ -86,7 +88,7 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
...
@@ -86,7 +88,7 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
public
function
prepare
(
string
$sql
)
:
DriverStatement
public
function
prepare
(
string
$sql
)
:
DriverStatement
{
{
return
new
OCI8Statement
(
$this
->
dbh
,
$sql
,
$this
->
executionMode
);
return
new
OCI8Statement
(
$this
->
connection
,
$sql
,
$this
->
executionMode
);
}
}
public
function
query
(
string
$sql
)
:
ResultStatement
public
function
query
(
string
$sql
)
:
ResultStatement
...
@@ -132,8 +134,8 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
...
@@ -132,8 +134,8 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
public
function
commit
()
:
void
public
function
commit
()
:
void
{
{
if
(
!
oci_commit
(
$this
->
dbh
))
{
if
(
!
oci_commit
(
$this
->
connection
))
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
dbh
));
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
connection
));
}
}
$this
->
executionMode
->
enableAutoCommit
();
$this
->
executionMode
->
enableAutoCommit
();
...
@@ -141,8 +143,8 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
...
@@ -141,8 +143,8 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
public
function
rollBack
()
:
void
public
function
rollBack
()
:
void
{
{
if
(
!
oci_rollback
(
$this
->
dbh
))
{
if
(
!
oci_rollback
(
$this
->
connection
))
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
dbh
));
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
connection
));
}
}
$this
->
executionMode
->
enableAutoCommit
();
$this
->
executionMode
->
enableAutoCommit
();
...
...
src/Driver/OCI8/OCI8Statement.php
View file @
52ad7ab2
...
@@ -41,16 +41,16 @@ use const SQLT_CHR;
...
@@ -41,16 +41,16 @@ use const SQLT_CHR;
final
class
OCI8Statement
implements
Statement
final
class
OCI8Statement
implements
Statement
{
{
/** @var resource */
/** @var resource */
pr
otected
$_dbh
;
pr
ivate
$connection
;
/** @var resource */
/** @var resource */
pr
otected
$_sth
;
pr
ivate
$statement
;
/** @var ExecutionMode */
/** @var ExecutionMode */
pr
otected
$executionMode
;
pr
ivate
$executionMode
;
/** @var string[] */
/** @var string[] */
pr
otected
$_param
Map
=
[];
pr
ivate
$parameter
Map
=
[];
/**
/**
* Holds references to bound parameter values.
* Holds references to bound parameter values.
...
@@ -78,14 +78,14 @@ final class OCI8Statement implements Statement
...
@@ -78,14 +78,14 @@ final class OCI8Statement implements Statement
*/
*/
public
function
__construct
(
$dbh
,
string
$query
,
ExecutionMode
$executionMode
)
public
function
__construct
(
$dbh
,
string
$query
,
ExecutionMode
$executionMode
)
{
{
[
$query
,
$paramMap
]
=
(
new
ConvertPositionalToNamedPlaceholders
())(
$query
);
[
$query
,
$param
eter
Map
]
=
(
new
ConvertPositionalToNamedPlaceholders
())(
$query
);
$st
m
t
=
oci_parse
(
$dbh
,
$query
);
$st
atemen
t
=
oci_parse
(
$dbh
,
$query
);
assert
(
is_resource
(
$st
m
t
));
assert
(
is_resource
(
$st
atemen
t
));
$this
->
_sth
=
$stm
t
;
$this
->
statement
=
$statemen
t
;
$this
->
_dbh
=
$dbh
;
$this
->
connection
=
$dbh
;
$this
->
_paramMap
=
$param
Map
;
$this
->
parameterMap
=
$parameter
Map
;
$this
->
executionMode
=
$executionMode
;
$this
->
executionMode
=
$executionMode
;
}
}
...
@@ -103,15 +103,15 @@ final class OCI8Statement implements Statement
...
@@ -103,15 +103,15 @@ final class OCI8Statement implements Statement
public
function
bindParam
(
$param
,
&
$variable
,
int
$type
=
ParameterType
::
STRING
,
?
int
$length
=
null
)
:
void
public
function
bindParam
(
$param
,
&
$variable
,
int
$type
=
ParameterType
::
STRING
,
?
int
$length
=
null
)
:
void
{
{
if
(
is_int
(
$param
))
{
if
(
is_int
(
$param
))
{
if
(
!
isset
(
$this
->
_param
Map
[
$param
]))
{
if
(
!
isset
(
$this
->
parameter
Map
[
$param
]))
{
throw
new
OCI8Exception
(
sprintf
(
'Could not find variable mapping with index %d, in the SQL statement'
,
$param
));
throw
new
OCI8Exception
(
sprintf
(
'Could not find variable mapping with index %d, in the SQL statement'
,
$param
));
}
}
$param
=
$this
->
_param
Map
[
$param
];
$param
=
$this
->
parameter
Map
[
$param
];
}
}
if
(
$type
===
ParameterType
::
LARGE_OBJECT
)
{
if
(
$type
===
ParameterType
::
LARGE_OBJECT
)
{
$lob
=
oci_new_descriptor
(
$this
->
_dbh
,
OCI_D_LOB
);
$lob
=
oci_new_descriptor
(
$this
->
connection
,
OCI_D_LOB
);
$class
=
'OCI-Lob'
;
$class
=
'OCI-Lob'
;
assert
(
$lob
instanceof
$class
);
assert
(
$lob
instanceof
$class
);
...
@@ -124,13 +124,13 @@ final class OCI8Statement implements Statement
...
@@ -124,13 +124,13 @@ final class OCI8Statement implements Statement
$this
->
boundValues
[
$param
]
=&
$variable
;
$this
->
boundValues
[
$param
]
=&
$variable
;
if
(
!
oci_bind_by_name
(
if
(
!
oci_bind_by_name
(
$this
->
_sth
,
$this
->
statement
,
$param
,
$param
,
$variable
,
$variable
,
$length
??
-
1
,
$length
??
-
1
,
$this
->
convertParameterType
(
$type
)
$this
->
convertParameterType
(
$type
)
))
{
))
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
_sth
));
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
statement
));
}
}
}
}
...
@@ -158,14 +158,14 @@ final class OCI8Statement implements Statement
...
@@ -158,14 +158,14 @@ final class OCI8Statement implements Statement
return
;
return
;
}
}
oci_cancel
(
$this
->
_sth
);
oci_cancel
(
$this
->
statement
);
$this
->
result
=
false
;
$this
->
result
=
false
;
}
}
public
function
columnCount
()
:
int
public
function
columnCount
()
:
int
{
{
$count
=
oci_num_fields
(
$this
->
_sth
);
$count
=
oci_num_fields
(
$this
->
statement
);
if
(
$count
!==
false
)
{
if
(
$count
!==
false
)
{
return
$count
;
return
$count
;
...
@@ -197,9 +197,9 @@ final class OCI8Statement implements Statement
...
@@ -197,9 +197,9 @@ final class OCI8Statement implements Statement
$mode
=
OCI_NO_AUTO_COMMIT
;
$mode
=
OCI_NO_AUTO_COMMIT
;
}
}
$ret
=
@
oci_execute
(
$this
->
_sth
,
$mode
);
$ret
=
@
oci_execute
(
$this
->
statement
,
$mode
);
if
(
!
$ret
)
{
if
(
!
$ret
)
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
_sth
));
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
statement
));
}
}
$this
->
result
=
true
;
$this
->
result
=
true
;
...
@@ -207,7 +207,7 @@ final class OCI8Statement implements Statement
...
@@ -207,7 +207,7 @@ final class OCI8Statement implements Statement
public
function
rowCount
()
:
int
public
function
rowCount
()
:
int
{
{
$count
=
oci_num_rows
(
$this
->
_sth
);
$count
=
oci_num_rows
(
$this
->
statement
);
if
(
$count
!==
false
)
{
if
(
$count
!==
false
)
{
return
$count
;
return
$count
;
...
@@ -276,7 +276,7 @@ final class OCI8Statement implements Statement
...
@@ -276,7 +276,7 @@ final class OCI8Statement implements Statement
}
}
return
oci_fetch_array
(
return
oci_fetch_array
(
$this
->
_sth
,
$this
->
statement
,
$mode
|
OCI_RETURN_NULLS
|
OCI_RETURN_LOBS
$mode
|
OCI_RETURN_NULLS
|
OCI_RETURN_LOBS
);
);
}
}
...
@@ -293,7 +293,7 @@ final class OCI8Statement implements Statement
...
@@ -293,7 +293,7 @@ final class OCI8Statement implements Statement
}
}
oci_fetch_all
(
oci_fetch_all
(
$this
->
_sth
,
$this
->
statement
,
$result
,
$result
,
0
,
0
,
-
1
,
-
1
,
...
...
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