Skip to content

Instantly share code, notes, and snippets.

@paramientos
Created November 29, 2020 00:15
Show Gist options
  • Save paramientos/7ec194ee35c9f82753af2f720c146b04 to your computer and use it in GitHub Desktop.
Save paramientos/7ec194ee35c9f82753af2f720c146b04 to your computer and use it in GitHub Desktop.
<?php
// PHP 7
class FormRenderer
{
private ThemeSystem $theme;
private UserRepository $users;
private ModuleSystem $modules;
public function __construct(ThemeSystem $theme, UserRepository $users, ModuleSystem $modules) {
$this->theme = $theme;
$this->users = $users;
$this->modules = $modules;
}
public function renderForm(Form $form): string
{
// ...
}
}
// As of PHP 8
class FormRenderer
{
public function __construct(
private ThemeSystem $theme,
private UserRepository $users,
private ModuleSystem $modules,
) { }
public function renderForm(Form $form): string
{
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment