Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 7
level: 8
paths:
- ./src
- ./test
3 changes: 2 additions & 1 deletion src/PluginSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public function __construct(
// delete the instance if the special sub is in the token data
// exits the request
if ($sso && $remoteCallHandler && $sso->isDeleteInstanceCall()) {
$this->deleteInstance($sso->getInstanceId(), $remoteCallHandler);
$instanceId = $sso->getInstanceId() ?: throw new SSOException('Instance id is required for deleteInstance');
$this->deleteInstance($instanceId, $remoteCallHandler);
}

// starts the session
Expand Down
12 changes: 6 additions & 6 deletions test/PluginSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function testConstructorWorksAsExpected(): void
->with($this->pluginId);

$reflectedClass = new ReflectionClass($this->classname);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, $this->pluginId, $this->publicKey);

$this->setupEnvironment($this->pluginInstanceId, null, false);
Expand Down Expand Up @@ -143,7 +143,7 @@ public function testConstructorRejectsSpoofedPID(): void
$this->expectException(SSOException::class);

$reflectedClass = new ReflectionClass($this->classname);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, $this->pluginId, $this->publicKey);
}

Expand All @@ -168,7 +168,7 @@ public function testConstructorRefuseEmptyPluginId(): void
$this->expectExceptionMessage('Empty plugin ID.');

$reflectedClass = new ReflectionClass($this->classname);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, '', $this->publicKey);
}

Expand All @@ -193,7 +193,7 @@ public function testConstructorRefuseEmptySecret(): void
$this->expectExceptionMessage('Parameter appSecret for SSOToken is empty.');

$reflectedClass = new ReflectionClass($this->classname);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, $this->pluginId, '');
}

Expand All @@ -218,7 +218,7 @@ public function testConstructorRefuseEmptyEnv(): void
$this->expectExceptionMessage('Missing PID or JWT query parameter in Request.');

$reflectedClass = new ReflectionClass($this->classname);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, $this->pluginId, $this->publicKey);
}

Expand All @@ -243,7 +243,7 @@ public function testConstructorRefuseHavingBothJwtAndPid(): void
$this->expectExceptionMessage('Tried to initialize the session with both PID and JWT provided.');

$reflectedClass = new ReflectionClass($this->classname);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, $this->pluginId, $this->publicKey);
}

Expand Down
4 changes: 2 additions & 2 deletions test/SSOTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testConstructorRefuseEmptySecret(): void
$this->expectExceptionMessage('Parameter appSecret for SSOToken is empty.');

$reflectedClass = new ReflectionClass(SSOToken::class);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, ' ', 'fake token');
}

Expand All @@ -91,7 +91,7 @@ public function testConstructorRefuseEmptyToken(): void
$this->expectExceptionMessage('Parameter tokenData for SSOToken is empty.');

$reflectedClass = new ReflectionClass(SSOToken::class);
$constructor = $reflectedClass->getConstructor();
$constructor = $reflectedClass->getConstructor() ?: throw new \Exception('Constructor not found');
$constructor->invoke($mock, 'fake secret', ' ');
}

Expand Down