Skip to content

Commit f96a848

Browse files
committed
Fixed some issues found by phpstan
1 parent a53be2e commit f96a848

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
parameters:
2-
level: 1
2+
level: 2
33
paths:
44
- src

src/ErrorHandlerInterface.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,11 @@ interface ErrorHandlerInterface
6565
* @param \Throwable $previousException the previous exception that occurred that
6666
* caused this exception, if any.
6767
*/
68-
public function throwException($message, $code, $connectionErrorNumber, $httpStatusCode, $previousException);
68+
public function throwException(
69+
$message,
70+
$code,
71+
$connectionErrorNumber = null,
72+
$httpStatusCode = null,
73+
$previousException = null
74+
);
6975
}

src/RedCapApiConnectionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function getConnectionTimeoutInSeconds();
142142
/**
143143
* Sets the timeout for time to make a connection in seconds.
144144
*
145-
* @param integer connection timeout in seconds.
145+
* @return integer connection timeout in seconds.
146146
*/
147147
public function setConnectionTimeoutInSeconds($connectionTimeoutInSeconds);
148148
}

src/RedCapProject.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,22 +2883,20 @@ protected function getFileInfo($callInfo)
28832883
{
28842884
$fileInfo = array();
28852885
if (isset($callInfo) && is_array($callInfo) && array_key_exists('content_type', $callInfo)) {
2886-
if (!empty($callInfo)) {
2887-
$contentType = $callInfo = explode(';', $callInfo['content_type']);
2888-
if (count($contentType) >= 1) {
2889-
$fileInfo['mime_type'] = trim($contentType[0]);
2890-
}
2891-
if (count($contentType) >= 2) {
2892-
$fileName = trim($contentType[1]);
2893-
# remove starting 'name="' and ending '"'
2894-
$fileName = substr($fileName, 6, strlen($fileName) - 7);
2895-
$fileInfo['name'] = $fileName;
2896-
}
2897-
if (count($contentType) >= 3) {
2898-
$charset = trim($contentType[2]);
2899-
$charset = substr($charset, 8);
2900-
$fileInfo['charset'] = $charset;
2901-
}
2886+
$contentType = $callInfo = explode(';', $callInfo['content_type']);
2887+
if (count($contentType) >= 1) {
2888+
$fileInfo['mime_type'] = trim($contentType[0]);
2889+
}
2890+
if (count($contentType) >= 2) {
2891+
$fileName = trim($contentType[1]);
2892+
# remove starting 'name="' and ending '"'
2893+
$fileName = substr($fileName, 6, strlen($fileName) - 7);
2894+
$fileInfo['name'] = $fileName;
2895+
}
2896+
if (count($contentType) >= 3) {
2897+
$charset = trim($contentType[2]);
2898+
$charset = substr($charset, 8);
2899+
$fileInfo['charset'] = $charset;
29022900
}
29032901
}
29042902
return $fileInfo;

0 commit comments

Comments
 (0)