File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -99,16 +99,16 @@ class FluentLogger implements LoggerInterface
99
99
* create fluent logger object.
100
100
*
101
101
*
102
- * @param string $host
103
- * @param int $port
104
- * @param array $options
105
- * @param PackerInterface $packer
102
+ * @param string $host
103
+ * @param int $port
104
+ * @param array $options
105
+ * @param PackerInterface|null $packer
106
106
* @return FluentLogger
107
107
*/
108
108
public function __construct ($ host = FluentLogger::DEFAULT_ADDRESS ,
109
109
$ port = FluentLogger::DEFAULT_LISTEN_PORT ,
110
110
array $ options = array (),
111
- PackerInterface $ packer = null )
111
+ $ packer = null )
112
112
{
113
113
/* keep original host and port */
114
114
$ this ->host = $ host ;
@@ -120,6 +120,8 @@ public function __construct($host = FluentLogger::DEFAULT_ADDRESS,
120
120
if (is_null ($ packer )) {
121
121
/* for backward compatibility */
122
122
$ packer = new JsonPacker ();
123
+ } elseif (!$ packer instanceof PackerInterface) {
124
+ throw new \InvalidArgumentException (sprintf ('The $packer parameter must implement %s. %s given. ' , PackerInterface::class, get_class ($ packer )));
123
125
}
124
126
125
127
$ this ->packer = $ packer ;
You can’t perform that action at this time.
0 commit comments