Skip to content

Instantly share code, notes, and snippets.

@michitheonlyone
Last active January 28, 2022 10:44
Show Gist options
  • Save michitheonlyone/ae925e607b78e19fe81512330a4b8efc to your computer and use it in GitHub Desktop.
Save michitheonlyone/ae925e607b78e19fe81512330a4b8efc to your computer and use it in GitHub Desktop.
PHP 8 new Dependency Injection vs PHP 7.4
<?php declare(strict_types=1);
// PHP 8
final class DependencyInjectionExampleNew
{
public function __construct(private string $var) {}
}
// PHP 7.4
final class DependencyInjectionExample
{
private string $var;
public function __construct(string $var)
{
$this->var = $this->var;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment