repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/001.php | <?php
function swap(&$left, &$right): void
{
if ($left === $right) {
return;
}
$tmp = $left;
$left = $right;
$right = $tmp;
}
$a = 1;
$b = 2;
var_dump(swap($a, $b), $a, $b);
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/002.php | <?php
$data = [
[1, 'Tom'],
[2, 'Fred'],
];
// list() style
list($id1, $name1) = $data[0];
// [] style
[$id1, $name1] = $data[0];
// list() style
foreach ($data as list($id, $name)) {
// logic here with $id and $name
}
// [] style
foreach ($data as [$id, $name]) {
// logic here with $id and $name
}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/009.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/009.php | <?php
class Test
{
public function exposeFunction()
{
return Closure::fromCallable([$this, 'privateFunction']);
}
private function privateFunction($param)
{
var_dump($param);
}
}
$privFunc = (new Test)->exposeFunction();
$privFunc('some value');
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/007.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/007.php | <?php
var_dump('abcdef'[-2]);
var_dump(strpos('aabbcc', 'b', -3));
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/010.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/010.php | <?php
pcntl_async_signals(true); // turn on async signals
pcntl_signal(SIGHUP, function ($sig) {
echo "SIGHUP\n";
});
posix_kill(posix_getpid(), SIGHUP);
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/003.php | <?php
class ConstDemo
{
const PUBLIC_CONST_A = 1;
public const PUBLIC_CONST_B = 2;
protected const PROTECTED_CONST = 3;
private const PRIVATE_CONST = 4;
}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/008.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/008.php | <?php
$string = 'bar';
echo "The last character of '$string' is '$string[-1]'.\n";
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/000.php | <?php
function testReturnA(): ?string
{
return 'elePHPant';
}
var_dump(testReturnA());
function testReturnB(): ?string
{
return null;
}
var_dump(testReturnB());
function test(?string $name)
{
var_dump($name);
}
test('elePHPant');
test(null);
test();
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/005.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/new-features/005.php | <?php
try {
// some code
} catch (FirstException|SecondException $e) {
// handle first and second exceptions
}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/006.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/006.php | <?php
var_dump(json_decode(json_encode(['' => 1])));
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/004.php | <?php
new DateTime() == new DateTime();
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/001.php | <?php
(function () {
$func = 'func_num_args';
$func();
})();
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/002.php | <?php
$a = '';
$a[10] = 'foo';
var_dump($a);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/003.php | <?php
$array = [];
$array['a'] = &$array['b'];
$array['b'] = 1;
var_dump($array);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/000.php | <?php
function test($param) {}
test();
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/005.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration71/incompatible/005.php | <?php
$f = function () use ($_SERVER) {};
$f = function () use ($this) {};
$f = function ($param) use ($param) {};
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/deprecated/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/deprecated/000.php | <?php
var_dump(NONEXISTENT);
/*
* Output:
* Warning: Use of undefined constant NONEXISTENT - assumed 'NONEXISTENT' (this will throw an Error in a future version of PHP) in %s on line %d
* string(11) "NONEXISTENT"
*/
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/004.php | <?php
use Foo\Bar\{
Foo,
Bar,
Baz,
};
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/001.php | <?php
abstract class A
{
abstract function test(string $s);
}
abstract class B extends A
{
// overridden - still maintaining contravariance for parameters and covariance for return
abstract function test($s): int;
}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/002.php | <?php
$db->quote('über', PDO::PARAM_STR | PDO::PARAM_STR_NATL);
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/003.php | <?php
interface A
{
public function Test(array $input);
}
class B implements A
{
public function Test($input) {} // type omitted for $input
}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/new-features/000.php | <?php
function test(object $obj): object
{
return new SplQueue();
}
test(new stdClass());
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/001.php | <?php
// array to object
$arr = [0 => 1];
$obj = (object) $arr;
var_dump(
$obj,
$obj->{'0'}, // now accessible
$obj->{0} // now accessible
);
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/002.php | <?php
// object to array
$obj = new class {
public function __construct()
{
$this->{0} = 1;
}
};
$arr = (array) $obj;
var_dump(
$arr,
$arr[0], // now accessible
$arr['0'] // now accessible
);
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/003.php | <?php
var_dump(
count(null), // NULL is not countable
count(1), // integers are not countable
count('abc'), // strings are not countable
count(new stdClass), // objects not implementing the Countable interface are not countable
count([1, 2]) // arrays are countable
);
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration72/incompatible/000.php | <?php
var_dump(number_format(-0.01)); // now outputs string(1) "0" instead of string(2) "-0"
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/004.php | <?php
// From undefined
$arr[] = 'some value';
$arr['doesNotExist'][] = 2;
// From null
$arr = null;
$arr[] = 2;
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/001.php | <?php
$a = [];
$a[15.5]; // deprecated, as key value loses the 0.5 component
$a[15.0]; // ok, as 15.0 == 15
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/002.php | <?php
function &test(): void {}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/003.php | <?php
$arr = false;
$arr[] = 2; // deprecated
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/deprecated/000.php | <?php
var_dump(str_contains('foobar', null));
// Deprecated: Passing null to parameter #2 ($needle) of type string
// is deprecated
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/006.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/006.php | <?php
$stmt = $mysqli->prepare('INSERT INTO users(id, name) VALUES(?,?)');
$stmt->execute([1, $username]);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/004.php | <?php
$h = hash('xxh3', $data, options: ['seed' => 42]);
echo $h, "\n";
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/001.php | <?php
$arr1 = [1, 'a' => 'b'];
$arr2 = [...$arr1, 'c' => 'd']; // [1, 'a' => 'b', 'c' => 'd']
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/002.php | <?php
$file = new CURLStringFile($data, 'filename.txt', 'text/plain');
curl_setopt($curl, CURLOPT_POSTFIELDS, ['file' => $file]);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/007.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/007.php | <?php
$result = $mysqli->query('SELECT username FROM users WHERE id = 123');
echo $result->fetch_column();
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/003.php | <?php
$h = hash('murmur3f', $data, options: ['seed' => 42]);
echo $h, "\n";
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/008.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/008.php | <?php
new PDO('sqlite:file:path/to/sqlite.db?mode=ro')
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/000.php | <?php
014; // Non-prefix octal literal
014; // Prefixed octal literal
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/005.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/new-features/005.php | <?php
$h = hash('xxh3', $data, options: ['secret' => 'at least 136 bytes long secret here']);
echo $h, "\n";
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/incompatible/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/incompatible/001.php | <?php
function makeyogurt($container = 'bowl', $flavour)
{
return "Making a $container of $flavour yogurt.\n";
}
try {
echo makeyogurt(flavour: 'raspberry');
} catch (Error $e) {
echo get_class($e), ' - ', $e->getMessage(), "\n";
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/incompatible/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration81/incompatible/000.php | <?php
class A
{
public static function counter()
{
static $counter = 0;
$counter++;
return $counter;
}
}
class B extends A {}
var_dump(A::counter()); // int(1)
var_dump(A::counter()); // int(2)
var_dump(B::counter()); // int(3), previously int(1)
var_dump(B::counter()); // int(4), previously int(2)
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/001.php | <?php
function test(A $a = null, $b) {} // Still allowed
function test(?A $a, $b) {} // Recommended
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/002.php | <?php
// Replace
usort($array, fn($a, $b) => $a > $b);
// With
usort($array, fn($a, $b) => $a <=> $b);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/003.php | <?php
// iterate using the procedural API
assert(is_resource($zip));
while ($entry = zip_read($zip)) {
echo zip_entry_name($entry);
}
// iterate using the object-oriented API
assert($zip instanceof ZipArchive);
for ($i = 0; $entry = $zip->statIndex($i); $i++) {
echo $entry['name'];
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/deprecated/000.php | <?php
function test($a = [], $b) {} // Before
function test($a, $b) {} // After
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/006.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/006.php | <?php
$proc = proc_open($command, [['pty'], ['pty'], ['pty']], $pipes);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/004.php | <?php
class ParentClass
{
private function method1() {}
private function method2() {}
private static function method3() {}
// Throws a warning, as "final" no longer has an effect:
private final function method4() {}
}
class ChildClass extends ParentClass
{
// All of the following are now allowed, even though the... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/001.php | <?php
class Test
{
public function create(): static
{
return new static();
}
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/002.php | <?php
$fn = fn() => throw new Exception('Exception in arrow function');
$user = $session->user ?? throw new Exception('Must have user');
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/007.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/007.php | <?php
$proc = proc_open($command, [['socket'], ['socket'], ['socket']], $pipes);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/003.php | <?php
function functionWithLongSignature(
Type1 $parameter1,
Type2 $parameter2, // <-- This comma is now allowed.
) {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/008.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/008.php | <?php
// OK even if $excludes is empty:
array_diff($array, ...$excludes);
// OK even if $arrays only contains a single array:
array_intersect(...$arrays);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/000.php | <?php
class A
{
public function method(int $many, string $parameters, $here) {}
}
class B extends A
{
public function method(...$everything) {}
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/005.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/new-features/005.php | <?php
printf('%.*H', (int) ini_get('precision'), $float);
printf('%.*H', (int) ini_get('serialize_precision'), $float);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/006.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/006.php | <?php
setlocale(LC_ALL, 'de_DE');
$f = 3.14;
echo $f, "\n";
// Previously: 3,14
// Now: 3.14
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/004.php | <?php
class X
{
use T1, T2 {
func as otherFunc;
}
function func() {}
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/001.php | <?php
echo 'Sum: ' . $a + $b;
// was previously interpreted as:
echo ('Sum: ' . $a) + $b;
// is now interpreted as:
echo 'Sum:' . ($a + $b);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/002.php | <?php
// Replace
function test(int $arg = CONST_RESOLVING_TO_NULL) {}
// With
function test(?int $arg = CONST_RESOLVING_TO_NULL) {}
// Or
function test(int $arg = null) {}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/007.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/007.php | <?php
// Instead of:
$array{0};
$array{'key'};
// Write:
$array[0];
$array['key'];
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/003.php | <?php
new class extends ParentClass {};
// -> ParentClass@anonymous
new class implements FirstInterface, SecondInterface {};
// -> FirstInterface@anonymous
new class {};
// -> class@anonymous
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/008.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/008.php | <?php
$ctx = stream_context_create(['http' => ['protocol_version' => '1.0']]);
echo file_get_contents('http://example.org', false, $ctx);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/000.php | <?php
// Replace
function my_error_handler($err_no, $err_msg, $filename, $linenum)
{
if (error_reporting() == 0) {
return false;
}
// ...
}
// With
function my_error_handler($err_no, $err_msg, $filename, $linenum)
{
if (!(error_reporting() & $err_no)) {
return false;
}
// ...
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/005.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration80/incompatible/005.php | <?php
trait MyTrait
{
abstract private function neededByTrait(): string;
}
class MyClass
{
use MyTrait;
// Error, because of return type mismatch.
private function neededByTrait(): int
{
return 42;
}
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/006.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/006.php | <?php
class _ {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/004.php | <?php
function foo(T1 $a, T2|null $b, T3 $c) {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/001.php | <?php
function foo(T1|null $a = null) {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/002.php | <?php
function foo(?T1 $a = null) {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/007.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/007.php | <?php
class _MyClass {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/003.php | <?php
function foo(T1 $a, T2 $b = null, T3 $c) {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/000.php | <?php
function foo(T1 $a = null) {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/005.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/deprecated/005.php | <?php
function foo(T1 $a, ?T2 $b, T3 $c) {}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/new-features/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/new-features/001.php | <?php
class Example
{
// The first visibility modifier controls the get-visibility, and the second modifier
// controls the set-visibility. The get-visibility must not be narrower than set-visibility.
public protected(set) string $name;
public function __construct(string $name)
{
$this->name = $name;
}
}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/new-features/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/new-features/002.php | <?php
class Example
{
public function __construct(
private int $data
) {}
// ...
}
$initializer = static function (Example $ghost): void {
// Fetch data or dependencies
$data = getData();
// Initialize
$ghost->__construct($data);
};
$reflector = new ReflectionClass(Example::class);
$object = $reflector->new... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/new-features/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/new-features/000.php | <?php
class Person
{
// A "virtual" property. It may not be set explicitly.
public string $fullName {
get => $this->firstName . ' ' . $this->lastName;
}
// All write operations go through this hook, and the result is what is written.
// Read access happens normally.
public string $firstName {
set => ucfirst... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/incompatible/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration84/incompatible/000.php | <?php
$xmlString = '<root><a><b>1</b><b>2</b><b>3</b></a></root>';
$xml = simplexml_load_string($xmlString);
$nodes = $xml->a->b;
foreach ($nodes as $nodeData) {
echo 'nodeData: ' . $nodeData . "\n";
$xml = $nodes->asXml();
}
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/deprecated/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/deprecated/001.php | 1 ? 2 ? 3 : 4 : 5 // ok | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/deprecated/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/deprecated/002.php | <?php
// ReflectionClass::export(Foo::class, false) is:
echo new ReflectionClass(Foo::class), "\n";
// $str = ReflectionClass::export(Foo::class, true) is:
$str = (string) new ReflectionClass(Foo::class);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/deprecated/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/deprecated/000.php | <?php
1 ? 2 : 3 ? 4 : 5; // deprecated
(1 ? 2 : 3) ? 4 : 5; // ok
1 ? 2 : (3 ? 4 : 5); // ok
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/006.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/006.php | <?php
6.674083e-11; // float
299_792_458; // decimal
0xCAFE_F00D; // hexadecimal
0b0101_1111; // binary
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/004.php | <?php
$array['key'] ??= computeDefault();
// is roughly equivalent to
if (!isset($array['key'])) {
$array['key'] = computeDefault();
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/001.php | <?php
$factor = 10;
$nums = array_map(fn($n) => $n * $factor, [1, 2, 3, 4]);
// $nums = array(10, 20, 30, 40);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/002.php | <?php
class A {}
class B extends A {}
class Producer
{
public function method(): A {}
}
class ChildProducer extends Producer
{
public function method(): B {}
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/009.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/009.php | <?php
// Like 2>&1 on the shell
proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['redirect', 1]], $pipes);
// Like 2>/dev/null or 2>nul on the shell
proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['null']], $pipes);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/003.php | <?php
/**
* These classes satisfy the LSP requirements, because C is a subtype of A.
* However, at the time class B is declared, class C is not yet available
*/
class A
{
public function method(): A {}
}
class B extends A
{
// Fatal error: Could not check compatibility between B::method():C and
// A::method(): ... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/008.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/008.php | <?php
proc_open(['php', '-r', 'echo "Hello World\n";'], $descriptors, $pipes);
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/000.php | <?php
class User
{
public int $id;
public string $name;
}
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/005.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration74/new-features/005.php | <?php
$parts = ['apple', 'pear'];
$fruits = ['banana', 'orange', ...$parts, 'watermelon'];
// ['banana', 'orange', 'apple', 'pear', 'watermelon'];
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration83/new-features/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration83/new-features/000.php | <?php
/*
* On /path/to/user.ini contains the following settings:
*
* listen = localhost:${DRUPAL_FPM_PORT:-9000}
*/
$user_ini = parse_ini_file('/path/to/user.ini');
echo $user_ini['listen']; // localhost:9000
| php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration83/incompatible/000.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/migration83/incompatible/000.php | <?php
range('9', 'A'); // ["9", ":", ";", "<", "=", ">", "?", "@", "A"], as of PHP 8.3.0
range('9', 'A'); // [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], prior to PHP 8.3.0
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/006.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/006.php | <?php
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'convert.iconv.utf-16le.utf-8');
fwrite($fp, "T\0h\0i\0s\0 \0i\0s\0 \0a\0 \0t\0e\0s\0t\0.\0\n\0");
fclose($fp);
/* Outputs: This is a test. */
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/004.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/004.php | <?php
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'convert.base64-encode');
fwrite($fp, "This is a test.\n");
fclose($fp);
/* Outputs: VGhpcyBpcyBhIHRlc3QuCg== */
$param = array('line-length' => 8, 'line-break-chars' => "\r\n");
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'convert.base... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/001.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/001.php | <?php
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'string.toupper');
fwrite($fp, "This is a test.\n");
/* Outputs: THIS IS A TEST. */
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/002.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/002.php | <?php
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'string.tolower');
fwrite($fp, "This is a test.\n");
/* Outputs: this is a test. */
?> | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/011.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/011.php | <?php
AES_CBC::encryptFile($password, 'plaintext.txt', 'encrypted.enc');
AES_CBC::decryptFile($password, 'encrypted.enc', 'decrypted.txt');
class AES_CBC
{
protected static $KEY_SIZES = array('AES-128' => 16, 'AES-192' => 24, 'AES-256' => 32);
protected static function key_size()
{
return self::$KEY_SIZES['AES-1... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/009.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/009.php | <?php
$param = array('blocks' => 9, 'work' => 0);
echo 'The original file is ' . filesize('LICENSE') . " bytes long.\n";
$fp = fopen('LICENSE.compressed', 'w');
stream_filter_append($fp, 'bzip2.compress', STREAM_FILTER_WRITE, $param);
fwrite($fp, file_get_contents('LICENSE'));
fclose($fp);
echo 'The compressed file ... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/007.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/007.php | <?php
$params = array('level' => 6, 'window' => 15, 'memory' => 9);
$original_text = "This is a test.\nThis is only a test.\nThis is not an important string.\n";
echo 'The original text is ' . strlen($original_text) . " characters long.\n";
$fp = fopen('test.deflated', 'w');
stream_filter_append($fp, 'zlib.deflate', ... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/010.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/010.php | <?php
// $key assumed to be previously generated
$iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC);
$iv = mcrypt_create_iv($iv_size, MCRYPT_DEV_URANDOM);
$fp = fopen('encrypted-file.enc', 'wb');
fwrite($fp, $iv);
$opts = array('mode' => 'cbc', 'iv' => $iv, 'key' => $key);
stream_filter_append($fp, 'mcrypt... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/003.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/003.php | <?php
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, '<b><i><u>');
fwrite($fp, "<b>bolded text</b> enlarged to a <h1>level 1 heading</h1>\n");
fclose($fp);
/* Outputs: bolded text enlarged to a level 1 heading */
$fp = fopen('php://output', 'w');
stream_filter_ap... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/008.php | tests/fixtures/Formatter/out/03-tab/3rdparty/php-doc/appendices/filters/008.php | <?php
$original_text = "This is a test.\nThis is only a test.\nThis is not an important string.\n";
echo 'The original text is ' . strlen($original_text) . " characters long.\n";
$fp = fopen('test.deflated', 'w');
/* Here "6" indicates compression level 6 */
stream_filter_append($fp, 'zlib.deflate', STREAM_FILTER_WRIT... | php | MIT | 5d244a4b7a9b484581edbb5df596a4e76ba17fa6 | 2026-01-05T04:31:39.990954Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.