1
0
Fork 0

Merge branch '2.2' into main

pull/10476/head
Jordi Boggiano 2022-02-15 16:52:03 +01:00
commit 45218092b4
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
5 changed files with 13 additions and 7 deletions

View File

@ -272,7 +272,7 @@ class ClassMapGenerator
if ($name[0] === ':') { if ($name[0] === ':') {
// This is an XHP class, https://github.com/facebook/xhp // This is an XHP class, https://github.com/facebook/xhp
$name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1); $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
} elseif ($matches['type'][$i] === 'enum') { } elseif (strtolower($matches['type'][$i]) === 'enum') {
// something like: // something like:
// enum Foo: int { HERP = '123'; } // enum Foo: int { HERP = '123'; }
// The regex above captures the colon, which isn't part of // The regex above captures the colon, which isn't part of

View File

@ -656,7 +656,7 @@ class PluginManager
} }
if (false === $allowPluginsConfig) { if (false === $allowPluginsConfig) {
return array('{^$}D' => false); return array('{}' => false);
} }
$rules = array(); $rules = array();

View File

@ -652,7 +652,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
return array(); return array();
} }
if ($this->providersUrl) { if (null !== $this->providersUrl && null !== $this->providerListing) {
return array_keys($this->providerListing); return array_keys($this->providerListing);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
enum RolesBackedEnum:string { EnUm RolesBackedEnum:string {
case Admin = 'Administrator'; case Admin = 'Administrator';
case Guest = 'Guest'; case Guest = 'Guest';
case Moderator = 'Moderator'; case Moderator = 'Moderator';

View File

@ -328,16 +328,20 @@ class ConfigTest extends TestCase
{ {
Platform::putEnv('COMPOSER_PROCESS_TIMEOUT', '0'); Platform::putEnv('COMPOSER_PROCESS_TIMEOUT', '0');
$config = new Config(true); $config = new Config(true);
$this->assertEquals(0, $config->get('process-timeout')); $result = $config->get('process-timeout');
Platform::clearEnv('COMPOSER_PROCESS_TIMEOUT'); Platform::clearEnv('COMPOSER_PROCESS_TIMEOUT');
$this->assertEquals(0, $result);
} }
public function testHtaccessProtect() public function testHtaccessProtect()
{ {
Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0'); Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0');
$config = new Config(true); $config = new Config(true);
$this->assertEquals(0, $config->get('htaccess-protect')); $result = $config->get('htaccess-protect');
Platform::clearEnv('COMPOSER_HTACCESS_PROTECT'); Platform::clearEnv('COMPOSER_HTACCESS_PROTECT');
$this->assertEquals(0, $result);
} }
public function testGetSourceOfValue() public function testGetSourceOfValue()
@ -360,7 +364,9 @@ class ConfigTest extends TestCase
{ {
Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0'); Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0');
$config = new Config; $config = new Config;
$this->assertEquals('COMPOSER_HTACCESS_PROTECT', $config->getSourceOfValue('htaccess-protect')); $result = $config->getSourceOfValue('htaccess-protect');
Platform::clearEnv('COMPOSER_HTACCESS_PROTECT'); Platform::clearEnv('COMPOSER_HTACCESS_PROTECT');
$this->assertEquals('COMPOSER_HTACCESS_PROTECT', $result);
} }
} }