The internal class can be simplified by using psalm annotations to mark properties readonly and make them public. Write access would be detected by psalm and thrown as error.
When not having the requirement of php 7.2 (which still exists) https://github.com/Roave/you-are-using-it-wrong can be used afterwards to enforce the correct use of the library.