package updates
This commit is contained in:
@@ -273,6 +273,24 @@ class DebugClassLoaderTest extends TestCase
|
||||
));
|
||||
}
|
||||
|
||||
public function testExtendedMethodDefinesNewParameters()
|
||||
{
|
||||
$deprecations = array();
|
||||
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
|
||||
$e = error_reporting(E_USER_DEPRECATED);
|
||||
|
||||
class_exists(__NAMESPACE__.'\\Fixtures\SubClassWithAnnotatedParameters', true);
|
||||
|
||||
error_reporting($e);
|
||||
restore_error_handler();
|
||||
|
||||
$this->assertSame(array(
|
||||
'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::quzMethod()" method will require a new "Quz $quz" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
|
||||
'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::whereAmI()" method will require a new "bool $matrix" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
|
||||
'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::isSymfony()" method will require a new "true $yes" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
|
||||
), $deprecations);
|
||||
}
|
||||
|
||||
public function testUseTraitWithInternalMethod()
|
||||
{
|
||||
$deprecations = array();
|
||||
|
||||
@@ -333,6 +333,19 @@ class FlattenExceptionTest extends TestCase
|
||||
$this->assertNotContains('*value1*', $serializeTrace);
|
||||
}
|
||||
|
||||
public function testAnonymousClass()
|
||||
{
|
||||
$flattened = FlattenException::create(new class() extends \RuntimeException {
|
||||
});
|
||||
|
||||
$this->assertSame('RuntimeException@anonymous', $flattened->getClass());
|
||||
|
||||
$flattened = FlattenException::create(new \Exception(sprintf('Class "%s" blah.', \get_class(new class() extends \RuntimeException {
|
||||
}))));
|
||||
|
||||
$this->assertSame('Class "RuntimeException@anonymous" blah.', $flattened->getMessage());
|
||||
}
|
||||
|
||||
private function createException($foo)
|
||||
{
|
||||
return new \Exception();
|
||||
|
||||
34
vendor/symfony/debug/Tests/Fixtures/ClassWithAnnotatedParameters.php
vendored
Normal file
34
vendor/symfony/debug/Tests/Fixtures/ClassWithAnnotatedParameters.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Debug\Tests\Fixtures;
|
||||
|
||||
class ClassWithAnnotatedParameters
|
||||
{
|
||||
/**
|
||||
* @param string $foo this is a foo parameter
|
||||
*/
|
||||
public function fooMethod(string $foo)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $bar parameter not implemented yet
|
||||
*/
|
||||
public function barMethod(/* string $bar = null */)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Quz $quz parameter not implemented yet
|
||||
*/
|
||||
public function quzMethod(/* Quz $quz = null */)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param true $yes
|
||||
*/
|
||||
public function isSymfony()
|
||||
{
|
||||
}
|
||||
}
|
||||
14
vendor/symfony/debug/Tests/Fixtures/InterfaceWithAnnotatedParameters.php
vendored
Normal file
14
vendor/symfony/debug/Tests/Fixtures/InterfaceWithAnnotatedParameters.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Debug\Tests\Fixtures;
|
||||
|
||||
/**
|
||||
* Ensures a deprecation is triggered when a new parameter is not declared in child classes.
|
||||
*/
|
||||
interface InterfaceWithAnnotatedParameters
|
||||
{
|
||||
/**
|
||||
* @param bool $matrix
|
||||
*/
|
||||
public function whereAmI();
|
||||
}
|
||||
24
vendor/symfony/debug/Tests/Fixtures/SubClassWithAnnotatedParameters.php
vendored
Normal file
24
vendor/symfony/debug/Tests/Fixtures/SubClassWithAnnotatedParameters.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Debug\Tests\Fixtures;
|
||||
|
||||
class SubClassWithAnnotatedParameters extends ClassWithAnnotatedParameters implements InterfaceWithAnnotatedParameters
|
||||
{
|
||||
use TraitWithAnnotatedParameters;
|
||||
|
||||
public function fooMethod(string $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public function barMethod($bar = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function quzMethod()
|
||||
{
|
||||
}
|
||||
|
||||
public function whereAmI()
|
||||
{
|
||||
}
|
||||
}
|
||||
13
vendor/symfony/debug/Tests/Fixtures/TraitWithAnnotatedParameters.php
vendored
Normal file
13
vendor/symfony/debug/Tests/Fixtures/TraitWithAnnotatedParameters.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Debug\Tests\Fixtures;
|
||||
|
||||
trait TraitWithAnnotatedParameters
|
||||
{
|
||||
/**
|
||||
* `@param` annotations in traits are not parsed.
|
||||
*/
|
||||
public function isSymfony()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user