Browse Source

Merge pull request #25930 from nextcloud/techdept/psalm/25839/RedundantPropertyInitializationCheck

Fix RedundantPropertyInitializationCheck
pull/26020/head
Roeland Jago Douma 5 years ago
committed by GitHub
parent
commit
45cfeefd1b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/private/Cache/File.php
  2. 4
      lib/private/Files/Storage/DAV.php
  3. 4
      lib/private/Route/Router.php
  4. 4
      lib/private/User/User.php

2
lib/private/Cache/File.php

@ -49,7 +49,7 @@ class File implements ICache {
* @throws \OC\User\NoUserException * @throws \OC\User\NoUserException
*/ */
protected function getStorage() { protected function getStorage() {
if (isset($this->storage)) {
if ($this->storage !== null) {
return $this->storage; return $this->storage;
} }
if (\OC::$server->getUserSession()->isLoggedIn()) { if (\OC::$server->getUserSession()->isLoggedIn()) {

4
lib/private/Files/Storage/DAV.php

@ -69,7 +69,7 @@ class DAV extends Common {
protected $password; protected $password;
/** @var string */ /** @var string */
protected $user; protected $user;
/** @var string */
/** @var string|null */
protected $authType; protected $authType;
/** @var string */ /** @var string */
protected $host; protected $host;
@ -143,7 +143,7 @@ class DAV extends Common {
'userName' => $this->user, 'userName' => $this->user,
'password' => $this->password, 'password' => $this->password,
]; ];
if (isset($this->authType)) {
if ($this->authType !== null) {
$settings['authType'] = $this->authType; $settings['authType'] = $this->authType;
} }

4
lib/private/Route/Router.php

@ -56,7 +56,7 @@ class Router implements IRouter {
protected $root = null; protected $root = null;
/** @var null|UrlGenerator */ /** @var null|UrlGenerator */
protected $generator = null; protected $generator = null;
/** @var string[] */
/** @var string[]|null */
protected $routingFiles; protected $routingFiles;
/** @var bool */ /** @var bool */
protected $loaded = false; protected $loaded = false;
@ -95,7 +95,7 @@ class Router implements IRouter {
* @return string[] * @return string[]
*/ */
public function getRoutingFiles() { public function getRoutingFiles() {
if (!isset($this->routingFiles)) {
if ($this->routingFiles === null) {
$this->routingFiles = []; $this->routingFiles = [];
foreach (\OC_APP::getEnabledApps() as $app) { foreach (\OC_APP::getEnabledApps() as $app) {
$appPath = \OC_App::getAppPath($app); $appPath = \OC_App::getAppPath($app);

4
lib/private/User/User.php

@ -61,7 +61,7 @@ class User implements IUser {
/** @var string */ /** @var string */
private $uid; private $uid;
/** @var string */
/** @var string|null */
private $displayName; private $displayName;
/** @var UserInterface|null */ /** @var UserInterface|null */
@ -128,7 +128,7 @@ class User implements IUser {
* @return string * @return string
*/ */
public function getDisplayName() { public function getDisplayName() {
if (!isset($this->displayName)) {
if ($this->displayName === null) {
$displayName = ''; $displayName = '';
if ($this->backend && $this->backend->implementsActions(Backend::GET_DISPLAYNAME)) { if ($this->backend && $this->backend->implementsActions(Backend::GET_DISPLAYNAME)) {
// get display name and strip whitespace from the beginning and end of it // get display name and strip whitespace from the beginning and end of it

Loading…
Cancel
Save