Skip to content

Commit

Permalink
fix(psalm): Make psalm stricter and update baseline
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Aug 4, 2023
1 parent b723501 commit c340838
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
8 changes: 5 additions & 3 deletions lib/Controller/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ class APIController extends OCSController {
/** @var IManager */
protected $notificationManager;

public function __construct(string $appName,
public function __construct(
string $appName,
IRequest $request,
ITimeFactory $timeFactory,
IUserManager $userManager,
IManager $notificationManager) {
IManager $notificationManager,
) {
parent::__construct($appName, $request);

$this->timeFactory = $timeFactory;
Expand Down Expand Up @@ -93,7 +95,7 @@ public function generateNotification(string $userId, string $shortMessage, strin
}

$this->notificationManager->notify($notification);
} catch (\InvalidArgumentException $e) {
} catch (\InvalidArgumentException) {
return new DataResponse(null, Http::STATUS_INTERNAL_SERVER_ERROR);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/EndpointController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function listNotifications(string $apiVersion): DataResponse {
/** @var INotification $notification */
try {
$notification = $this->manager->prepare($notification, $language);
} catch (\InvalidArgumentException $e) {
} catch (\InvalidArgumentException) {
// The app was disabled, skip the notification
continue;
}
Expand Down
13 changes: 8 additions & 5 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="tests/psalm-baseline.xml"
errorBaseline="tests/psalm-baseline.xml"
errorLevel="5"
findUnusedBaselineEntry="true"
findUnusedCode="false"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/psalm/vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="lib" />
Expand Down
22 changes: 1 addition & 21 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.7.7@e028ba46ba0d7f9a78bc3201c251e137383e145f">
<files psalm-version="5.14.1@b9d355e0829c397b9b3b47d0c0ed042a8a70284d">
<file src="lib/AppInfo/Application.php">
<UndefinedClass>
<code>IProvider</code>
<code>IProvider</code>
</UndefinedClass>
</file>
<file src="lib/Controller/APIController.php">
<NullArgument>
<code>null</code>
<code>null</code>
<code>null</code>
<code>null</code>
</NullArgument>
</file>
<file src="lib/Controller/EndpointController.php">
<NullArgument>
<code>null</code>
<code>null</code>
<code>null</code>
<code>null</code>
<code>null</code>
<code>null</code>
<code>null</code>
<code>null</code>
</NullArgument>
</file>
<file src="lib/Controller/PushController.php">
<UndefinedClass>
<code>IProvider</code>
Expand Down

0 comments on commit c340838

Please sign in to comment.