How do you use Sentry?
Sentry SaaS (sentry.io)
SDK version
4.0.0
Steps to reproduce
Sentry\Transport\Result class should not be flagged as @internal as it is the expected return value for Sentry\Transport\TransportInterface.
When one wishes to implement a custom transport, implementing Sentry\Transport\TransportInterface, it must use Sentry\Transport\Result out of the internal lib.
While it is not actually failing as a PHP error, static analysis tools such as phpstan or psalm are returning errors.
Sample code:
\Sentry\init([
'transport' => new class implements \Sentry\Transport\TransportInterface
{
public function send(Event $event): \Sentry\Transport\Result
{
return new Result(\Sentry\Transport\ResultStatus::success(), $event);
}
public function close(?int $timeout = null): \Sentry\Transport\Result
{
return new Result(\Sentry\Transport\ResultStatus::success(), null);
}
}
]);
would trigger in PHPStan
243 Return type of method send() in anonymous class has typehint with internal class
Sentry\Transport\Result.
🪪 return.internalClass
245 Call to method __construct() of internal class Sentry\Transport\Result from outside its root
namespace Sentry.
🪪 method.internalClass
245 Instantiation of internal class Sentry\Transport\Result.
🪪 new.internalClass
248 Return type of method close() in anonymous class has typehint with internal class
Sentry\Transport\Result.
🪪 return.internalClass
250 Call to method __construct() of internal class Sentry\Transport\Result from outside its root
namespace Sentry.
🪪 method.internalClass
250 Instantiation of internal class Sentry\Transport\Result.
🪪 new.internalClass
Expected result
Sentry\Transport\Result should not be internal.
Actual result
Sentry\Transport\Result is internal.
How do you use Sentry?
Sentry SaaS (sentry.io)
SDK version
4.0.0
Steps to reproduce
Sentry\Transport\Resultclass should not be flagged as@internalas it is the expected return value forSentry\Transport\TransportInterface.When one wishes to implement a custom transport, implementing
Sentry\Transport\TransportInterface, it must useSentry\Transport\Resultout of the internal lib.While it is not actually failing as a PHP error, static analysis tools such as phpstan or psalm are returning errors.
Sample code:
would trigger in PHPStan
Expected result
Sentry\Transport\Resultshould not be internal.Actual result
Sentry\Transport\Resultis internal.