Skip to content

Commit

Permalink
Stream now throws a RuntimeException.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 2, 2020
1 parent 3397e24 commit e4d67e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/**
* @see https://github.com/laminas/laminas-diactoros for the canonical source repository
* @copyright https://github.com/laminas/laminas-diactoros/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-diactoros/blob/master/LICENSE.md New BSD License
*/

declare(strict_types=1);

namespace Laminas\Diactoros\Exception;

class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
2 changes: 1 addition & 1 deletion src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ private function setStream($stream, string $mode = 'r') : void
}

if ($error) {
throw new Exception\InvalidArgumentException('Invalid stream reference provided');
throw new Exception\RuntimeException('Invalid stream reference provided');
}

if (! $this->isValidStreamResourceType($resource)) {
Expand Down
2 changes: 1 addition & 1 deletion test/StreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public function invalidResources()
*/
public function testAttachWithNonStringNonResourceRaisesException($resource)
{
$this->expectException(\InvalidArgumentException::class);
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Invalid stream');

$this->stream->attach($resource);
Expand Down

0 comments on commit e4d67e0

Please sign in to comment.