This depends on 114-throw-statement-and-catch-clause-dont-check-for-exception-types
It improves the validation on System.runAs. This is parsed a statement because of the associated block but Salesforce refer to it as a method. To handle more like a method the apex-parser allows for multiple parameters but in reality only one is supported which must either be a User SObject or System.Version object. We validate the expression provided returns one of these.
I did think we should check this is only used in test context but its allowed in any code and produces a runtime exception if used outside of a test context so I have not added a check for being used in a test class.
This depends on 114-throw-statement-and-catch-clause-dont-check-for-exception-types
It improves the validation on System.runAs. This is parsed a statement because of the associated block but Salesforce refer to it as a method. To handle more like a method the apex-parser allows for multiple parameters but in reality only one is supported which must either be a User SObject or System.Version object. We validate the expression provided returns one of these.
I did think we should check this is only used in test context but its allowed in any code and produces a runtime exception if used outside of a test context so I have not added a check for being used in a test class.