Skip to content

Commit

Permalink
Constructor property promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
markshust committed Oct 4, 2023
1 parent 9a30ed4 commit a3fe52e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Model/Product.php
Expand Up @@ -6,12 +6,9 @@

class Product
{
private Category $category;

function __construct(Category $category)
{
$this->category = $category;
}
function __construct(
private Category $category,
) {}

function getCategoryName(): string
{
Expand Down

0 comments on commit a3fe52e

Please sign in to comment.