Mixing state and dependencies

Can this be considered good or bad practice?


class HotelController extends Controller
{    
    public function actionBook($id, BookingInterface $bookingService)
    {
        $result = $bookingService->book($id);
        // ...    
    }
}

First argument is object state, but the second is object dependencies. Should they be mixed in the same method signature, really? Or is this due to historic reasons?

I would say the DI should go to the constructor so it smells here.

One could make a similar argument related to class properties: That a class should have state or (effectful) dependencies (like a database connection), to keep the intention of the class clear. For example, an ActiveRecord class would have properties corresponding to its database table - including the table name - but the database connection would be an argument to the save-method:

$user = new User();
$user->name = 'Foo';
$user->save($dbConnection);

That’s alright in controllers but not in services / components.