Page MenuHomeWickedGov Phorge

PropGuard.php
No OneTemporary

Size
531 B
Referenced Files
None
Subscribers
None

PropGuard.php

<?php
namespace Wikimedia\RemexHtml;
use InvalidArgumentException;
/**
* This is a statically configurable mechanism for preventing the setting of
* undeclared properties on objects. The point of it is to detect programmer
* errors.
*/
trait PropGuard {
public static $armed = true;
public function __set( $name, $value ) {
if ( self::$armed ) {
throw new InvalidArgumentException( "Property \"$name\" on object of class " . get_class( $this ) .
" is undeclared" );
} else {
$this->$name = $value;
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Jul 3, 21:38 (20 h, 4 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f4/18/3d6a1759007a1efc9ea0e21dbed2
Default Alt Text
PropGuard.php (531 B)

Event Timeline