Skip to content

Commit

Permalink
fix: Adjust psalm stubs
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Nov 11, 2023
1 parent fd57b8f commit 0d38762
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 18 deletions.
4 changes: 3 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<directory name="vendor/nextcloud/ocp"/>
</extraFiles>
<stubs>
<file name="tests/stubs/stub.phpstub" preloadClasses="true"/>
<file name="tests/stubs/oc_core_command.php" preloadClasses="true"/>
<file name="tests/stubs/oc_log_LogDetails.php"/>
<file name="tests/stubs/oc_SystemConfig.php" preloadClasses="true"/>
</stubs>
<issueHandlers>
<UndefinedClass>
Expand Down
29 changes: 29 additions & 0 deletions tests/stubs/oc_SystemConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2021 Robin Appelman <robin@icewind.nl>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OC {
class SystemConfig {
public function getValue(string $key, mixed $default = ''): mixed {
}
}
}
34 changes: 34 additions & 0 deletions tests/stubs/oc_core_command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2021 Robin Appelman <robin@icewind.nl>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OC\Core\Command {
use Symfony\Component\Console\Command\Command;

class Base extends Command {
protected function abortIfInterrupted() {
}
}

class InterruptedException extends \Exception {
}
}
20 changes: 3 additions & 17 deletions tests/stubs/stub.phpstub → tests/stubs/oc_log_LogDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,15 @@
*
*/

namespace OC\Core\Command {
use Symfony\Component\Console\Command\Command;

class Base extends Command {
protected function abortIfInterrupted(){
}
}

class InterruptedException extends \Exception {
}
}

namespace OC {
class SystemConfig {
}
}

namespace OC\Log {
use OC\SystemConfig;

class LogDetails {
public function __construct(SystemConfig $config) {
}
public function logDetails(string $app, $message, int $level): array {
}
public function logDetailsAsJSON(string $app, $message, int $level): string {
}
}
}

0 comments on commit 0d38762

Please sign in to comment.