Returning inside PHP constructors doesn't work, so whatever this code
was previously trying to do didn't work. Now we directly set $this->data
to the existing $data->data. Note that we can't fall through to the
instanceof Blob due to MssqlBlob->fetch() not being idempotent.
Also expand the @param documentation for $data.
h/t to phan for highlighting this and Anomie for explaining that the
behavior was wrong and how to properly fix it.
Change-Id: Ied5ba2f63cbaf7c8e0f951000dbc4aa3089edd80
/** @noinspection PhpMissingParentConstructorInspection */
/**
- * @param string $data
- * @suppress PhanTypeMagicVoidWithReturn
+ * @param Blob|array|string $data
*/
public function __construct( $data ) {
if ( $data instanceof MssqlBlob ) {
- return $data;
+ $this->data = $data->data;
} elseif ( $data instanceof Blob ) {
$this->data = $data->fetch();
} elseif ( is_array( $data ) && is_object( $data ) ) {