aboutsummaryrefslogtreecommitdiffstats
path: root/includes/libs/NonSerializableTrait.php
blob: 547d92a594ced6a793232ae1d7ecdd5668d587e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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!' );
	}

}