as its possible to pass null for $manager, we should check if $manager === null and throw an InvalidArgumentException in that case to avoid a fatal error.