diff --git a/.editorconfig b/.editorconfig
index 3faf149..5e5b915 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -11,6 +11,6 @@ indent_style = tab
indent_size = tab
tab_width = 4
-[{*.json, *.yaml, *.yml, *.md}]
+[*.{json,yaml,yml,md}]
indent_style = space
indent_size = 2
diff --git a/.github/.kodiak.toml b/.github/.kodiak.toml
deleted file mode 100644
index 60c34b6..0000000
--- a/.github/.kodiak.toml
+++ /dev/null
@@ -1,10 +0,0 @@
-version = 1
-
-[merge]
-automerge_label = "automerge"
-blacklist_title_regex = "^WIP.*"
-blacklist_labels = ["WIP"]
-method = "rebase"
-delete_branch_on_merge = true
-notify_on_conflict = true
-optimistic_updates = false
diff --git a/.github/workflows/codesniffer.yml b/.github/workflows/codesniffer.yml
index d5ff803..a58ac4f 100644
--- a/.github/workflows/codesniffer.yml
+++ b/.github/workflows/codesniffer.yml
@@ -15,4 +15,4 @@ jobs:
name: "Codesniffer"
uses: contributte/.github/.github/workflows/codesniffer.yml@master
with:
- php: "8.3"
+ php: "8.2"
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 85f1300..860c47e 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -15,4 +15,4 @@ jobs:
name: "Nette Tester"
uses: contributte/.github/.github/workflows/nette-tester-coverage-v2.yml@master
with:
- php: "8.3"
+ php: "8.2"
diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index 9827fdd..eb916bf 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -15,4 +15,4 @@ jobs:
name: "Phpstan"
uses: contributte/.github/.github/workflows/phpstan.yml@master
with:
- php: "8.3"
+ php: "8.2"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index c5f3e62..0bdeea0 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -11,6 +11,12 @@ on:
- cron: "0 8 * * 1"
jobs:
+ test85:
+ name: "Nette Tester"
+ uses: contributte/.github/.github/workflows/nette-tester.yml@master
+ with:
+ php: "8.5"
+
test84:
name: "Nette Tester"
uses: contributte/.github/.github/workflows/nette-tester.yml@master
diff --git a/composer.json b/composer.json
index 5e7b78c..abd3536 100644
--- a/composer.json
+++ b/composer.json
@@ -25,9 +25,9 @@
"php-http/guzzle7-adapter": "^1.1.0"
},
"require-dev": {
- "contributte/qa": "^0.4",
- "contributte/tester": "^0.3",
- "contributte/phpstan": "^0.3",
+ "contributte/qa": "~0.4.0",
+ "contributte/tester": "~0.3.0",
+ "contributte/phpstan": "~0.3.0",
"mockery/mockery": "^1.5.1",
"nette/application": "^3.1.0",
"nette/di": "^3.1.0",
diff --git a/phpstan.neon b/phpstan.neon
index 16b3197..cd64186 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -14,5 +14,3 @@ parameters:
paths:
- src
- .docs
-
- ignoreErrors:
diff --git a/ruleset.xml b/ruleset.xml
index ca117f3..bc5a96c 100644
--- a/ruleset.xml
+++ b/ruleset.xml
@@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
-
+
@@ -16,7 +16,10 @@
-
+
+
+
+
diff --git a/src/Integration/NetteSecurityIntegration.php b/src/Integration/NetteSecurityIntegration.php
index 24ce3cd..49104ab 100644
--- a/src/Integration/NetteSecurityIntegration.php
+++ b/src/Integration/NetteSecurityIntegration.php
@@ -5,8 +5,7 @@
use Nette\DI\Container;
use Nette\Http\IRequest;
use Nette\Http\Session;
-use Nette\Security\Identity;
-use Nette\Security\SimpleIdentity;
+use Nette\Security\IIdentity;
use Nette\Security\UserStorage;
use Sentry\Event;
use Sentry\EventHint;
@@ -51,21 +50,26 @@ public function setup(HubInterface $hub, Event $event, EventHint $hint): ?Event
$identity = $state[1];
// Anonymous user
- if (!($identity instanceof SimpleIdentity) && !($identity instanceof Identity)) {
+ if (!($identity instanceof IIdentity)) {
return $event;
}
$httpRequest = $this->context->getByType(IRequest::class);
+ /** @var array $identityData */
+ $identityData = $identity->getData();
+ $identityRoles = $identity->getRoles();
+ $identityId = $identity->getId();
+
$bag = new UserDataBag(
- strval($identity->getId()),
- $identity->getData()['email'] ?? null,
+ is_scalar($identityId) ? (string) $identityId : '',
+ is_string($identityData['email'] ?? null) ? $identityData['email'] : null,
$httpRequest->getRemoteAddress(),
- $identity->getData()['username'] ?? null
+ is_string($identityData['username'] ?? null) ? $identityData['username'] : null
);
- $bag->setMetadata('Roles', implode(',', $identity->getRoles()));
- $bag->setMetadata('Identity', $identity->getData());
+ $bag->setMetadata('Roles', implode(',', $identityRoles));
+ $bag->setMetadata('Identity', $identityData);
$event->setUser($bag);
diff --git a/src/Upload/S3Uploader.php b/src/Upload/S3Uploader.php
index d7514c7..78beae2 100644
--- a/src/Upload/S3Uploader.php
+++ b/src/Upload/S3Uploader.php
@@ -28,9 +28,17 @@ public function upload(string $file): array
$url = $signed['url'];
+ if ($url === '') {
+ throw new UploadException('Invalid signed URL');
+ }
+
// Read file
$content = file_get_contents($file);
+ if ($content === false) {
+ throw new UploadException(sprintf('Cannot read file: %s', $file));
+ }
+
try {
$curl = curl_init();
curl_setopt_array($curl, [
diff --git a/tests/Cases/Integration/IgnoreErrorIntegration/IgnoreMessageWithInstance.phpt b/tests/Cases/Integration/IgnoreErrorIntegration/IgnoreMessageWithInstance.phpt
index ad5f6cd..1873b4d 100644
--- a/tests/Cases/Integration/IgnoreErrorIntegration/IgnoreMessageWithInstance.phpt
+++ b/tests/Cases/Integration/IgnoreErrorIntegration/IgnoreMessageWithInstance.phpt
@@ -8,18 +8,12 @@ use Sentry\ExceptionDataBag;
use Sentry\SentrySdk;
use Sentry\State\Scope;
use Tester\Assert;
+use Tests\Fixtures\BadException;
+use Tests\Fixtures\GoodException;
use function Sentry\withScope;
require_once __DIR__ . '/../../../bootstrap.php';
-class GoodException extends RuntimeException
-{
-}
-
-class BadException extends RuntimeException
-{
-}
-
// not matched exception and matched event
Toolkit::test(function (): void {
$integration = new IgnoreErrorIntegration([
diff --git a/tests/Fixtures/BadException.php b/tests/Fixtures/BadException.php
new file mode 100644
index 0000000..89cfc63
--- /dev/null
+++ b/tests/Fixtures/BadException.php
@@ -0,0 +1,10 @@
+