Skip to content

Commit

Permalink
Merge pull request #22272 from nextcloud/phpdoc/21787/fix-misplaced-v…
Browse files Browse the repository at this point in the history
…ariable-phpdoc

Fix "misplaced variables" warning of Psalm in PHPDoc statements
  • Loading branch information
blizzz authored Aug 17, 2020
2 parents 7b8adb1 + d7f66c3 commit d98bd17
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 31 deletions.
2 changes: 1 addition & 1 deletion apps/files_external/lib/Service/GlobalStoragesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function isApplicable(StorageConfig $config) {
/**
* Get all configured admin and personal mounts
*
* @return array map of storage id to storage config
* @return StorageConfig[] map of storage id to storage config
*/
public function getStorageForAllUsers() {
$mounts = $this->dbConfig->getAllMounts();
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/templates/public.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/** @var \OCP\IL10N $_ */
/** @var \OCP\IL10N $l */
/** @var array $_ */
?>
<div id="app-content">
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/templates/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @var $l \OCP\IL10N */ ?>
<?php /** @var \OCP\IL10N $l */ ?>
<div id="controls">
<div id="file_action_panel"></div>
</div>
Expand Down
1 change: 0 additions & 1 deletion apps/settings/lib/Search/AppSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function getOrder(string $route, array $routeParameters): int {
* @inheritDoc
*/
public function search(IUser $user, ISearchQuery $query): SearchResult {
/** @var $entries */
$entries = $this->navigationManager->getAll('all');

$result = [];
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/templates/renewpassword.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @var $l OC_L10N */ ?>
<?php /** @var \OCP\IL10N $l */ ?>
<?php
script('user_ldap', [
'renewPassword',
Expand Down
1 change: 0 additions & 1 deletion core/Command/User/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ protected function configure() {
protected function execute(InputInterface $input, OutputInterface $output): int {
$username = $input->getArgument('user');

/** @var $user \OCP\IUser */
$user = $this->userManager->get($username);
if (is_null($user)) {
$output->writeln('<error>User does not exist</error>');
Expand Down
2 changes: 1 addition & 1 deletion core/register_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*
*/

/** @var $application Symfony\Component\Console\Application */
/** @var Symfony\Component\Console\Application $application */
$application->add(new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand());
$application->add(new OC\Core\Command\Status);
$application->add(new OC\Core\Command\Check(\OC::$server->getSystemConfig()));
Expand Down
6 changes: 3 additions & 3 deletions core/templates/404.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/** @var $_ array */
/** @var $l \OCP\IL10N */
/** @var $theme OCP\Defaults */
/** @var array $_ */
/** @var \OCP\IL10N $l */
/** @var \OCP\Defaults $theme */
// @codeCoverageIgnoreStart
if (!isset($_)) {//standalone page is not supported anymore - redirect to /
require_once '../../lib/base.php';
Expand Down
2 changes: 1 addition & 1 deletion core/templates/login.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @var $l \OCP\IL10N */ ?>
<?php /** @var \OCP\IL10N $l */ ?>
<?php
script('core', 'dist/login');
?>
Expand Down
4 changes: 2 additions & 2 deletions core/templates/publicshareauth.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/** @var $_ array */
/** @var $l \OCP\IL10N */
/** @var array $_ */
/** @var \OCP\IL10N $l */
style('core', 'guest');
style('core', 'publicshareauth');
script('core', 'publicshareauth');
Expand Down
8 changes: 4 additions & 4 deletions core/templates/twofactorsetupchallenge.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/** @var $l \OCP\IL10N */
/** @var $_ array */
/* @var $provider OCP\Authentication\TwoFactorAuth\IProvider */
/** @var \OCP\IL10N $l */
/** @var array $_ */
/** @var \OCP\Authentication\TwoFactorAuth\IProvider $provider */
$provider = $_['provider'];
/* @var $template string */
/* @var string $template */
$template = $_['template'];
?>

Expand Down
6 changes: 3 additions & 3 deletions core/templates/twofactorshowchallenge.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/** @var $l \OCP\IL10N */
/** @var $_ array */
/* @var $error boolean */
/** @var \OCP\IL10N $l */
/** @var array $_*/
/** @var boolean $error */
$error = $_['error'];
/* @var $error_message string */
$error_message = $_['error_message'];
Expand Down
2 changes: 1 addition & 1 deletion core/templates/untrustedDomain.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @var $_ array */ ?>
<?php /** @var array $_ */ ?>

<div class="error">
<h2><?php p($l->t('Access through untrusted domain')); ?></h2>
Expand Down
1 change: 0 additions & 1 deletion lib/private/DB/MDB2SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public function removeDBStructure($file) {
$toSchema = new Schema([], [], $this->conn->getSchemaManager()->createSchemaConfig());
$fromSchema = $schemaReader->loadSchemaFromFile($file, $toSchema);
$toSchema = clone $fromSchema;
/** @var $table \Doctrine\DBAL\Schema\Table */
foreach ($toSchema->getTables() as $table) {
$toSchema->dropTable($table->getName());
}
Expand Down
1 change: 0 additions & 1 deletion lib/private/DB/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $conn
$sourceSchema = $connection->getSchemaManager()->createSchema();

// remove tables we don't know about
/** @var $table \Doctrine\DBAL\Schema\Table */
foreach ($sourceSchema->getTables() as $table) {
if (!$targetSchema->hasTable($table->getName())) {
$sourceSchema->dropTable($table->getName());
Expand Down
1 change: 0 additions & 1 deletion lib/private/PreviewManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ public function isAvailable(\OCP\Files\FileInfo $file) {
continue;
}

/** @var $provider IProvider */
if ($provider->isAvailable($file)) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* Provide an interface to all search providers
*/
class Search implements ISearch {
/** @var Provider[] */
private $providers = [];
private $registeredProviders = [];

Expand All @@ -51,7 +52,6 @@ public function searchPaged($query, array $inApps = [], $page = 1, $size = 30) {
$this->initProviders();
$results = [];
foreach ($this->providers as $provider) {
/** @var $provider Provider */
if (! $provider->providesResultsFor($inApps)) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public function __construct($webRoot, \OC\Config $config) {
$dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid));
});
$userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
/** @var $user \OC\User\User */
/** @var \OC\User\User $user */
\OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]);

/** @var IEventDispatcher $dispatcher */
Expand Down
10 changes: 5 additions & 5 deletions lib/private/legacy/OC_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,16 +555,16 @@ private static function loadVersion() {

$timestamp = filemtime(OC::$SERVERROOT . '/version.php');
require OC::$SERVERROOT . '/version.php';
/** @var $timestamp int */
/** @var int $timestamp */
self::$versionCache['OC_Version_Timestamp'] = $timestamp;
/** @var $OC_Version string */
/** @var string $OC_Version */
self::$versionCache['OC_Version'] = $OC_Version;
/** @var $OC_VersionString string */
/** @var string $OC_VersionString */
self::$versionCache['OC_VersionString'] = $OC_VersionString;
/** @var $OC_Build string */
/** @var string $OC_Build */
self::$versionCache['OC_Build'] = $OC_Build;

/** @var $OC_Channel string */
/** @var string $OC_Channel */
self::$versionCache['OC_Channel'] = $OC_Channel;
}

Expand Down

0 comments on commit d98bd17

Please sign in to comment.