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/01-default/3rdparty/php-doc/appendices/migration80/incompatible/003.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration80/incompatible/008.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration80/incompatible/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration80/incompatible/005.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/006.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/004.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/001.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/002.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/007.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/003.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/deprecated/005.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration84/new-features/001.php | tests/fixtures/Formatter/out/01-default/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->nam... | 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/01-default/3rdparty/php-doc/appendices/migration84/new-features/002.php | tests/fixtures/Formatter/out/01-default/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)... | 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/01-default/3rdparty/php-doc/appendices/migration84/new-features/000.php | tests/fixtures/Formatter/out/01-default/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 $firs... | 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/01-default/3rdparty/php-doc/appendices/migration84/incompatible/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/deprecated/001.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/deprecated/002.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/deprecated/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/006.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/004.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/001.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/002.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/009.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/003.php | tests/fixtures/Formatter/out/01-default/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::m... | 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/01-default/3rdparty/php-doc/appendices/migration74/new-features/008.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration74/new-features/005.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration83/new-features/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/migration83/incompatible/000.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/006.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/004.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/001.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/002.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/011.php | tests/fixtures/Formatter/out/01-default/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::$K... | 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/01-default/3rdparty/php-doc/appendices/filters/009.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/007.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/010.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/003.php | tests/fixtures/Formatter/out/01-default/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/01-default/3rdparty/php-doc/appendices/filters/008.php | tests/fixtures/Formatter/out/01-default/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 |
lkrms/pretty-php | https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/filters/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/filters/000.php | <?php
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'string.rot13');
fwrite($fp, "This is a test.\n");
/* Outputs: Guvf vf n grfg. */
?> | 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/01-default/3rdparty/php-doc/appendices/filters/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/filters/005.php | <?php
$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'convert.quoted-printable-encode');
fwrite($fp, "This is a test.\n");
/* Outputs: =This is a test.=0A */
?> | 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/01-default/3rdparty/php-doc/appendices/tokens/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/tokens/000.php | <?php
// Prior to PHP 7.4.0, T_FN is not defined.
defined('T_FN') || define('T_FN', 10001);
?> | 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/01-default/3rdparty/php-doc/appendices/migration85/new-features/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration85/new-features/001.php | <?php
#[\NoDiscard]
function concat(string $a, string $b): string
{
return $a . $b;
}
// Warning: The return value of function concat() should either be used or
// intentionally ignored by casting it as (void) in xxx.php
concat('a', 'b');
// No warning, because the return value is consumed by the assignment.
$re... | 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/01-default/3rdparty/php-doc/appendices/migration85/new-features/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration85/new-features/002.php | <?php
const T1 = (int) 0.3; // Previously: "Fatal error: Constant expression contains invalid operations"
print T1 . PHP_EOL; // Prints "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/01-default/3rdparty/php-doc/appendices/migration85/new-features/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration85/new-features/000.php | <?php
$result = 'Hello World'|> strlen(...);
print $result . PHP_EOL; // Prints "11"
| 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/01-default/3rdparty/php-doc/appendices/migration70/other-changes/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/other-changes/000.php | <?php
// 'new', 'private', and 'for' were previously unusable
Project::new('Project Name')->private()->for('purpose here')->with('username here');
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/deprecated/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/deprecated/001.php | <?php
class foo
{
function bar()
{
echo 'I am not static!';
}
}
foo::bar();
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/deprecated/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/deprecated/000.php | <?php
class foo
{
function foo()
{
echo 'I am the constructor';
}
}
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/006.php | <?php
echo 'ª', PHP_EOL;
echo 'ª', PHP_EOL;
echo '香', PHP_EOL;
echo <<<EOT
🐘
EOT;
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/013.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/013.php | <?php
function gen()
{
yield 1;
yield 2;
yield from gen2();
}
function gen2()
{
yield 3;
yield 4;
}
foreach (gen() as $val) {
echo $val, PHP_EOL;
}
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/004.php | <?php
define('ANIMALS', [
'dog',
'cat',
'bird'
]);
echo ANIMALS[1]; // outputs "cat"
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/001.php | <?php
function arraysSum(array ...$arrays): array
{
return array_map(function (array $array): int {
return array_sum($array);
}, $arrays);
}
print_r(arraysSum([1, 2, 3], [4, 5, 6], [7, 8, 9]));
| 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/002.php | <?php
// Fetches the value of $_GET['user'] and returns 'nobody'
// if it does not exist.
$username = $_GET['user'] ?? 'nobody';
// This is equivalent to:
$username = isset($_GET['user']) ? $_GET['user'] : 'nobody';
// Coalescing can be chained: this will return the first
// defined value out of $_GET['user'], $_POST[... | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/011.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/011.php | <?php
// Pre PHP 7 code
use some\namespace\ClassA;
use some\namespace\ClassB;
use some\namespace\ClassC as C;
use function some\namespace\fn_a;
use function some\namespace\fn_b;
use function some\namespace\fn_c;
use const some\namespace\ConstA;
use const some\namespace\ConstB;
use const some\namespace\ConstC;
// PHP... | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/009.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/009.php | <?php
printf('%x', IntlChar::CODEPOINT_MAX);
echo IntlChar::charName('@');
var_dump(IntlChar::ispunct('!'));
| 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/012.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/012.php | <?php
$gen = (function () {
yield 1;
yield 2;
return 3;
})();
foreach ($gen as $val) {
echo $val, PHP_EOL;
}
echo $gen->getReturn(), PHP_EOL;
| 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/014.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/014.php | <?php
var_dump(intdiv(10, 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/015.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/015.php | <?php
session_start([
'cache_limiter' => 'private',
'read_and_close' => true,
]);
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/007.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/007.php | <?php
class A
{
private $x = 1;
}
// Pre PHP 7 code
$getX = function () {
return $this->x;
};
$getXCB = $getX->bindTo(new A, 'A'); // intermediate closure
echo $getXCB();
// PHP 7+ code
$getX = function () {
return $this->x;
};
echo $getX->call(new 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/010.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/010.php | <?php
ini_set('assert.exception', 1);
class CustomError extends AssertionError {}
assert(false, new CustomError('Some error message'));
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/003.php | <?php
// Integers
echo 1 <=> 1; // 0
echo 1 <=> 2; // -1
echo 2 <=> 1; // 1
// Floats
echo 1.5 <=> 1.5; // 0
echo 1.5 <=> 2.5; // -1
echo 2.5 <=> 1.5; // 1
// Strings
echo 'a' <=> 'a'; // 0
echo 'a' <=> 'b'; // -1
echo 'b' <=> 'a'; // 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/008.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/008.php | <?php
// converts all objects into __PHP_Incomplete_Class object
$data = unserialize($foo, ['allowed_classes' => false]);
// converts all objects into __PHP_Incomplete_Class object except those of MyClass and MyClass2
$data = unserialize($foo, ['allowed_classes' => ['MyClass', 'MyClass2']]);
// default behaviour (sa... | 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/01-default/3rdparty/php-doc/appendices/migration70/new-features/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/000.php | <?php
// Coercive mode
function sumOfInts(int ...$ints)
{
return array_sum($ints);
}
var_dump(sumOfInts(2, '3', 4.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/01-default/3rdparty/php-doc/appendices/migration70/new-features/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/new-features/005.php | <?php
interface Logger
{
public function log(string $msg);
}
class Application
{
private $logger;
public function getLogger(): Logger
{
return $this->logger;
}
public function setLogger(Logger $logger)
{
$this->logger = $logger;
}
}
$app = new Application;
$app->setLo... | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/strings/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/strings/001.php | <?php
$str = '0xffff';
$int = filter_var($str, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX);
if (false === $int) {
throw new Exception('Invalid integer!');
}
var_dump($int); // int(65535)
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/strings/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/strings/000.php | <?php
var_dump('0x123' == '291');
var_dump(is_numeric('0x123'));
var_dump('0xe' + '0x1');
var_dump(substr('foo', '0x1'));
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/004.php | <?php
function getArray()
{
return [1, 2, 3];
}
function squareArray(array &$a)
{
foreach ($a as &$v) {
$v **= 2;
}
}
// Generates a warning in PHP 7.
squareArray((getArray()));
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/001.php | <?php
list($a[], $a[], $a[]) = [1, 2, 3];
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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/002.php | <?php
list() = $a;
list(,,) = $a;
list($x, list(), $y) = $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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/variable-handling/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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/integers/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/integers/001.php | <?php
var_dump(3 / 0);
var_dump(0 / 0);
var_dump(0 % 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/integers/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/integers/000.php | <?php
var_dump(1 >> -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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/foreach/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/foreach/001.php | <?php
$array = [0];
foreach ($array as &$val) {
var_dump($val);
$array[1] = 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/foreach/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/foreach/000.php | <?php
$array = [0, 1, 2];
foreach ($array as &$val) {
var_dump(current($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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/error-handling/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/error-handling/000.php | <?php
// PHP 5 era code that will break.
function handler(Exception $e)
{ /* ... */
}
set_exception_handler('handler');
// PHP 5 and 7 compatible.
function handler($e)
{ /* ... */
}
// PHP 7 only.
function handler(Throwable $e)
{ /* ... */
}
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/004.php | <?php
function foo($x)
{
$x++;
var_dump(func_get_arg(0));
}
foo(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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/001.php | <?php
class A
{
public function test()
{
var_dump($this);
}
}
// Note: Does NOT extend A
class B
{
public function callNonStaticMethodOfA()
{
A::test();
}
}
(new B)->callNonStaticMethodOfA();
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/002.php | <?php
echo yield -1;
// Was previously interpreted as
echo (yield) - 1;
// And is now interpreted as
echo yield (-1);
yield $foo or die;
// Was previously interpreted as
yield ($foo or die);
// And is now interpreted as
(yield $foo) or die;
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/003.php | <?php
function foo($a, $b, $unused, $unused)
{
//
}
?> | 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/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration70/incompatible/other/005.php | <?php
switch (1) {
default:
break;
default:
break;
}
?> | 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/01-default/3rdparty/php-doc/appendices/migration73/new-features/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration73/new-features/001.php | <?php
mb_ereg('(?<word>\w+)', '国', $matches);
// => [0 => "国", 1 => "国", "word" => "国"];
?> | 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/01-default/3rdparty/php-doc/appendices/migration73/new-features/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration73/new-features/002.php | <?php
mb_ereg_replace('\s*(?<word>\w+)\s*', "_\k<word>_\k'word'_", ' foo ');
// => "_foo_foo_"
?> | 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/01-default/3rdparty/php-doc/appendices/migration73/new-features/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration73/new-features/000.php | <?php
mb_strtoupper('Straße');
// Produces STRAßE on PHP 7.2
// Produces STRASSE on PHP 7.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/01-default/3rdparty/php-doc/appendices/migration73/incompatible/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration73/incompatible/004.php | <?php
function foo(...$args)
{
var_dump($args);
}
function gen()
{
yield 1.23 => 123;
}
foo(...gen());
?> | 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/01-default/3rdparty/php-doc/appendices/migration73/incompatible/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration73/incompatible/001.php | <?php
while ($foo) {
switch ($bar) {
case 'baz':
continue;
// Warning: "continue" targeting switch is equivalent to
// "break". Did you mean to use "continue 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/01-default/3rdparty/php-doc/appendices/migration73/incompatible/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration73/incompatible/002.php | <?php
class Test
{
public static $x = 0;
}
class Test2 extends Test {}
Test2::$x = &$x;
$x = 1;
var_dump(Test::$x, Test2::$x);
// Previously: int(0), int(1)
// Now: int(1), int(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/01-default/3rdparty/php-doc/appendices/migration73/incompatible/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration73/incompatible/003.php | <?php
$arr = [1];
$ref = &$arr[0];
var_dump($arr[0] + ($arr[0] = 2));
// Previously: int(4), Now: int(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/01-default/3rdparty/php-doc/appendices/userlandnaming/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/userlandnaming/000.php | <?php
namespace MyProject;
function my_function()
{
return true;
}
\MyProject\my_function();
| 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/01-default/3rdparty/php-doc/appendices/migration56/openssl/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/openssl/006.php | <?php
$pkey = openssl_pkey_new();
openssl_pkey_export($pkey, 'secret passphrase');
$spkac = openssl_spki_new($pkey, 'challenge string');
echo openssl_spki_export($spkac);
?> | 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/01-default/3rdparty/php-doc/appendices/migration56/openssl/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/openssl/004.php | <?php
$pkey = openssl_pkey_new();
openssl_pkey_export($pkey, 'secret passphrase');
$spkac = openssl_spki_new($pkey, 'challenge string');
var_dump(openssl_spki_verify($spkac));
?> | 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/01-default/3rdparty/php-doc/appendices/migration56/openssl/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/openssl/001.php | <?php
// Requiring TLS 1.0 or better when using file_get_contents():
$ctx = stream_context_create([
'ssl' => [
'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT,
],
]);
$html = file_get_contents('https://google.com/', false, $ctx);
// Requiring TLS 1.1 or 1.2:
$ctx = stream_context_create([
'ssl'... | 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/01-default/3rdparty/php-doc/appendices/migration56/openssl/002.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/openssl/002.php | <?php
var_dump(openssl_get_cert_locations());
?> | 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/01-default/3rdparty/php-doc/appendices/migration56/openssl/003.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/openssl/003.php | <?php
$pkey = openssl_pkey_new();
openssl_pkey_export($pkey, 'secret passphrase');
$spkac = openssl_spki_new($pkey, 'challenge string');
?> | 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/01-default/3rdparty/php-doc/appendices/migration56/openssl/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/openssl/000.php | <?php
$ctx = stream_context_create(['ssl' => [
'capture_session_meta' => TRUE
]]);
$html = file_get_contents('https://google.com/', FALSE, $ctx);
$meta = stream_context_get_options($ctx)['ssl']['session_meta'];
var_dump($meta);
?> | 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/01-default/3rdparty/php-doc/appendices/migration56/openssl/005.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/openssl/005.php | <?php
$pkey = openssl_pkey_new();
openssl_pkey_export($pkey, 'secret passphrase');
$spkac = openssl_spki_new($pkey, 'challenge string');
$challenge = openssl_spki_export_challenge($spkac);
echo $challenge;
?> | 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/01-default/3rdparty/php-doc/appendices/migration56/deprecated/000.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/deprecated/000.php | <?php
class A
{
function f()
{
echo get_class($this);
}
}
class B
{
function f()
{
A::f();
}
}
(new B)->f();
?> | 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/01-default/3rdparty/php-doc/appendices/migration56/new-features/006.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/new-features/006.php | <?php
$a = gmp_init(42);
$b = gmp_init(17);
if (version_compare(PHP_VERSION, '5.6', '<')) {
echo gmp_intval(gmp_add($a, $b)), PHP_EOL;
echo gmp_intval(gmp_add($a, 17)), PHP_EOL;
echo gmp_intval(gmp_add(42, $b)), PHP_EOL;
} else {
echo $a + $b, PHP_EOL;
echo $a + 17, PHP_EOL;
echo 42 + $b, PHP_E... | 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/01-default/3rdparty/php-doc/appendices/migration56/new-features/004.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/new-features/004.php | <?php
printf("2 ** 3 == %d\n", 2 ** 3);
printf("2 ** 3 ** 2 == %d\n", 2 ** 3 ** 2);
$a = 2;
$a **= 3;
printf("a == %d\n", $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/01-default/3rdparty/php-doc/appendices/migration56/new-features/001.php | tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/appendices/migration56/new-features/001.php | <?php
const ARR = ['a', 'b'];
echo ARR[0];
?> | 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.