Skip to content

Commit 1ba9cee

Browse files
Scott Owensmeta-codesync[bot]
authored andcommitted
Remove some chained assignments from tests
Summary: e.g., `$a = $b = f();` becomes ``` $b = $f(); $a = $b; ``` and `$a = list ($b, $c) = f();` becomes ``` $a = f(); list($b, $c); ``` We did this by having Claude write and apply a crappy codemod in D92297983 and then fixed things up by hand. Reviewed By: nt591 Differential Revision: D92301393 fbshipit-source-id: 8eacc9995a699de729530db4196cb0dcf2f7e19f
1 parent 76df11f commit 1ba9cee

43 files changed

Lines changed: 152 additions & 82 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

hphp/test/quick/exception_many_locals.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ function main() :mixed{
1616
$o = new c;
1717
echo "Creating second c\n";
1818
$p = new c;
19-
$o1 = $o2 = $o3 = $o4 = $o5 = $o6 = $o; // fill up caller-saved
19+
$o6 = $o; //fill up caller-saved
20+
$o5 = $o6;
21+
$o4 = $o5;
22+
$o3 = $o4;
23+
$o2 = $o3;
24+
$o1 = $o2;
2025
$o7 = $o; // use callee saved
2126
$p = 5;
2227
echo $x;

hphp/test/quick/generator_vars.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ function manylocals() :AsyncGenerator<mixed,mixed,void>{
6363
$a = yield dict['a' => $a, 'b' => $b, 'c' => $c, 'd' => $d, 'e' => $e, 'f' => $f, 'g' => $g, 'h' => $h, 'i' => $i, 'j' => $j, 'k' => $k, 'l' => $l];
6464
$b = 0xdeadbeef;
6565
$c = yield dict['a' => $a, 'b' => $b, 'c' => $c, 'd' => $d, 'e' => $e, 'f' => $f, 'g' => $g, 'h' => $h, 'i' => $i, 'j' => $j, 'k' => $k, 'l' => $l];
66-
$d = $e = 0xba53b411;
66+
$e = 0xba53b411;
67+
$d = $e;
6768
yield dict['a' => $a, 'b' => $b, 'c' => $c, 'd' => $d, 'e' => $e, 'f' => $f, 'g' => $g, 'h' => $h, 'i' => $i, 'j' => $j, 'k' => $k, 'l' => $l];
6869
}
6970

hphp/test/quick/many-clsrefs.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ class Bar {
1414
public static $prop10;
1515

1616
static function set($f) :mixed{
17-
self::$prop1 = self::$prop2 = self::$prop3 =
18-
self::$prop4 = self::$prop5 = self::$prop6 =
19-
self::$prop7 = self::$prop8 = self::$prop9 =
2017
self::$prop10 = $f();
18+
self::$prop9 = self::$prop10;
19+
self::$prop8 = self::$prop9;
20+
self::$prop7 = self::$prop8;
21+
self::$prop6 = self::$prop7;
22+
self::$prop5 = self::$prop6;
23+
self::$prop4 = self::$prop5;
24+
self::$prop3 = self::$prop4;
25+
self::$prop2 = self::$prop3;
26+
self::$prop1 = self::$prop2;
2127
}
2228

2329
static function dump() :mixed{

hphp/test/server/http/tests/hotswapTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
function runHotswapTest() {
44

55
$pid = posix_getpid();
6-
7-
$serverProc = $newServerProc = $serverPort = $adminPort = null;
6+
$adminPort = null;
7+
$serverPort = $adminPort;
8+
$newServerProc = $serverPort;
9+
$serverProc = $newServerProc;
810
$debugPort = false;
911
$serverHome = __DIR__.'/..';
1012
$serverRoot = __DIR__.'/../server_root';

hphp/test/slow/async/awaitall.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ function main_awaitall() :mixed{
9393
t($wh, $dicts);
9494

9595
echo "grandchildren\n";
96-
list($vecs, $dicts) = $handles = get_wrapped_handles();
96+
$handles = get_wrapped_handles();
97+
list($vecs, $dicts) = $handles;
9798

9899
$top = vec[
99100
AwaitAllWaitHandle::fromVec(vec($vecs)),

hphp/test/slow/closure/1921.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ function foo() :mixed{
99
} catch (UndefinedVariableException $e) {
1010
var_dump($e->getMessage());
1111
}
12-
$abc = $var = 333;
12+
$var = 333;
13+
$abc = $var;
1314
};
1415
var_dump($a());
1516
var_dump($abc, $var);

hphp/test/slow/compilation/1261.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class A {
66
<<__EntryPoint>>
77
function main_1261() :mixed{
88
$a = new A();
9-
$a->a = $a->b = 'test';
9+
$a->b = 'test';
10+
$a->a = $a->b;
1011
var_dump($a);
1112
}

hphp/test/slow/compilation/1262.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
function main_1262() :mixed{
66
$a = 1;
77
$a = dict[];
8-
$a['a'] = $a['b'] = 'test';
8+
$a['b'] = 'test';
9+
$a['a'] = $a['b'];
910
var_dump($a);
1011
}

hphp/test/slow/dv_array/ext_imagick/010_importimagepixels.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
/* Width and height. The area is amount of pixels divided
1717
by three. Three comes from 'RGB', three values per pixel */
18-
$width = $height = 100;
18+
$height = 100;
19+
$width = $height;
1920

2021
/* Create empty image */
2122
$im = new Imagick();

hphp/test/slow/dv_array_hack_arr/ext_imagick/010_importimagepixels.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
/* Width and height. The area is amount of pixels divided
1717
by three. Three comes from 'RGB', three values per pixel */
18-
$width = $height = 100;
18+
$height = 100;
19+
$width = $height;
1920

2021
/* Create empty image */
2122
$im = new Imagick();

0 commit comments

Comments
 (0)