Description
Symfony version(s) affected: x.y.z
Symfony 5.1
Description
I recently upgraded from 4.4 to 5.1. I completed the advised step to correct all deprecation messages from 4.4 before upgrading. However, after upgrading I have been seeing the below.
@internal
annotations on some interfaces and classes are causing "deprecation" warnings to appear during tests. I use Mockery to mock objects when testing. This particular instance is when conducting some small unit tests for a form validator. Mocking ExecutionContextInterface
yields the below deprecation message.
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::setNode()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
I have also ran into it when mocking the Constraint
class.
1x: The "Symfony\Component\Validator\Constraint::__sleep()" method is considered internal. It may change without further notice. You should not extend it from "Mockery_2_Symfony_Component_Validator_Constraint".
How to reproduce
Mock the above mentioned interface/class
Possible Solution
Change the annotation to not use @internal
and maybe switch to another annotation to indicate the message of not intended for user-code usage?
Additional context
There were other methods indicated for the ExecutionContextInterface
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::setGroup()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::setConstraint()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::markGroupAsValidated()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::isGroupValidated()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::markConstraintAsValidated()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::isConstraintValidated()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::markObjectAsInitialized()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".
1x: The "Symfony\Component\Validator\Context\ExecutionContextInterface::isObjectInitialized()" method is considered internal Used by the validator engine. Should not be called by user * code. It may change without further notice. You should not extend it from "Mockery_0_Symfony_Component_Validator_Context_ExecutionContextInterface".