wiki.techinc.nl/includes/libs/NonSerializableTrait.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
375 B
PHP
Raw Normal View History

<?php
namespace Wikimedia\NonSerializable;
use LogicException;
/**
* A trait that prevents serialization via php's builtin serialize() function.
*/
trait NonSerializableTrait {
/**
* @throws LogicException always
* @return never
*/
public function __sleep() {
throw new LogicException( 'Instances of ' . get_class( $this ) . ' are not serializable!' );
}
}