public function testSetBodyFromAstWithInvalidArgumentsThrowsException() { if (version_compare(PHP_VERSION, '7.0.0') < 0) { $this->markTestSkipped('Only run this test on PHP 7 and above'); } $php = '<?php function foo() {}'; $reflector = new FunctionReflector(new StringSourceLocator($php)); $function = $reflector->reflect('foo'); $this->expectException(\TypeError::class); $function->setBodyFromAst([1]); }