Created
February 12, 2015 11:27
-
-
Save ThomasWeinert/1d6217630020c1ebb94b to your computer and use it in GitHub Desktop.
Test if HHVM still uses __get/__set or has implemented the properties.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$xml = <<<'XML' | |
<root attribute="42"></root> | |
XML; | |
$dom = new DOMDocument(); | |
$dom->preserveWhiteSpace = FALSE; | |
$dom->loadXml($xml); | |
$objects = [ | |
$dom, | |
$dom->documentElement, | |
$dom->documentElement->attributes->getNamedItem('attribute'), | |
$dom->createTextNode(''), | |
$dom->createComment(''), | |
$dom->createCDATASection(''), | |
$dom->createProcessingInstruction('pi', ''), | |
$dom->createDocumentFragment(), | |
new DOMXPath($dom) | |
]; | |
echo str_pad('class', 25, ' '), ' | ', '__get ', ' | ', '__set ', "\n"; | |
echo str_repeat('-', 25), ' | ', '------', ' | ', '------', "\n"; | |
foreach ($objects as $object) { | |
echo | |
str_pad(get_class($object), 25, ' '), | |
' | ', | |
method_exists($object, '__get') ? 'true ' : 'false ', | |
' | ', | |
method_exists($object, '__set') ? 'true ' : 'false ', | |
"\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment