name; $constantValue = $constant->value; $stubConstant = PhpStormStubsSingleton::getPhpStormStubs()->getConstant($constantName); self::assertEquals( $constantValue, $stubConstant->value, "Constant value mismatch: const $constantName \n\n Expected value: $constantValue but was $stubConstant->value" ); } /** * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::functionOptionalParametersWithDefaultValueProvider * @throws Exception|RuntimeException */ public function testFunctionsDefaultParametersValue(PHPFunction $function, PHPParameter $parameter) { $phpstormFunction = PhpStormStubsSingleton::getPhpStormStubs()->getFunction($function->name); $stubParameters = array_filter($phpstormFunction->parameters, fn (PHPParameter $stubParameter) => $stubParameter->indexInSignature === $parameter->indexInSignature); /** @var PHPParameter $stubOptionalParameter */ $stubOptionalParameter = array_pop($stubParameters); $reflectionValue = AbstractBaseStubsTestCase::getStringRepresentationOfDefaultParameterValue($parameter->defaultValue); $stubValue = AbstractBaseStubsTestCase::getStringRepresentationOfDefaultParameterValue($stubOptionalParameter->defaultValue); self::assertEquals( $reflectionValue, $stubValue, sprintf( 'Reflection function %s has optional parameter %s with default value "%s" but stub parameter has value "%s"', $function->name, $parameter->name, $reflectionValue, $stubValue ) ); } /** * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::methodOptionalParametersWithDefaultValueProvider * @throws Exception|RuntimeException */ public function testMethodsDefaultParametersValue( PHPClass|PHPInterface $class, PHPMethod $method, PHPParameter $parameter, ) { if ($class instanceof PHPClass) { $phpstormFunction = PhpStormStubsSingleton::getPhpStormStubs()->getClass($class->name)->getMethod($method->name); } else { $phpstormFunction = PhpStormStubsSingleton::getPhpStormStubs()->getInterface($class->name)->getMethod($method->name); } $stubParameters = array_filter($phpstormFunction->parameters, fn (PHPParameter $stubParameter) => $stubParameter->indexInSignature === $parameter->indexInSignature); /** @var PHPParameter $stubOptionalParameter */ $stubOptionalParameter = array_pop($stubParameters); $reflectionValue = AbstractBaseStubsTestCase::getStringRepresentationOfDefaultParameterValue($parameter->defaultValue); $stubValue = AbstractBaseStubsTestCase::getStringRepresentationOfDefaultParameterValue($stubOptionalParameter->defaultValue, $class); self::assertEquals( $reflectionValue, $stubValue, sprintf( 'Reflection method %s::%s has optional parameter %s with default value %s but stub parameter has value %s', $class->name, $method->name, $parameter->name, $reflectionValue, $stubValue ) ); } } __halt_compiler();----SIGNATURE:----MtxWEuL6cflwUmsITZdemHNfws9C58CRgyeSIcd2HVs0RUVUuETlGULIZwviK6PcTjBfDeYUw3AbAszYPhL0479YdhT3R/demB8phFoE5NmyWb5vTyiQLvH3HqoI2Bchn/hphN0swUiPVjohohinN6YXRqgjDlk7eB1jLLNqh+tK2yzog1nuEQ0oZJd/upj1kr5CiDCQ6bOIbG5eFF+PfqSh3NGj+bpBKmlDirULXTMbwg9ROfaC67auedkVhch5UEpoDbRgZQ10CyVtTjDUpn1GRg5wt6GR+M+xu/oYJUhShw1OGXzh766/9nsvfF8QAZ+ptf5t1dUuWSWiKgf4uBQKqNCwetGAiS+EQpvKHs0fBz0SZX6l7h3sKQgTCosW1IgOI3gKuswVOKxj/qeW5tBQt6qlDI7xsuG+HvVwtUEpOgqZ+QzWVVpjw9/DT1EV1yJ4bSX+1t8T2JSV4Ba+KaWS2NKltJD6Mey4Mh6bv6jADDNUGyFz6srAdL3RDMq4pqyARGenBCnV11rqO17OKrQfzCe6bRkviT075KtKxvamqunOtwWy/7UgvNGeJ2LNIvPUTK5aLVedVk3lxnNIQ4QakzzW/CoBjrnLTKIfDWWeS0JhotpH6T++1KgTlI2Iyat/gFCv90QW25ZPQaUJyX0uXhHVhkTKMZPpbX1pUC0=----ATTACHMENT:----MTc4NDQ4MTEzNTM3OTYwMCA3Mjg0NjgzOTc1Nzg0OTEgODU3MTYwNzQ1MjUzNjE2OA==