minor #37128 Small update in our internal terminology (Nyholm)

This PR was submitted for the master branch but it was squashed and merged into the 5.1 branch instead.

Discussion
----------

Small update in our internal terminology

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

I would like us to use the term "blocklist" instead of "blacklist". I've updated all the internal uses I could find. There are no BC breaks.

We still use some "blacklist" when we relate to `PHPUnit\Util\Blacklist`

Commits
-------

00682acdea Small update in our internal terminology
This commit is contained in:
Nicolas Grekas 2020-06-18 20:44:13 +02:00
commit 399fb7b8d6
2 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
$options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use ($onProgress, $subnets, &$lastPrimaryIp): void { $options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use ($onProgress, $subnets, &$lastPrimaryIp): void {
if ($info['primary_ip'] !== $lastPrimaryIp) { if ($info['primary_ip'] !== $lastPrimaryIp) {
if (IpUtils::checkIp($info['primary_ip'], $subnets ?? self::PRIVATE_SUBNETS)) { if (IpUtils::checkIp($info['primary_ip'], $subnets ?? self::PRIVATE_SUBNETS)) {
throw new TransportException(sprintf('IP "%s" is blacklisted for "%s".', $info['primary_ip'], $info['url'])); throw new TransportException(sprintf('IP "%s" is blocked for "%s".', $info['primary_ip'], $info['url']));
} }
$lastPrimaryIp = $info['primary_ip']; $lastPrimaryIp = $info['primary_ip'];

View File

@ -22,7 +22,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
class NoPrivateNetworkHttpClientTest extends TestCase class NoPrivateNetworkHttpClientTest extends TestCase
{ {
public function getBlacklistData(): array public function getExcludeData(): array
{ {
return [ return [
// private // private
@ -63,16 +63,16 @@ class NoPrivateNetworkHttpClientTest extends TestCase
} }
/** /**
* @dataProvider getBlacklistData * @dataProvider getExcludeData
*/ */
public function testBlacklist(string $ipAddr, $subnets, bool $mustThrow) public function testExclude(string $ipAddr, $subnets, bool $mustThrow)
{ {
$content = 'foo'; $content = 'foo';
$url = sprintf('http://%s/', 0 < substr_count($ipAddr, ':') ? sprintf('[%s]', $ipAddr) : $ipAddr); $url = sprintf('http://%s/', 0 < substr_count($ipAddr, ':') ? sprintf('[%s]', $ipAddr) : $ipAddr);
if ($mustThrow) { if ($mustThrow) {
$this->expectException(TransportException::class); $this->expectException(TransportException::class);
$this->expectExceptionMessage(sprintf('IP "%s" is blacklisted for "%s".', $ipAddr, $url)); $this->expectExceptionMessage(sprintf('IP "%s" is blocked for "%s".', $ipAddr, $url));
} }
$previousHttpClient = $this->getHttpClientMock($url, $ipAddr, $content); $previousHttpClient = $this->getHttpClientMock($url, $ipAddr, $content);