File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 55namespace PetrKnap \Binary ;
66
77use PetrKnap \Shorts \Exception ;
8+ use Stringable ;
89
910/**
1011 * @internal please use subclass
1314 *
1415 * @implements CoderInterface<Exception\CouldNotProcessData>
1516 */
16- abstract class Coder implements CoderInterface
17+ abstract class Coder implements CoderInterface, Stringable
1718{
18- public function __construct (
19- protected readonly string $ data = '' ,
19+ /**
20+ * @param string $data may contain binary data
21+ */
22+ final public function __construct (
23+ public readonly string $ data = '' ,
2024 ) {
2125 }
2226
@@ -25,7 +29,18 @@ public function withData(string $data): static
2529 return static ::create ($ this , $ data );
2630 }
2731
28- public function getData (): string
32+ /**
33+ * @deprecated use readonly property {@see self::$data}
34+ */
35+ final public function getData (): string
36+ {
37+ return $ this ->data ;
38+ }
39+
40+ /**
41+ * @note this is just a helper, this class is not supposed to implement {@see BinariableInterface}
42+ */
43+ public function __toString (): string
2944 {
3045 return $ this ->data ;
3146 }
You can’t perform that action at this time.
0 commit comments