Skip to content

Commit

Permalink
fix a few phpstan errors [#52]
Browse files Browse the repository at this point in the history
  • Loading branch information
dnl-blkv committed Sep 25, 2017
1 parent 5410548 commit 3ad99fd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 35 deletions.
65 changes: 32 additions & 33 deletions src/Context/ApiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ApiContext
/** @var string */
protected $apiKey;

/** @var SessionContext */
/** @var SessionContext|null */
protected $sessionContext;

/** @var InstallationContext */
Expand Down Expand Up @@ -166,6 +166,23 @@ public static function restore($fileName = self::FILENAME_CONFIG_DEFAULT)
return static::fromJson($contextJsonString);
}

/**
* @param $fileName
*
* @return string
* @throws BunqException When the context couldn't be loaded from the given location.
*/
private static function getContextJsonString($fileName)
{
$jsonString = FileUtil::getFileContents($fileName);

if ($jsonString === false) {
throw new BunqException(self::ERROR_CONTEXT_FILE_NOT_FOUND, [$fileName]);
}

return $jsonString;
}

/**
* @param string $jsonString
*
Expand Down Expand Up @@ -198,23 +215,6 @@ private static function restoreProxyUrl(array $contextJson)
}
}

/**
* @param $fileName
*
* @return string
* @throws BunqException When the context couldn't be loaded from the given location.
*/
private static function getContextJsonString($fileName)
{
$jsonString = FileUtil::getFileContents($fileName);

if ($jsonString === false) {
throw new BunqException(self::ERROR_CONTEXT_FILE_NOT_FOUND, [$fileName]);
}

return $jsonString;
}

/**
* @return Uri
*/
Expand Down Expand Up @@ -244,12 +244,12 @@ private function determineBaseUriString()
}

/**
* Closes the current session and opens a new one.
* Closes the current session.
*/
public function resetSession()
public function closeSession()
{
Session::delete($this, self::SESSION_ID_DUMMY);
$this->dropSessionContext();
$this->initializeSessionContext();
}

/**
Expand All @@ -260,16 +260,6 @@ private function dropSessionContext()
$this->sessionContext = null;
}

/**
* Closes the current session.
*/
public function closeSession()
{
Session::delete($this, self::SESSION_ID_DUMMY);
$this->dropSessionContext();
}


/**
* Check if current time is too close to the saved session expiry time and reset session if
* needed.
Expand All @@ -288,7 +278,16 @@ public function ensureSessionActive()
}

/**
* @return Token
* Closes the current session and opens a new one.
*/
public function resetSession()
{
$this->dropSessionContext();
$this->initializeSessionContext();
}

/**
* @return Token|null
*/
public function getSessionToken()
{
Expand Down Expand Up @@ -347,7 +346,7 @@ public function getInstallationContext()
}

/**
* @return SessionContext
* @return SessionContext|null
*/
public function getSessionContext()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function restore(array $paginationJson)
/**
* @param string[] $paginationResponse
*
* @return string[]
* @return string[]|null[]
*/
private static function parsePaginationBody(array $paginationResponse)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Core/BunqModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected static function createListFromResponseArray(array $responseArray, $wra
* @param mixed[] $responseArray
* @param string $wrapper
*
* @return BunqModel
* @return BunqModel|null
*/
protected static function createFromResponseArray(array $responseArray, $wrapper = null)
{
Expand Down

0 comments on commit 3ad99fd

Please sign in to comment.