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
Tue, Aug 18, 22:28 (1 d, 5 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e8/c3/3eb5977bad528d3ba49b5d428efb
Default Alt Text
PropGuard.php (531 B)

Event Timeline