classSignatureCompiler = new ClassSignatureCompiler(new TypeCompiler()); } /** * @dataProvider signature_is_compiled_correctly_data_provider */ public function test_signature_is_compiled_correctly(ClassSignature $signature): void { $code = $this->classSignatureCompiler->compile($signature); try { $compiledSignature = eval("return $code;"); } catch (Error $exception) { self::fail($exception->getMessage()); } self::assertInstanceOf(ClassSignature::class, $compiledSignature); self::assertSame((string)$signature, (string)$compiledSignature); self::assertSame($signature->generics(), $compiledSignature->generics()); } public function signature_is_compiled_correctly_data_provider(): iterable { yield [new ClassSignature(stdClass::class)]; yield [new ClassSignature(stdClass::class, [ 'TemplateA' => BooleanType::get(), 'TemplateB' => FloatType::get(), ])]; } }