Skip to content

Commit fdb5a69

Browse files
authored
Merge pull request #1357 from pulsarf0x/fix/allow-navigation-manager-interface
fix: accept INavigationManager instead of NavigationManager in Filter…
2 parents 475f494 + 68e4b12 commit fdb5a69

5 files changed

Lines changed: 22 additions & 18 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"cs:fix": "php-cs-fixer fix",
2323
"psalm": "psalm --threads=1",
2424
"psalm:update-baseline": "psalm --threads=1 --update-baseline",
25+
"psalm:update-baseline:force": "psalm --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
2526
"psalm:clear": "psalm --clear-cache && psalm --clear-global-cache",
2627
"psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
2728
"test:unit": "vendor/bin/phpunit -c phpunit.xml"

lib/FilteredNavigationManager.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,16 @@
88
namespace OCA\Guests;
99

1010
use OC\NavigationManager;
11+
use OCP\INavigationManager;
1112
use OCP\IUser;
1213

1314
class FilteredNavigationManager extends NavigationManager {
14-
/** @var AppWhitelist */
15-
private $whitelist;
1615

17-
/** @var IUser */
18-
private $user;
19-
20-
/** @var NavigationManager */
21-
private $navigationManager;
22-
23-
public function __construct(IUser $user, NavigationManager $navigationManager, AppWhitelist $whitelist) {
24-
$this->whitelist = $whitelist;
25-
$this->user = $user;
26-
$this->navigationManager = $navigationManager;
16+
public function __construct(
17+
private IUser $user,
18+
private INavigationManager $navigationManager,
19+
private AppWhitelist $whitelist,
20+
) {
2721
}
2822

2923
public function getAll(string $type = 'link'): array {
@@ -56,14 +50,23 @@ public function setUnreadCounter(string $id, int $unreadCounter): void {
5650
$this->navigationManager->setUnreadCounter($id, $unreadCounter);
5751
}
5852

53+
/**
54+
* @psalm-suppress MethodSignatureMismatch
55+
*/
5956
public function get(string $id): ?array {
6057
return $this->navigationManager->get($id);
6158
}
6259

60+
/**
61+
* @psalm-suppress MethodSignatureMismatch
62+
*/
6363
public function getDefaultEntryIdForUser(?IUser $user = null, bool $withFallbacks = true): string {
6464
return $this->navigationManager->getDefaultEntryIdForUser($user, $withFallbacks);
6565
}
6666

67+
/**
68+
* @psalm-suppress MethodSignatureMismatch
69+
*/
6770
public function getDefaultEntryIds(bool $withFallbacks = true): array {
6871
return $this->navigationManager->getDefaultEntryIds($withFallbacks);
6972
}

lib/Storage/DirMask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($arguments) {
4444
$this->mask = $arguments['mask'];
4545
}
4646

47-
protected function checkPath($path): bool {
47+
protected function checkPath(string $path): bool {
4848
return $path === $this->path || substr($path, 0, $this->pathLength + 1) === $this->path . '/';
4949
}
5050

tests/psalm-baseline.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,4 @@
99
<code><![CDATA[listen]]></code>
1010
</UndefinedInterfaceMethod>
1111
</file>
12-
<file src="lib/RestrictionManager.php">
13-
<UndefinedClass>
14-
<code><![CDATA[ExternalMountPoint]]></code>
15-
</UndefinedClass>
16-
</file>
1712
</files>

tests/stub.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,3 +827,8 @@ class LoadAdditionalScriptsEvent extends \OCP\EventDispatcher\Event {
827827
class BeforeTemplateRenderedEvent extends Event {
828828
}
829829
}
830+
831+
namespace OCA\Files_External\Config {
832+
class ExternalMountPoint {
833+
}
834+
}

0 commit comments

Comments
 (0)