How can I use UserPasswordEncoderInterface without having to declare it as a function parameter? I would like to use this method somewhere else and because of that I can't.
namespace App\Controller;
/.../
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
class UserController extends AbstractController
{
public function register(UserPasswordEncoderInterface $passwordEncoder, Request $request)
{
//some code here
}