M
M
Maxim2021-06-08 22:57:46
PHP
Maxim, 2021-06-08 22:57:46

Why doesn't the constructor work in Laravel + php8?

With such a constructor entry

public function __construct(
        private RoleRepositoryInterface $role_repository,
        private RoleService $role_service,
    ) {}

issues
"message": "syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE)",

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2021-06-08
@Aslero

because the syntax is wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question