Skip to content

Instantly share code, notes, and snippets.

@vanbrabantf
Created April 2, 2021 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanbrabantf/cd9fa7b0f0e82ae2b931979da0a05635 to your computer and use it in GitHub Desktop.
Save vanbrabantf/cd9fa7b0f0e82ae2b931979da0a05635 to your computer and use it in GitHub Desktop.
<?php
$car = new Car<int, string>(4, 'Honda');
class Car<WheelType, EngineType>
{
private $wheels;
private $engine;
public function __construct(WheelType $wheels, EngineType $engine)
{
$this->wheels = $wheels;
$this->engine = $engine;
}
public function getWheels(): WheelType
{
return $this->wheels;
}
public function getEngineType(): EngineType
{
return $this->engine;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment