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/04-psr12/3rdparty/php-doc/language/predefined/error/getfile/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/error/getfile/000.php | <?php
try {
throw new Error;
} catch (Error $e) {
echo $e->getFile();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/error/getline/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/error/getline/000.php | <?php
try {
throw new Error('Some error message');
} catch (Error $e) {
echo 'The error was created on line: ' . $e->getLine();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/error/gettraceasstring/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/error/gettraceasstring/000.php | <?php
function test()
{
throw new Error;
}
try {
test();
} catch (Error $e) {
echo $e->getTraceAsString();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/error/getcode/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/error/getcode/000.php | <?php
try {
throw new Error('Some error message', 30);
} catch (Error $e) {
echo 'The Error code is: ' . $e->getCode();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/error/getprevious/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/error/getprevious/000.php | <?php
class MyCustomError extends Error {}
function doStuff()
{
try {
throw new InvalidArgumentError('You are doing it wrong!', 112);
} catch (Error $e) {
throw new MyCustomError('Something happened', 911, $e);
}
}
try {
doStuff();
} catch (Error $e) {
do {
printf("%s:%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/04-psr12/3rdparty/php-doc/language/predefined/error/getmessage/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/error/getmessage/000.php | <?php
try {
throw new Error('Some error message');
} catch (Error $e) {
echo $e->getMessage();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/error/tostring/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/error/tostring/000.php | <?php
try {
throw new Error('Some error message');
} catch (Error $e) {
echo $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/04-psr12/3rdparty/php-doc/language/predefined/iterator/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/iterator/000.php | <?php
class myIterator implements Iterator
{
private $position = 0;
private $array = array(
'firstelement',
'secondelement',
'lastelement',
);
public function __construct()
{
$this->position = 0;
}
public function rewind(): void
{
var_dump(__ME... | 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/04-psr12/3rdparty/php-doc/language/predefined/backedenum/from/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/backedenum/from/000.php | <?php
enum Suit: string
{
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
$h = Suit::from('H');
var_dump($h);
$b = Suit::from('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/04-psr12/3rdparty/php-doc/language/predefined/backedenum/tryfrom/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/backedenum/tryfrom/000.php | <?php
enum Suit: string
{
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
$h = Suit::tryFrom('H');
var_dump($h);
$b = Suit::tryFrom('B') ?? Suit::Spades;
var_dump($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/04-psr12/3rdparty/php-doc/language/predefined/generator/throw/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/generator/throw/000.php | <?php
function gen()
{
echo "Foo\n";
try {
yield;
} catch (Exception $e) {
echo "Exception: {$e->getMessage()}\n";
}
echo "Bar\n";
}
$gen = gen();
$gen->rewind();
$gen->throw(new Exception('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/04-psr12/3rdparty/php-doc/language/predefined/generator/key/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/generator/key/000.php | <?php
function Gen()
{
yield 'key' => 'value';
}
$gen = Gen();
echo "{$gen->key()} => {$gen->current()}";
| 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/04-psr12/3rdparty/php-doc/language/predefined/generator/rewind/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/generator/rewind/000.php | <?php
function generator(): Generator
{
echo "I'm a generator!\n";
for ($i = 1; $i <= 3; $i++) {
yield $i;
}
}
// Initialize the generator
$generator = generator();
// Rewind the generator to the beginning of the first yield expression,
// if it's not already there
$generator->rewind(); // I'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/04-psr12/3rdparty/php-doc/language/predefined/generator/getreturn/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/generator/getreturn/000.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/04-psr12/3rdparty/php-doc/language/predefined/generator/send/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/generator/send/000.php | <?php
function printer()
{
echo "I'm printer!" . PHP_EOL;
while (true) {
$string = yield;
echo $string . PHP_EOL;
}
}
$printer = printer();
$printer->send('Hello world!');
$printer->send('Bye world!');
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/variables/phperrormsg/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/phperrormsg/000.php | <?php
@strpos();
echo $php_errormsg;
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/variables/env/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/env/000.php | <?php
echo 'My username is ' . $_ENV['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/04-psr12/3rdparty/php-doc/language/predefined/variables/cookie/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/cookie/000.php | <?php
echo 'Hello ' . htmlspecialchars($_COOKIE['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/04-psr12/3rdparty/php-doc/language/predefined/variables/globals/001.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/globals/001.php | <?php
// Generates compile-time error:
$GLOBALS = [];
$GLOBALS += [];
$GLOBALS = &$x;
$x = &$GLOBALS;
unset($GLOBALS);
array_pop($GLOBALS);
// ...and any other write/read-write operation on $GLOBALS
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/variables/globals/002.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/globals/002.php | <?php
// Before PHP 8.1.0
$a = 1;
$globals = $GLOBALS; // Ostensibly by-value copy
$globals['a'] = 2;
var_dump($a); // int(2)
// As of PHP 8.1.0
// this no longer modifies $a. The previous behavior violated by-value semantics.
$globals = $GLOBALS;
$globals['a'] = 1;
// To restore the previous behavior, iterate it... | 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/04-psr12/3rdparty/php-doc/language/predefined/variables/globals/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/globals/000.php | <?php
function test()
{
$foo = 'local variable';
echo '$foo in global scope: ' . $GLOBALS['foo'] . "\n";
echo '$foo in current scope: ' . $foo . "\n";
}
$foo = 'Example content';
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/04-psr12/3rdparty/php-doc/language/predefined/variables/httpresponseheader/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/httpresponseheader/000.php | <?php
function get_contents()
{
file_get_contents('http://example.com');
var_dump($http_response_header); // variable is populated in the local scope
}
get_contents();
var_dump($http_response_header); // a call to get_contents() does not populate the variable outside the function scope
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/variables/get/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/get/000.php | <?php
echo 'Hello ' . htmlspecialchars($_GET['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/04-psr12/3rdparty/php-doc/language/predefined/variables/argc/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/argc/000.php | <?php
var_dump($argc);
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/variables/server/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/server/000.php | <?php
echo $_SERVER['SERVER_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/04-psr12/3rdparty/php-doc/language/predefined/variables/argv/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/argv/000.php | <?php
var_dump($argv);
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/variables/post/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/variables/post/000.php | <?php
echo 'Hello ' . htmlspecialchars($_POST['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/04-psr12/3rdparty/php-doc/language/predefined/exception/gettrace/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/gettrace/000.php | <?php
function test()
{
throw new Exception;
}
try {
test();
} catch (Exception $e) {
var_dump($e->getTrace());
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/exception/getfile/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/getfile/000.php | <?php
try {
throw new Exception;
} catch (Exception $e) {
echo $e->getFile();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/exception/getline/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/getline/000.php | <?php
try {
throw new Exception('Some error message');
} catch (Exception $e) {
echo 'The exception was created on line: ' . $e->getLine();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/exception/gettraceasstring/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/gettraceasstring/000.php | <?php
function test()
{
throw new Exception;
}
try {
test();
} catch (Exception $e) {
echo $e->getTraceAsString();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/exception/getcode/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/getcode/000.php | <?php
try {
throw new Exception('Some error message', 30);
} catch (Exception $e) {
echo 'The exception code is: ' . $e->getCode();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/exception/getprevious/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/getprevious/000.php | <?php
class MyCustomException extends Exception {}
function doStuff()
{
try {
throw new InvalidArgumentException('You are doing it wrong!', 112);
} catch (Exception $e) {
throw new MyCustomException('Something happened', 911, $e);
}
}
try {
doStuff();
} catch (Exception $e) {
do {... | 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/04-psr12/3rdparty/php-doc/language/predefined/exception/getmessage/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/getmessage/000.php | <?php
try {
throw new Exception('Some error message');
} catch (Exception $e) {
echo $e->getMessage();
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/exception/tostring/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/exception/tostring/000.php | <?php
try {
throw new Exception('Some error message');
} catch (Exception $e) {
echo $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/04-psr12/3rdparty/php-doc/language/predefined/errorexception/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/errorexception/000.php | <?php
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) {
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting.
return;
}
if ($errno === E_DEPRECATED || $errno === E_USER_DEPRECATED) {
// Do not throw an Exc... | 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/04-psr12/3rdparty/php-doc/language/predefined/errorexception/getseverity/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/errorexception/getseverity/000.php | <?php
try {
throw new ErrorException('Exception message', 0, E_USER_ERROR);
} catch (ErrorException $e) {
echo 'This exception severity is: ' . $e->getSeverity();
var_dump($e->getSeverity() === E_USER_ERROR);
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/arrayaccess/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/arrayaccess/000.php | <?php
class Obj implements ArrayAccess
{
public $container = [
'one' => 1,
'two' => 2,
'three' => 3,
];
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$off... | 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/04-psr12/3rdparty/php-doc/language/predefined/arrayaccess/offsetexists/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/arrayaccess/offsetexists/000.php | <?php
class obj implements ArrayAccess
{
public function offsetSet($offset, $value): void
{
var_dump(__METHOD__);
}
public function offsetExists($var): bool
{
var_dump(__METHOD__);
if ($var == 'foobar') {
return true;
}
return false;
}
p... | 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/04-psr12/3rdparty/php-doc/language/predefined/arrayaccess/offsetset/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/arrayaccess/offsetset/000.php | <?php
$arrayaccess[] = 'first value';
$arrayaccess[] = 'second value';
print_r($arrayaccess);
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/php-incomplete-class/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/php-incomplete-class/000.php | <?php
class MyClass
{
public string $property = 'myValue';
}
$myObject = new MyClass;
$foo = serialize($myObject);
// unserializes all objects into __PHP_Incomplete_Class objects
$disallowed = unserialize($foo, ['allowed_classes' => false]);
var_dump($disallowed);
// unserializes all objects into __PHP_Incomp... | 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/04-psr12/3rdparty/php-doc/language/predefined/countable/count/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/countable/count/000.php | <?php
class Counter implements Countable
{
private $count = 0;
public function count(): int
{
return ++$this->count;
}
}
$counter = new Counter;
for ($i = 0; $i < 10; ++$i) {
echo 'I have been count()ed ' . count($counter) . " times\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/04-psr12/3rdparty/php-doc/language/predefined/attributes/deprecated/000.PHP74.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/attributes/deprecated/000.PHP74.php | <?php
#[\Deprecated(message: "use safe_replacement() instead", since: "1.5")]
function unsafe_function()
{
echo 'This is unsafe', PHP_EOL;
}
unsafe_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/04-psr12/3rdparty/php-doc/language/predefined/attributes/deprecated/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/attributes/deprecated/000.php | <?php
#[\Deprecated(message: 'use safe_replacement() instead', since: '1.5')]
function unsafe_function()
{
echo 'This is unsafe', PHP_EOL;
}
unsafe_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/04-psr12/3rdparty/php-doc/language/predefined/attributes/sensitiveparameter/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/attributes/sensitiveparameter/000.php | <?php
function defaultBehavior(
string $secret,
string $normal
) {
throw new Exception('Error!');
}
function sensitiveParametersWithAttribute(
#[\SensitiveParameter]
string $secret,
string $normal
) {
throw new Exception('Error!');
}
try {
defaultBehavior('password', 'normal');
} 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/04-psr12/3rdparty/php-doc/language/predefined/attributes/allowdynamicproperties/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/attributes/allowdynamicproperties/000.php | <?php
class DefaultBehaviour {}
#[\AllowDynamicProperties]
class ClassAllowsDynamicProperties {}
$o1 = new DefaultBehaviour();
$o2 = new ClassAllowsDynamicProperties();
$o1->nonExistingProp = true;
$o2->nonExistingProp = 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/04-psr12/3rdparty/php-doc/language/predefined/attributes/override/001.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/attributes/override/001.php | <?php
class Base
{
protected string $foo;
}
final class Extended extends Base
{
#[\Override]
protected string $boo;
}
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/attributes/override/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/attributes/override/000.php | <?php
class Base
{
protected function foo(): void {}
}
final class Extended extends Base
{
#[\Override]
protected function boo(): 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/04-psr12/3rdparty/php-doc/language/predefined/stdclass/001.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/stdclass/001.php | <?php
$json = '{"foo":"bar"}';
var_dump(json_decode($json));
| 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/04-psr12/3rdparty/php-doc/language/predefined/stdclass/002.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/stdclass/002.php | <?php
$obj = new stdClass();
$obj->foo = 42;
$obj->{1} = 42;
var_dump($obj);
| 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/04-psr12/3rdparty/php-doc/language/predefined/stdclass/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/stdclass/000.php | <?php
$obj = (object) array('foo' => 'bar');
var_dump($obj);
| 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/04-psr12/3rdparty/php-doc/language/predefined/weakreference/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/weakreference/000.php | <?php
$obj = new stdClass();
$weakref = WeakReference::create($obj);
var_dump($weakref->get());
unset($obj);
var_dump($weakref->get());
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/unitenum/cases/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/unitenum/cases/000.php | <?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
var_dump(Suit::cases());
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/closure/call/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/closure/call/000.php | <?php
class Value
{
protected $value;
public function __construct($value)
{
$this->value = $value;
}
public function getValue()
{
return $this->value;
}
}
$three = new Value(3);
$four = new Value(4);
$closure = function ($delta) {
var_dump($this->getValue() + $delta)... | 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/04-psr12/3rdparty/php-doc/language/predefined/closure/bind/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/closure/bind/000.php | <?php
class A
{
private static $sfoo = 1;
private $ifoo = 2;
}
$cl1 = static function () {
return A::$sfoo;
};
$cl2 = function () {
return $this->ifoo;
};
$bcl1 = Closure::bind($cl1, null, 'A');
$bcl2 = Closure::bind($cl2, new A(), 'A');
echo $bcl1(), "\n";
echo $bcl2(), "\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/04-psr12/3rdparty/php-doc/language/predefined/closure/bindto/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/closure/bindto/000.php | <?php
class A
{
private $val;
public function __construct($val)
{
$this->val = $val;
}
public function getClosure()
{
// Returns closure bound to this object and scope
return function () {
return $this->val;
};
}
}
$ob1 = new A(1);
$ob2 = 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/04-psr12/3rdparty/php-doc/language/predefined/sensitiveparametervalue/getvalue/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/sensitiveparametervalue/getvalue/000.php | <?php
$s = new \SensitiveParameterValue('secret');
echo 'The protected value is: ', $s->getValue(), "\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/04-psr12/3rdparty/php-doc/language/predefined/sensitiveparametervalue/debuginfo/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/sensitiveparametervalue/debuginfo/000.php | <?php
$s = new \SensitiveParameterValue('secret');
var_dump($s);
?> | 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/04-psr12/3rdparty/php-doc/language/predefined/weakmap/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/weakmap/000.php | <?php
$wm = new WeakMap();
$o = new stdClass;
class A
{
public function __destruct()
{
echo "Dead!\n";
}
}
$wm[$o] = new A;
var_dump(count($wm));
echo "Unsetting...\n";
unset($o);
echo "Done\n";
var_dump(count($wm));
| 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/04-psr12/3rdparty/php-doc/language/predefined/serializable/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/predefined/serializable/000.php | <?php
class obj implements Serializable
{
private $data;
public function __construct()
{
$this->data = 'My private data';
}
public function serialize()
{
return serialize($this->data);
}
public function unserialize($data)
{
$this->data = unserialize($data)... | 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/04-psr12/3rdparty/php-doc/language/expressions/001.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/expressions/001.php | <?php
$first ? $second : $third
?> | 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/04-psr12/3rdparty/php-doc/language/expressions/002.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/expressions/002.php | <?php
function double($i)
{
return $i * 2;
}
$b = $a = 5; /* assign the value five into the variable $a and $b */
$c = $a++; /* post-increment, assign original value of $a
(5) to $c */
$e = $d = ++$b; /* pre-increment, assign the incremented value of
$b (6) to $d and $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/04-psr12/3rdparty/php-doc/language/expressions/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/expressions/000.php | <?php
function foo()
{
return 5;
}
?> | 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/04-psr12/3rdparty/php-doc/language/functions/028.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/028.php | <?php
class Foo
{
function Variable()
{
$name = 'Bar';
$this->$name(); // This calls the Bar() method
}
function Bar()
{
echo 'This is Bar';
}
}
$foo = new Foo();
$funcname = 'Variable';
$foo->$funcname(); // This calls $foo->Variable()
?> | 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/04-psr12/3rdparty/php-doc/language/functions/031.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/031.php | <?php
var_dump(strlen(null));
// "Deprecated: Passing null to parameter #1 ($string) of type string is deprecated" as of PHP 8.1.0
// int(0)
var_dump(str_contains('foobar', null));
// "Deprecated: Passing null to parameter #2 ($needle) of type string is deprecated" as of PHP 8.1.0
// bool(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/04-psr12/3rdparty/php-doc/language/functions/006.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/006.php | <?php
function takes_many_args(
$first_arg,
$second_arg,
$a_very_long_argument_name,
$arg_with_default = 5,
$again = 'a default string', // This trailing comma was not permitted before 8.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/04-psr12/3rdparty/php-doc/language/functions/017.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/017.php | <?php
function total_intervals($unit, DateInterval ...$intervals)
{
$time = 0;
foreach ($intervals as $interval) {
$time += $interval->$unit;
}
return $time;
}
$a = new DateInterval('P1D');
$b = new DateInterval('P2D');
echo total_intervals('d', $a, $b) . ' days';
// This will fail, since nul... | 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/04-psr12/3rdparty/php-doc/language/functions/013.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/013.php | <?php
function makeyogurt($container = 'bowl', $flavour = 'raspberry', $style = 'Greek')
{
return "Making a $container of $flavour $style yogurt.\n";
}
echo makeyogurt(style: 'natural');
?> | 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/04-psr12/3rdparty/php-doc/language/functions/036.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/036.php | <?php
class Test
{
public function testing()
{
return function () {
var_dump($this);
};
}
}
$object = new Test;
$function = $object->testing();
$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/04-psr12/3rdparty/php-doc/language/functions/004.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/004.php | <?php
function recursion($a)
{
if ($a < 20) {
echo "$a\n";
recursion($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/04-psr12/3rdparty/php-doc/language/functions/045.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/045.php | <?php
$obj?->method(...);
$obj?->prop->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/04-psr12/3rdparty/php-doc/language/functions/016.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/016.php | <?php
function add($a, $b)
{
return $a + $b;
}
echo add(...[1, 2]) . "\n";
$a = [1, 2];
echo add(...$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/04-psr12/3rdparty/php-doc/language/functions/001.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/001.php | <?php
function foo(
$arg_1,
$arg_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/04-psr12/3rdparty/php-doc/language/functions/002.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/002.php | <?php
$makefoo = true;
/* We can't call foo() from here
since it doesn't exist yet,
but we can call bar() */
bar();
if ($makefoo) {
function foo()
{
echo "I don't exist until program execution reaches me.\n";
}
}
/* Now we can safely call foo()
since $makefoo evaluated to true */
if (... | 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/04-psr12/3rdparty/php-doc/language/functions/025.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/025.php | <?php
function small_numbers()
{
return [0, 1, 2];
}
// Array destructuring will collect each member of the array individually
[$zero, $one, $two] = small_numbers();
// Prior to 7.1.0, the only equivalent alternative is using list() construct
list($zero, $one, $two) = small_numbers();
?> | 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/04-psr12/3rdparty/php-doc/language/functions/024.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/024.php | <?php
function square($num)
{
return $num * $num;
}
echo square(4); // outputs '16'.
?> | 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/04-psr12/3rdparty/php-doc/language/functions/032.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/032.php | <?php
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?> | 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/04-psr12/3rdparty/php-doc/language/functions/011.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/011.php | <?php
function makeyogurt($container = 'bowl', $flavour)
{
return "Making a $container of $flavour yogurt.\n";
}
echo makeyogurt('raspberry'); // "raspberry" is $container, not $flavour
?> | 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/04-psr12/3rdparty/php-doc/language/functions/009.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/009.php | <?php
function makecoffee($types = array('cappuccino'), $coffeeMaker = NULL)
{
$device = is_null($coffeeMaker) ? 'hands' : $coffeeMaker;
return 'Making a cup of ' . join(', ', $types) . " with $device.\n";
}
echo makecoffee();
echo makecoffee(array('cappuccino', 'lavazza'), 'teapot');
?> | 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/04-psr12/3rdparty/php-doc/language/functions/040.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/040.php | <?php
$z = 1;
$fn = fn($x) => fn($y) => $x * $y + $z;
// Outputs 51
var_export($fn(5)(10));
?> | 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/04-psr12/3rdparty/php-doc/language/functions/020.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/020.php | <?php
array_fill(value: 50, count: 100, start_index: 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/04-psr12/3rdparty/php-doc/language/functions/043.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/043.php | <?php
class Foo
{
public function method() {}
public static function staticmethod() {}
public function __invoke() {}
}
$obj = new Foo();
$classStr = 'Foo';
$methodStr = 'method';
$staticmethodStr = 'staticmethod';
$f1 = strlen(...);
$f2 = $obj(...); // invokable object
$f3 = $obj->method(...);
$f4 = $ob... | 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/04-psr12/3rdparty/php-doc/language/functions/029.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/029.php | <?php
class Foo
{
static $variable = 'static property';
static function Variable()
{
echo 'Method Variable called';
}
}
echo Foo::$variable; // This prints 'static property'. It does need a $variable in this scope.
$variable = 'Variable';
Foo::$variable(); // This calls $foo->Variable() rea... | 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/04-psr12/3rdparty/php-doc/language/functions/012.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/012.php | <?php
function makeyogurt($flavour, $container = 'bowl')
{
return "Making a $container of $flavour yogurt.\n";
}
echo makeyogurt('raspberry'); // "raspberry" is $flavour
?> | 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/04-psr12/3rdparty/php-doc/language/functions/019.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/019.php | <?php
// Using positional arguments:
array_fill(0, 100, 50);
// Using named arguments:
array_fill(start_index: 0, count: 100, value: 50);
?> | 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/04-psr12/3rdparty/php-doc/language/functions/014.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/014.php | <?php
function foo($a = [], $b) {} // Default not used; deprecated as of PHP 8.0.0
function foo($a, $b) {} // Functionally equivalent, no deprecation notice
function bar(A $a = null, $b) {} // As of PHP 8.1.0, $a is implicitly required
// (because it comes before the required one),
// but implicitly nullable (depre... | 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/04-psr12/3rdparty/php-doc/language/functions/041.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/041.php | <?php
fn(array $x) => $x;
static fn($x): int => $x;
fn($x = 42) => $x;
fn(&$x) => $x;
fn&($x) => $x;
fn($x, ...$rest) => $rest;
?> | 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/04-psr12/3rdparty/php-doc/language/functions/044.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/044.php | <?php
class Foo
{
public function getPrivateMethod()
{
return [$this, 'privateMethod'];
}
private function privateMethod()
{
echo __METHOD__, "\n";
}
}
$foo = new Foo;
$privateMethod = $foo->getPrivateMethod();
$privateMethod();
// Fatal error: Call to private method Foo::priv... | 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/04-psr12/3rdparty/php-doc/language/functions/037.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/037.php | <?php
class Foo
{
function __construct()
{
$func = static function () {
var_dump($this);
};
$func();
}
};
new 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/04-psr12/3rdparty/php-doc/language/functions/015.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/015.php | <?php
function sum(...$numbers)
{
$acc = 0;
foreach ($numbers as $n) {
$acc += $n;
}
return $acc;
}
echo sum(1, 2, 3, 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/04-psr12/3rdparty/php-doc/language/functions/007.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/007.php | <?php
function add_some_extra(&$string)
{
$string .= 'and something extra.';
}
$str = 'This is a string, ';
add_some_extra($str);
echo $str; // outputs 'This is a string, and something extra.'
?> | 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/04-psr12/3rdparty/php-doc/language/functions/010.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/010.php | <?php
class DefaultCoffeeMaker
{
public function brew()
{
return "Making coffee.\n";
}
}
class FancyCoffeeMaker
{
public function brew()
{
return "Crafting a beautiful coffee just for you.\n";
}
}
function makecoffee($coffeeMaker = new DefaultCoffeeMaker)
{
return $coffeeM... | 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/04-psr12/3rdparty/php-doc/language/functions/003.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/003.php | <?php
function foo()
{
function bar()
{
echo "I don't exist until foo() is called.\n";
}
}
/* We can't call bar() yet
since it doesn't exist. */
foo();
/* Now we can call bar(),
foo()'s processing has
made it accessible. */
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/04-psr12/3rdparty/php-doc/language/functions/023.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/023.php | <?php
function foo($a, $b, $c = 3, $d = 4)
{
return $a + $b + $c + $d;
}
var_dump(foo(...[1, 2], d: 40)); // 46
var_dump(foo(...['b' => 2, 'a' => 1], d: 40)); // 46
var_dump(foo(...[1, 2], b: 20)); // Fatal error. Named parameter $b overwrites previous argument
?> | 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/04-psr12/3rdparty/php-doc/language/functions/026.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/026.php | <?php
function &returns_reference()
{
return $someref;
}
$newref = &returns_reference();
?> | 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/04-psr12/3rdparty/php-doc/language/functions/008.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/008.php | <?php
function makecoffee($type = 'cappuccino')
{
return "Making a cup of $type.\n";
}
echo makecoffee();
echo makecoffee(null);
echo makecoffee('espresso');
?> | 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/04-psr12/3rdparty/php-doc/language/functions/000.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/000.php | <?php
function foo($arg_1, $arg_2, /* ..., */ $arg_n)
{
echo "Example function.\n";
return $retval;
}
?> | 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/04-psr12/3rdparty/php-doc/language/functions/005.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/005.php | <?php
$v = foo(
$arg_1,
$arg_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/04-psr12/3rdparty/php-doc/language/functions/030.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/030.php | <?php
class Foo
{
static function bar()
{
echo "bar\n";
}
function baz()
{
echo "baz\n";
}
}
$func = array('Foo', 'bar');
$func(); // prints "bar"
$func = array(new Foo, 'baz');
$func(); // prints "baz"
$func = 'Foo::bar';
$func(); // prints "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/04-psr12/3rdparty/php-doc/language/functions/027.php | tests/fixtures/Formatter/out/04-psr12/3rdparty/php-doc/language/functions/027.php | <?php
function foo()
{
echo "In foo()<br />\n";
}
function bar($arg = '')
{
echo "In bar(); argument was '$arg'.<br />\n";
}
// This is a wrapper function around echo
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls bar... | 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.