Skip to content

Commit

Permalink
Merge branch '9.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 29, 2020
2 parents 704b321 + 12e1872 commit 081dcb4
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 40 deletions.
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ return PhpCsFixer\Config::create()
'elseif' => true,
'encoding' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'global_namespace_import' => [
Expand Down
2 changes: 1 addition & 1 deletion .psalm/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<code>$className</code>
</ArgumentTypeCoercion>
<PossiblyUndefinedVariable occurrences="1">
<code>$afterClassMethod</code>
<code>${afterClassMethod}</code>
</PossiblyUndefinedVariable>
</file>
<file src="src/Runner/PhptTestCase.php">
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/MockObject/MockMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function generateCode(): string
$deprecation = $this->deprecation;

if (null !== $this->deprecation) {
$deprecation = "The $this->className::$this->methodName method is deprecated ($this->deprecation).";
$deprecation = "The {$this->className}::{$this->methodName} method is deprecated ({$this->deprecation}).";
$deprecationTemplate = $this->getTemplate('deprecation.tpl');

$deprecationTemplate->setVar([
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ class_exists($this->name, false) &&
}
}
} catch (Throwable $t) {
$message = "Exception in {$this->name}::$afterClassMethod" . PHP_EOL . $t->getMessage();
$message = "Exception in {$this->name}::${afterClassMethod}" . PHP_EOL . $t->getMessage();
$error = new SyntheticError($message, 0, $t->getFile(), $t->getLine(), $t->getTrace());

$placeholderTest = clone $test;
Expand Down
2 changes: 1 addition & 1 deletion src/Runner/PhptTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ private function parse(): array
foreach ($unsupportedSections as $section) {
if (isset($sections[$section])) {
throw new Exception(
"PHPUnit does not support PHPT $section sections"
"PHPUnit does not support PHPT ${section} sections"
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/TextUI/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function writeToConsole(): void
private function writePlaintext(): void
{
foreach (self::HELP_TEXT as $section => $options) {
print "$section:" . PHP_EOL;
print "${section}:" . PHP_EOL;

if ($section !== 'Usage') {
print PHP_EOL;
Expand Down Expand Up @@ -220,7 +220,7 @@ private function writePlaintext(): void
private function writeWithColor(): void
{
foreach (self::HELP_TEXT as $section => $options) {
print Color::colorize('fg-yellow', "$section:") . PHP_EOL;
print Color::colorize('fg-yellow', "${section}:") . PHP_EOL;

foreach ($options as $option) {
if (isset($option['spacer'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static function dim(string $buffer): string
return $buffer;
}

return "\e[2m$buffer\e[22m";
return "\e[2m${buffer}\e[22m";
}

public static function visualizeWhitespace(string $buffer, bool $visualizeEOL = false): string
Expand Down
12 changes: 6 additions & 6 deletions src/Util/Getopt.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private static function parseShortOption(string $arg, string $short_options, arr

if ($arg[$i] === ':' || ($spec = strstr($short_options, $opt)) === false) {
throw new Exception(
"unrecognized option -- $opt"
"unrecognized option -- ${opt}"
);
}

Expand All @@ -124,7 +124,7 @@ private static function parseShortOption(string $arg, string $short_options, arr
/* @noinspection ComparisonOperandsOrderInspection */
if (false === $opt_arg = current($args)) {
throw new Exception(
"option requires an argument -- $opt"
"option requires an argument -- ${opt}"
);
}

Expand Down Expand Up @@ -163,7 +163,7 @@ private static function parseLongOption(string $arg, array $long_options, array

if ($opt_rest !== '' && $i + 1 < $count && $opt[0] !== '=' && strpos($long_options[$i + 1], $opt) === 0) {
throw new Exception(
"option --$opt is ambiguous"
"option --${opt} is ambiguous"
);
}

Expand All @@ -173,15 +173,15 @@ private static function parseLongOption(string $arg, array $long_options, array
/* @noinspection ComparisonOperandsOrderInspection */
if (false === $opt_arg = current($args)) {
throw new Exception(
"option --$opt requires an argument"
"option --${opt} requires an argument"
);
}

next($args);
}
} elseif ($opt_arg) {
throw new Exception(
"option --$opt doesn't allow an argument"
"option --${opt} doesn't allow an argument"
);
}

Expand All @@ -191,6 +191,6 @@ private static function parseLongOption(string $arg, array $long_options, array
return;
}

throw new Exception("unrecognized option --$opt");
throw new Exception("unrecognized option --${opt}");
}
}
10 changes: 5 additions & 5 deletions src/Util/Log/TeamCity.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ public function startTestSuite(TestSuite $suite): void

if (class_exists($suiteName, false)) {
$fileName = self::getFileName($suiteName);
$parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
$parameters['locationHint'] = "php_qn://${fileName}::\\${suiteName}";
} else {
$split = explode('::', $suiteName);

if (count($split) === 2 && class_exists($split[0]) && method_exists($split[0], $split[1])) {
$fileName = self::getFileName($split[0]);
$parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
$parameters['locationHint'] = "php_qn://${fileName}::\\${suiteName}";
$parameters['name'] = $split[1];
}
}
Expand Down Expand Up @@ -261,7 +261,7 @@ public function startTest(Test $test): void
if ($test instanceof TestCase) {
$className = get_class($test);
$fileName = self::getFileName($className);
$params['locationHint'] = "php_qn://$fileName::\\$className::$testName";
$params['locationHint'] = "php_qn://${fileName}::\\${className}::${testName}";
}

$this->printEvent('testStarted', $params);
Expand Down Expand Up @@ -289,15 +289,15 @@ protected function writeProgress(string $progress): void

private function printEvent(string $eventName, array $params = []): void
{
$this->write("\n##teamcity[$eventName");
$this->write("\n##teamcity[${eventName}");

if ($this->flowId) {
$params['flowId'] = $this->flowId;
}

foreach ($params as $key => $value) {
$escapedValue = self::escapeValue((string) $value);
$this->write(" $key='$escapedValue'");
$this->write(" ${key}='${escapedValue}'");
}

$this->write("]\n");
Expand Down
2 changes: 1 addition & 1 deletion src/Util/XdebugFilterScriptGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static function ($item) {
\\XDEBUG_FILTER_CODE_COVERAGE,
\\XDEBUG_PATH_WHITELIST,
[
$files
${files}
]
);
Expand Down
2 changes: 1 addition & 1 deletion tests/_files/ExceptionStackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testPrintingChildException(): void
} catch (ExpectationFailedException $e) {
$message = $e->getMessage() . $e->getComparisonFailure()->getDiff();

throw new PHPUnit\Framework\Exception("Child exception\n$message", 101, $e);
throw new PHPUnit\Framework\Exception("Child exception\n${message}", 101, $e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/cli/_files/MyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public function __construct()

public function myHandler($value): void
{
print __METHOD__ . " $value\n";
print __METHOD__ . " ${value}\n";
}
}
2 changes: 1 addition & 1 deletion tests/unit/Framework/Assert/FunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testGlobalFunctionsFileContainsAllStaticAssertions(string $metho
Assert::assertContains(
$methodName,
self::$globalAssertionFunctions,
"Mapping for Assert::$methodName is missing in Functions.php"
"Mapping for Assert::${methodName} is missing in Functions.php"
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Framework/Constraint/DirectoryExistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testEvaluateThrowsExpectationFailedExceptionWhenDirectoryDoesNot
} catch (ExpectationFailedException $e) {
$this->assertSame(
<<<PHP
Failed asserting that directory "$directory" exists.
Failed asserting that directory "${directory}" exists.
PHP
,
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/Framework/Constraint/IsEqualTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testConstraintIsEqual2($expected, $actual, $message): void
$constraint->evaluate($actual, 'custom message');
} catch (ExpectationFailedException $e) {
$this->assertEquals(
"custom message\n$message",
"custom message\n${message}",
$this->trimnl(TestFailure::exceptionToString($e))
);

Expand Down Expand Up @@ -304,17 +304,17 @@ public function isEqualProvider(): array
--- Expected
+++ Actual
@@ @@
-SplObjectStorage Object &$storage1hash (
- '$ahash' => Array &0 (
- 'obj' => stdClass Object &$ahash (
-SplObjectStorage Object &${storage1hash} (
- '${ahash}' => Array &0 (
- 'obj' => stdClass Object &${ahash} (
- 'foo' => 'bar'
- )
- 'inf' => null
- )
- '$bhash' => Array &1 (
+SplObjectStorage Object &$storage2hash (
+ '$bhash' => Array &0 (
'obj' => stdClass Object &$bhash ()
- '${bhash}' => Array &1 (
+SplObjectStorage Object &${storage2hash} (
+ '${bhash}' => Array &0 (
'obj' => stdClass Object &${bhash} ()
'inf' => null
)
)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/Framework/ConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testConstraintFileNotExists(): void
} catch (ExpectationFailedException $e) {
$this->assertEquals(
<<<EOF
Failed asserting that file "$file" does not exist.
Failed asserting that file "${file}" does not exist.
EOF
,
Expand All @@ -122,7 +122,7 @@ public function testConstraintFileNotExists2(): void
$this->assertEquals(
<<<EOF
custom message
Failed asserting that file "$file" does not exist.
Failed asserting that file "${file}" does not exist.
EOF
,
Expand Down Expand Up @@ -1366,7 +1366,7 @@ public function testConstraintException(): void
$this->assertEquals(
<<<EOF
Failed asserting that exception of type "PHPUnit\TestFixture\DummyException" matches expected exception "FoobarException". Message was: "Test" at
$stackTrace.
${stackTrace}.
EOF
,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/TextUI/XmlConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testShouldUseDefaultValuesForInvalidIntegers(): void
public function testShouldParseXmlConfigurationRootAttributes(string $optionName, string $optionValue, $expected): void
{
$tmpFilename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'phpunit.' . $optionName . uniqid('', true) . '.xml';
$xml = "<phpunit $optionName='$optionValue'></phpunit>" . PHP_EOL;
$xml = "<phpunit ${optionName}='${optionValue}'></phpunit>" . PHP_EOL;
file_put_contents($tmpFilename, $xml);

$configuration = (new Loader)->load($tmpFilename);
Expand Down Expand Up @@ -593,7 +593,7 @@ public function testHandlePHPConfigurationDoesNotOverwriteVariablesFromPutEnv():
if ($backupFoo === false) {
putenv('foo'); // delete variable from environment
} else {
putenv("foo=$backupFoo");
putenv("foo=${backupFoo}");
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/Util/XDebugFilterScriptGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function testReturnsExpectedScript(): void
\\XDEBUG_FILTER_CODE_COVERAGE,
\\XDEBUG_PATH_WHITELIST,
[
'$expectedDirectory',
'$expectedDirectory',
'$expectedDirectory',
'${expectedDirectory}',
'${expectedDirectory}',
'${expectedDirectory}',
'src/foo.php',
'src/bar.php'
]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Util/XmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testPrepareString(string $char): void
$e = null;

$escapedString = Xml::prepareString($char);
$xml = "<?xml version='1.0' encoding='UTF-8' ?><tag>$escapedString</tag>";
$xml = "<?xml version='1.0' encoding='UTF-8' ?><tag>${escapedString}</tag>";
$dom = new DOMDocument('1.0', 'UTF-8');

try {
Expand Down

0 comments on commit 081dcb4

Please sign in to comment.