1--TEST-- 2Test trait_exists() function : basic functionality 3--FILE-- 4<?php 5echo "*** Testing trait_exists() : basic functionality ***\n"; 6 7spl_autoload_register(function ($traitName) { 8 echo "In autoload($traitName)\n"; 9}); 10 11trait MyTrait {} 12 13echo "Calling trait_exists() on non-existent trait with autoload explicitly enabled:\n"; 14var_dump( trait_exists('C', true) ); 15echo "\nCalling trait_exists() on existing trait with autoload explicitly enabled:\n"; 16var_dump( trait_exists('MyTrait', true) ); 17 18echo "\nCalling trait_exists() on non-existent trait with autoload explicitly enabled:\n"; 19var_dump( trait_exists('D', false) ); 20echo "\nCalling trait_exists() on existing trait with autoload explicitly disabled:\n"; 21var_dump( trait_exists('MyTrait', false) ); 22 23echo "\nCalling trait_exists() on non-existent trait with autoload unspecified:\n"; 24var_dump( trait_exists('E') ); 25echo "\nCalling trait_exists() on existing trait with autoload unspecified:\n"; 26var_dump( trait_exists('MyTrait') ); 27 28echo "Done"; 29?> 30--EXPECT-- 31*** Testing trait_exists() : basic functionality *** 32Calling trait_exists() on non-existent trait with autoload explicitly enabled: 33In autoload(C) 34bool(false) 35 36Calling trait_exists() on existing trait with autoload explicitly enabled: 37bool(true) 38 39Calling trait_exists() on non-existent trait with autoload explicitly enabled: 40bool(false) 41 42Calling trait_exists() on existing trait with autoload explicitly disabled: 43bool(true) 44 45Calling trait_exists() on non-existent trait with autoload unspecified: 46In autoload(E) 47bool(false) 48 49Calling trait_exists() on existing trait with autoload unspecified: 50bool(true) 51Done 52