codebase = $this->project_analyzer->getCodebase(); } /** * @test * @dataProvider typeContainments * @return void */ public function isTypeContainedByType(string $input, string $container, bool $expected) { $input = Type::parseString($input); $container = Type::parseString($container); $this->assertEquals( $expected, $this->codebase->isTypeContainedByType($input, $container), 'Expected ' . $input->getId() . ($expected ? ' ' : ' not ') . 'to be contained in ' . $container->getId() ); } /** @return iterableassertEquals( $expected, $this->codebase->canTypeBeContainedByType($input, $container), 'Expected ' . $input->getId() . ($expected ? ' ' : ' not ') . 'to be contained in ' . $container->getId() ); } /** @return iterablegetTypes()); $expected_key_type = Type::parseString($expected[0]); $expected_value_type = Type::parseString($expected[1]); $actual = $this->codebase->getKeyValueParamsForTraversableObject($input); $this->assertTrue( $expected_key_type->equals($actual[0]), 'Expected ' . $input->getId() . ' to have ' . $expected_key_type . ' but got ' . $actual[0]->getId() ); $this->assertTrue( $expected_value_type->equals($actual[1]), 'Expected ' . $input->getId() . ' to have ' . $expected_value_type . ' but got ' . $actual[1]->getId() ); } /** @return iterable', ['int', 'string']]; yield ['iterable