The manual construction of User objects via new User should not be used, because the constructor is marked as @internal since 1.36.
Use one of the UserFactory::new* methods, for anonymous objects use UserFactory::newAnonymous
CodeSearch: https://codesearch.wmcloud.org/search/?q=%5Cbnew%5Cs%2B%5C%5C%3FUser%5Cb&i=nope&files=&excludeFiles=&repos=