Merge branch '4.4' into 5.0

* 4.4:
  [Bridge/PhpUnit] fix parse error on PHP5
  Replace 403 with 401 in onAuthenticationFailure method
This commit is contained in:
Nicolas Grekas 2020-02-05 19:24:05 +01:00
commit 63bdce4847
3 changed files with 10 additions and 10 deletions

View File

@ -206,7 +206,7 @@ class Deprecation
return self::TYPE_DIRECT; return self::TYPE_DIRECT;
} }
private function getOriginalFilesStack(): array private function getOriginalFilesStack()
{ {
if (null === $this->originalFilesStack) { if (null === $this->originalFilesStack) {
$this->originalFilesStack = []; $this->originalFilesStack = [];

View File

@ -21,7 +21,7 @@ class DeprecationTest extends TestCase
{ {
private static $vendorDir; private static $vendorDir;
private static function getVendorDir(): string private static function getVendorDir()
{ {
if (null !== self::$vendorDir) { if (null !== self::$vendorDir) {
return self::$vendorDir; return self::$vendorDir;
@ -148,7 +148,7 @@ class DeprecationTest extends TestCase
$this->assertTrue($deprecation->isMuted()); $this->assertTrue($deprecation->isMuted());
} }
public function providerGetTypeDetectsSelf(): array public function providerGetTypeDetectsSelf()
{ {
foreach (get_declared_classes() as $class) { foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
@ -187,7 +187,7 @@ class DeprecationTest extends TestCase
/** /**
* @dataProvider providerGetTypeDetectsSelf * @dataProvider providerGetTypeDetectsSelf
*/ */
public function testGetTypeDetectsSelf(string $expectedType, string $message, string $traceClass, string $file): void public function testGetTypeDetectsSelf(string $expectedType, string $message, string $traceClass, string $file)
{ {
$trace = [ $trace = [
['class' => 'MyClass1', 'function' => 'myMethod'], ['class' => 'MyClass1', 'function' => 'myMethod'],
@ -197,7 +197,7 @@ class DeprecationTest extends TestCase
$this->assertSame($expectedType, $deprecation->getType()); $this->assertSame($expectedType, $deprecation->getType());
} }
public function providerGetTypeUsesRightTrace(): array public function providerGetTypeUsesRightTrace()
{ {
$vendorDir = self::getVendorDir(); $vendorDir = self::getVendorDir();
@ -243,7 +243,7 @@ class DeprecationTest extends TestCase
/** /**
* @dataProvider providerGetTypeUsesRightTrace * @dataProvider providerGetTypeUsesRightTrace
*/ */
public function testGetTypeUsesRightTrace(string $expectedType, string $message, array $trace): void public function testGetTypeUsesRightTrace(string $expectedType, string $message, array $trace)
{ {
$deprecation = new Deprecation( $deprecation = new Deprecation(
$message, $message,
@ -257,12 +257,12 @@ class DeprecationTest extends TestCase
* This method is here to simulate the extra level from the piece of code * This method is here to simulate the extra level from the piece of code
* triggering an error to the error handler. * triggering an error to the error handler.
*/ */
public function debugBacktrace(): array public function debugBacktrace()
{ {
return debug_backtrace(); return debug_backtrace();
} }
private static function removeDir($dir): void private static function removeDir($dir)
{ {
$files = glob($dir.'/*'); $files = glob($dir.'/*');
foreach ($files as $file) { foreach ($files as $file) {
@ -275,7 +275,7 @@ class DeprecationTest extends TestCase
rmdir($dir); rmdir($dir);
} }
public static function tearDownAfterClass(): void public static function tearDownAfterClass()
{ {
self::removeDir(self::getVendorDir().'/myfakevendor'); self::removeDir(self::getVendorDir().'/myfakevendor');
} }

View File

@ -113,7 +113,7 @@ interface AuthenticatorInterface extends AuthenticationEntryPointInterface
* Called when authentication executed, but failed (e.g. wrong username password). * Called when authentication executed, but failed (e.g. wrong username password).
* *
* This should return the Response sent back to the user, like a * This should return the Response sent back to the user, like a
* RedirectResponse to the login page or a 403 response. * RedirectResponse to the login page or a 401 response.
* *
* If you return null, the request will continue, but the user will * If you return null, the request will continue, but the user will
* not be authenticated. This is probably not what you want to do. * not be authenticated. This is probably not what you want to do.