Skip to content

Commit ee44e05

Browse files
committed
Deprecate write filter related stuff
1 parent b86b453 commit ee44e05

10 files changed

+33
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## Unreleased
4+
5+
### Deprecated
6+
7+
- FilteredStream::getWriteFilter will be removed in 2.0
8+
39
## 1.4.0 - 2016-10-17
410

511
### Added

src/Encoding/ChunkStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function getReadFilter()
2020
/**
2121
* {@inheritdoc}
2222
*/
23-
public function getWriteFilter()
23+
protected function writeFilter()
2424
{
2525
return 'dechunk';
2626
}

src/Encoding/CompressStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getReadFilter()
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function getWriteFilter()
38+
protected function writeFilter()
3939
{
4040
return 'zlib.inflate';
4141
}

src/Encoding/DechunkStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function getReadFilter()
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
public function getWriteFilter()
25+
protected function writeFilter()
2626
{
2727
return 'chunk';
2828
}

src/Encoding/DecompressStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getReadFilter()
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function getWriteFilter()
38+
protected function writeFilter()
3939
{
4040
return 'zlib.deflate';
4141
}

src/Encoding/DeflateStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function getReadFilter()
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function getWriteFilter()
34+
protected function writeFilter()
3535
{
3636
return 'zlib.inflate';
3737
}

src/Encoding/FilteredStream.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ abstract class FilteredStream implements StreamInterface
2727
*/
2828
protected $readFilter;
2929

30-
/**
31-
* @var callable
32-
*/
33-
protected $writeFilterCallback;
34-
35-
/**
36-
* @var resource
37-
*/
38-
protected $writeFilter;
39-
4030
/**
4131
* Internal buffer.
4232
*
@@ -47,12 +37,14 @@ abstract class FilteredStream implements StreamInterface
4737
/**
4838
* @param StreamInterface $stream
4939
* @param mixed|null $readFilterOptions
50-
* @param mixed|null $writeFilterOptions
40+
* @param mixed|null $writeFilterOptions deprecated since 1.5, will be removed in 2.0
5141
*/
5242
public function __construct(StreamInterface $stream, $readFilterOptions = null, $writeFilterOptions = null)
5343
{
5444
$this->readFilterCallback = Filter\fun($this->getReadFilter(), $readFilterOptions);
55-
$this->writeFilterCallback = Filter\fun($this->getWriteFilter(), $writeFilterOptions);
45+
if (null !== $writeFilterOptions) {
46+
@trigger_error('The $writeFilterOptions argument is deprecated since version 1.5 and will be removed in 2.0. Use Http\Message\RequestMatcher\RequestMatcher instead.', E_USER_DEPRECATED);
47+
}
5648
$this->stream = $stream;
5749
}
5850

@@ -142,10 +134,24 @@ public function __toString()
142134
*/
143135
abstract public function getReadFilter();
144136

137+
/**
138+
* Returns the write filter name.
139+
*
140+
* @return string
141+
*
142+
* @deprecated since version 1.5, will be removed in 2.0
143+
*/
144+
public function getWriteFilter()
145+
{
146+
@trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0. Use Http\Message\RequestMatcher\RequestMatcher instead.', E_USER_DEPRECATED);
147+
148+
return $this->writeFilter();
149+
}
150+
145151
/**
146152
* Returns the write filter name.
147153
*
148154
* @return string
149155
*/
150-
abstract public function getWriteFilter();
156+
abstract protected function writeFilter();
151157
}

src/Encoding/GzipDecodeStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getReadFilter()
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function getWriteFilter()
38+
protected function writeFilter()
3939
{
4040
return 'zlib.deflate';
4141
}

src/Encoding/GzipEncodeStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getReadFilter()
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function getWriteFilter()
38+
protected function writeFilter()
3939
{
4040
return 'zlib.inflate';
4141
}

src/Encoding/InflateStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getReadFilter()
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function getWriteFilter()
38+
protected function writeFilter()
3939
{
4040
return 'zlib.deflate';
4141
}

0 commit comments

Comments
 (0)