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/language/oop5/properties/006.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/006.php
<?php class Test { public function __construct( public readonly int $i = 0, public readonly array $ary = [], ) {} } $test = new Test; $test->i += 1; $test->i++; ++$test->i; $test->ary[] = 1; $test->ary[0][] = 1; unset($test->ary[0]); $ref = &$test->i; $test->i = &$ref; byRef($test->i); foreach...
php
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/language/oop5/properties/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/004.php
<?php class Test1 { public readonly string $prop; } $test1 = new Test1; // Illegal initialization outside of private scope. $test1->prop = 'foobar'; // Error: Cannot initialize readonly property Test1::$prop from global 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/01-default/3rdparty/php-doc/language/oop5/properties/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/001.php
<?php class User { public int $id; public ?string $name; public function __construct(int $id, ?string $name) { $this->id = $id; $this->name = $name; } } $user = new User(1234, null); var_dump($user->id); var_dump($user->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/language/oop5/properties/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/002.php
<?php class Shape { public int $numberOfSides; public string $name; public function setNumberOfSides(int $numberOfSides): void { $this->numberOfSides = $numberOfSides; } public function setName(string $name): void { $this->name = $name; } public function getNumber...
php
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/language/oop5/properties/007.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/007.php
<?php class Test { public function __construct( public readonly object $obj ) {} } $test = new Test(new stdClass); // Legal interior mutation. $test->obj->foo = 1; // Illegal reassignment. $test->obj = new stdClass; ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/003.php
<?php class Test { public readonly string $prop; public function __construct(string $prop) { // Legal initialization. $this->prop = $prop; } } $test = new Test('foobar'); // Legal read. var_dump($test->prop); // string(6) "foobar" // Illegal reassignment. It does not matter that the...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/008.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/008.php
<?php class Test1 { public readonly ?string $prop; public function __clone() { $this->prop = null; } public function setProp(string $prop): void { $this->prop = $prop; } } $test1 = new Test1; $test1->setProp('foobar'); $test2 = clone $test1; var_dump($test2->prop); // NU...
php
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/language/oop5/properties/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/000.php
<?php class SimpleClass { public $var1 = 'hello ' . 'world'; public $var2 = <<<EOD hello world EOD; public $var3 = 1 + 2; // invalid property declarations: public $var4 = self::myStaticMethod(); public $var5 = $myVar; // valid property declarations: public $var6 = myCon...
php
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/language/oop5/properties/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/properties/005.php
<?php class Test { // Fatal error: Readonly property Test::$prop cannot have default value public readonly int $prop = 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/language/oop5/anonymous/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/anonymous/004.php
<?php echo get_class(new 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/language/oop5/anonymous/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/anonymous/001.php
<?php class SomeClass {} interface SomeInterface {} trait SomeTrait {} var_dump(new class(10) extends SomeClass implements SomeInterface { private $num; public function __construct($num) { $this->num = $num; } use SomeTrait; });
php
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/language/oop5/anonymous/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/anonymous/002.php
<?php class Outer { private $prop = 1; protected $prop2 = 2; protected function func1() { return 3; } public function func2() { return new class($this->prop) extends Outer { private $prop3; public function __construct($prop) { ...
php
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/language/oop5/anonymous/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/anonymous/003.php
<?php function anonymous_class() { return new class {}; } if (get_class(anonymous_class()) === get_class(anonymous_class())) { echo 'same class'; } else { echo 'different 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/language/oop5/anonymous/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/anonymous/000.php
<?php // Using an explicit class class Logger { public function log($msg) { echo $msg; } } $util->setLogger(new Logger()); // Using an anonymous class $util->setLogger(new class { public function log($msg) { echo $msg; } });
php
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/language/oop5/anonymous/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/anonymous/005.php
<?php // Using an anonymous class var_dump(new readonly class('[DEBUG]') { public function __construct( private string $prefix ) {} public function log($msg) { echo $this->prefix . ' ' . $msg; } });
php
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/language/oop5/decon/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/decon/004.php
<?php $some_json_string = '{ "id": 1004, "name": "Elephpant" }'; $some_xml_string = '<animal><id>1005</id><name>Elephpant</name></animal>'; class Product { private ?int $id; private ?string $name; private function __construct(?int $id = null, ?string $name = null) { $this->id = $id; $t...
php
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/language/oop5/decon/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/decon/001.php
<?php class Point { protected int $x; protected int $y; public function __construct(int $x, int $y = 0) { $this->x = $x; $this->y = $y; } } // Pass both parameters. $p1 = new Point(4, 5); // Pass only the required parameter. $y will take its default value of 0. $p2 = new Point(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/01-default/3rdparty/php-doc/language/oop5/decon/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/decon/002.php
<?php class Point { public function __construct( protected int $x, protected int $y = 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/language/oop5/decon/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/decon/003.php
<?php // All allowed: static $x = new Foo; const C = new Foo; function test($param = new Foo) {} #[AnAttribute(new Foo)] class Test { public function __construct( public $prop = new Foo, ) {} } // All not allowed (compile-time error): function test( $a = new (CLASS_NAME_CONSTANT)(), // dynamic...
php
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/language/oop5/decon/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/decon/000.php
<?php class BaseClass { function __construct() { print "In BaseClass constructor\n"; } } class SubClass extends BaseClass { function __construct() { parent::__construct(); print "In SubClass constructor\n"; } } class OtherSubClass extends BaseClass { // inherits Bas...
php
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/language/oop5/decon/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/decon/005.php
<?php class MyDestructableClass { function __construct() { print "In constructor\n"; } function __destruct() { print 'Destroying ' . __CLASS__ . "\n"; } } $obj = new MyDestructableClass();
php
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/language/oop5/visibility/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/visibility/004.php
<?php /** * Define MyClass */ class MyClass { // Declare a public constant public const MY_PUBLIC = 'public'; // Declare a protected constant protected const MY_PROTECTED = 'protected'; // Declare a private constant private const MY_PRIVATE = 'private'; public function 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/language/oop5/visibility/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/visibility/001.php
<?php class Book { public function __construct( public private(set) string $title, public protected(set) string $author, protected private(set) int $pubYear, ) {} } class SpecialBook extends Book { public function update(string $author, int $year): void { $this->author =...
php
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/language/oop5/visibility/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/visibility/002.php
<?php class Book { protected string $title; public protected(set) string $author; protected private(set) int $pubYear; } class SpecialBook extends Book { public protected(set) string $title; // OK, as reading is wider and writing the same. public string $author; // OK, as reading is the same and ...
php
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/language/oop5/visibility/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/visibility/003.php
<?php /** * Define MyClass */ class MyClass { // Declare a public constructor public function __construct() {} // Declare a public method public function MyPublic() {} // Declare a protected method protected function MyProtected() {} // Declare a private method private function MyP...
php
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/language/oop5/visibility/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/visibility/000.php
<?php /** * Define MyClass */ class MyClass { public $public = 'Public'; protected $protected = 'Protected'; private $private = 'Private'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } $obj = new MyClass(); echo $obj->pub...
php
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/language/oop5/visibility/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/visibility/005.php
<?php class Test { private $foo; public function __construct($foo) { $this->foo = $foo; } private function bar() { echo 'Accessed the private method.'; } public function baz(Test $other) { // We can change the private property: $other->foo = 'hello'...
php
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/language/oop5/cloning/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/cloning/001.php
<?php $dateTime = new DateTime(); echo (clone $dateTime)->format('Y'); ?>
php
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/language/oop5/cloning/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/cloning/000.php
<?php class SubObject { static $instances = 0; public $instance; public function __construct() { $this->instance = ++self::$instances; } public function __clone() { $this->instance = ++self::$instances; } } class MyCloneable { public $object1; public $object2; ...
php
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/language/oop5/iterations/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/iterations/000.php
<?php class MyClass { public $var1 = 'value 1'; public $var2 = 'value 2'; public $var3 = 'value 3'; protected $protected = 'protected var'; private $private = 'private var'; function iterateVisible() { echo "MyClass::iterateVisible:\n"; foreach ($this as $key => $value) { ...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/006.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/006.php
<?php class C { private $prop; public function __construct($val) { $this->prop = $val; } public function __debugInfo() { return [ 'propSquared' => $this->prop ** 2, ]; } } var_dump(new C(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/language/oop5/magic/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/004.php
<?php class Sort { private $key; public function __construct(string $key) { $this->key = $key; } public function __invoke(array $a, array $b): int { return $a[$this->key] <=> $b[$this->key]; } } $customers = [ ['id' => 1, 'first_name' => 'John', 'last_name' => '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/01-default/3rdparty/php-doc/language/oop5/magic/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/001.php
<?php class Connection { protected $link; private $dsn, $username, $password; public function __construct($dsn, $username, $password) { $this->dsn = $dsn; $this->username = $username; $this->password = $password; $this->connect(); } private func...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/002.php
<?php // Declare a simple class class TestClass { public $foo; public function __construct($foo) { $this->foo = $foo; } public function __toString() { return $this->foo; } } $class = new TestClass('Hello'); echo $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/language/oop5/magic/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/003.php
<?php class CallableClass { public function __invoke($x) { var_dump($x); } } $obj = new CallableClass; $obj(5); var_dump(is_callable($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/01-default/3rdparty/php-doc/language/oop5/magic/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/000.php
<?php class Connection { protected $link; private $dsn, $username, $password; public function __construct($dsn, $username, $password) { $this->dsn = $dsn; $this->username = $username; $this->password = $password; $this->connect(); } private func...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/magic/005.php
<?php class A { public $var1; public $var2; public static function __set_state($an_array) { $obj = new A; $obj->var1 = $an_array['var1']; $obj->var2 = $an_array['var2']; return $obj; } } $a = new A; $a->var1 = 5; $a->var2 = 'foo'; $b = var_export($a, true); var_du...
php
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/language/oop5/inheritance/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/inheritance/004.php
<?php class MyDateTime extends DateTime { /** * @return DateTime|false */ #[\ReturnTypeWillChange] public function modify(string $modifier) { return false; } } // No notice is triggered ?>
php
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/language/oop5/inheritance/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/inheritance/001.php
<?php class Foo { public function printItem($string) { echo 'Foo: ' . $string . PHP_EOL; } public function printPHP() { echo 'PHP is great.' . PHP_EOL; } } class Bar extends Foo { public function printItem($string) { echo 'Bar: ' . $string . 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/language/oop5/inheritance/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/inheritance/002.php
<?php class MyDateTime extends DateTime { public function modify(string $modifier) { return false; } } // "Deprecated: Return type of MyDateTime::modify(string $modifier) should either be compatible with DateTime::modify(string $modifier): DateTime|false, or the #[\ReturnTypeWillChange] attribute 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/01-default/3rdparty/php-doc/language/oop5/inheritance/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/inheritance/003.php
<?php class MyDateTime extends DateTime { public function modify(string $modifier): ?DateTime { return null; } } // "Deprecated: Return type of MyDateTime::modify(string $modifier): ?DateTime should either be compatible with DateTime::modify(string $modifier): DateTime|false, or the #[\ReturnTypeWi...
php
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/language/oop5/inheritance/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/inheritance/000.php
<?php class A { public int $prop; } class B extends A { // Illegal: read-write -> readonly public readonly int $prop; } ?>
php
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/language/oop5/autoload/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/autoload/001.php
<?php spl_autoload_register(function ($name) { var_dump($name); }); class Foo implements ITest {} /* * string(5) "ITest" * * Fatal error: Interface 'ITest' not found in ... */ ?>
php
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/language/oop5/autoload/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/autoload/002.php
<?php require __DIR__ . '/vendor/autoload.php'; $uuid = Ramsey\Uuid\Uuid::uuid7(); echo 'Generated new UUID -> ', $uuid->toString(), "\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/01-default/3rdparty/php-doc/language/oop5/autoload/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/autoload/000.php
<?php spl_autoload_register(function ($class_name) { include $class_name . '.php'; }); $obj = new MyClass1(); $obj2 = new MyClass2(); ?>
php
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/language/oop5/variance/006.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/variance/006.php
<?php class Animal {} class Dog extends Animal {} class Poodle extends Dog {} interface PetOwner { // Only a get operation is required, so this may be covariant. public Animal $pet { get; } } class DogOwner implements PetOwner { // This may be a more restrictive type since the "get" side // still retu...
php
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/language/oop5/variance/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/variance/004.php
<?php $kitty = (new CatShelter)->adopt('Ricky'); $catFood = new AnimalFood(); $kitty->eat($catFood); echo "\n"; $doggy = (new DogShelter)->adopt('Mavrick'); $banana = new Food(); $doggy->eat($banana);
php
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/language/oop5/variance/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/variance/001.php
<?php interface AnimalShelter { public function adopt(string $name): Animal; } class CatShelter implements AnimalShelter { public function adopt(string $name): Cat // instead of returning class type Animal, it can return class type Cat { return new Cat($name); } } class DogShelter implements...
php
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/language/oop5/variance/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/variance/002.php
<?php class Food {} class AnimalFood extends Food {} abstract class Animal { protected string $name; public function __construct(string $name) { $this->name = $name; } public function eat(AnimalFood $food) { echo $this->name . ' eats ' . get_class($food); } }
php
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/language/oop5/variance/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/variance/003.php
<?php class Dog extends Animal { public function eat(Food $food) { echo $this->name . ' eats ' . get_class($food); } }
php
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/language/oop5/variance/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/variance/000.php
<?php abstract class Animal { protected string $name; public function __construct(string $name) { $this->name = $name; } abstract public function speak(); } class Dog extends Animal { public function speak() { echo $this->name . ' barks'; } } class Cat extends Animal...
php
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/language/oop5/variance/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/variance/005.php
$kitty->eat($banana);
php
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/language/oop5/overloading/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/overloading/001.php
<?php class MethodTest { public function __call($name, $arguments) { // Note: value of $name is case sensitive. echo "Calling object method '$name' " . implode(', ', $arguments) . "\n"; } public static function __callStatic($name, $arguments) { // Note: value of ...
php
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/language/oop5/overloading/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/overloading/000.php
<?php class PropertyTest { /** * Location for overloaded data. */ private $data = array(); /** * Overloading not used on declared properties. */ public $declared = 1; /** * Overloading only used on this when accessed outside the class. */ private $hidden = 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/language/oop5/constants/006.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/constants/006.php
<?php class MyClass { public const bool MY_BOOL = true; public const int MY_INT = 1; public const float MY_FLOAT = 1.01; public const string MY_STRING = 'one'; public const array MY_ARRAY = [self::MY_BOOL, self::MY_INT, self::MY_FLOAT, self::MY_STRING]; } var_dump(MyClass::MY_BOOL); var_dump(MyCla...
php
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/language/oop5/constants/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/constants/004.php
<?php interface MyInterface { public const VALUE = 42; } class MyClass implements MyInterface { protected const VALUE = 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/language/oop5/constants/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/constants/001.php
<?php namespace foo { class bar {} echo bar::class; // 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/language/oop5/constants/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/constants/002.php
<?php const ONE = 1; class foo { const TWO = ONE * 2; const THREE = ONE + self::TWO; const SENTENCE = 'The value of THREE is ' . self::THREE; } ?>
php
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/language/oop5/constants/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/constants/003.php
<?php class Foo { public const BAR = 'bar'; private const BAZ = 'baz'; } echo Foo::BAR, PHP_EOL; echo Foo::BAZ, 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/language/oop5/constants/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/constants/000.php
<?php class MyClass { const CONSTANT = 'constant value'; function showConstant() { echo self::CONSTANT . "\n"; } } echo MyClass::CONSTANT . "\n"; $classname = 'MyClass'; echo $classname::CONSTANT . "\n"; $class = new MyClass(); $class->showConstant(); echo $class::CONSTANT . "\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/01-default/3rdparty/php-doc/language/oop5/constants/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/constants/005.php
<?php class Foo { public const BAR = 'bar'; private const BAZ = 'baz'; } $name = 'BAR'; echo Foo::{$name}, PHP_EOL; // 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/language/oop5/traits/006.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/006.php
<?php trait Hello { public function sayHello() { echo 'Hello '; } } trait World { public function sayWorld() { echo 'World!'; } } trait HelloWorld { use Hello, World; } class MyHelloWorld { use HelloWorld; } $o = new MyHelloWorld(); $o->sayHello(); $o->sayWorld(); ?>
php
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/language/oop5/traits/013.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/013.php
<?php trait ConstantsTrait { public const FLAG_MUTABLE = 1; final public const FLAG_IMMUTABLE = 5; } class ConstantsExample { use ConstantsTrait; } $example = new ConstantsExample; echo $example::FLAG_MUTABLE; ?>
php
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/language/oop5/traits/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/004.php
<?php trait A { public function smallTalk() { echo 'a'; } public function bigTalk() { echo 'A'; } } trait B { public function smallTalk() { echo 'b'; } public function bigTalk() { echo 'B'; } } class Talker { use A, B { B::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/01-default/3rdparty/php-doc/language/oop5/traits/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/001.php
<?php class Base { public function sayHello() { echo 'Hello '; } } trait SayWorld { public function sayHello() { parent::sayHello(); echo 'World!'; } } class MyHelloWorld extends Base { use SayWorld; } $o = new MyHelloWorld(); $o->sayHello(); ?>
php
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/language/oop5/traits/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/002.php
<?php trait HelloWorld { public function sayHello() { echo 'Hello World!'; } } class TheWorldIsNotEnough { use HelloWorld; public function sayHello() { echo 'Hello Universe!'; } } $o = new TheWorldIsNotEnough(); $o->sayHello(); ?>
php
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/language/oop5/traits/011.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/011.php
<?php trait PropertiesTrait { public $x = 1; } class PropertiesExample { use PropertiesTrait; } $example = new PropertiesExample(); $example->x; ?>
php
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/language/oop5/traits/009.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/009.php
<?php trait StaticExample { public static function doSomething() { return 'Doing something'; } } class Example { use StaticExample; } echo Example::doSomething(); ?>
php
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/language/oop5/traits/012.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/012.php
<?php trait PropertiesTrait { public $same = true; public $different1 = false; public bool $different2; public bool $different3; } class PropertiesExample { use PropertiesTrait; public $same = true; public $different1 = true; // Fatal error public string $different2; // Fatal 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/01-default/3rdparty/php-doc/language/oop5/traits/014.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/014.php
<?php trait ConstantsTrait { public const FLAG_MUTABLE = 1; final public const FLAG_IMMUTABLE = 5; } class ConstantsExample { use ConstantsTrait; public const FLAG_IMMUTABLE = 5; // Fatal 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/01-default/3rdparty/php-doc/language/oop5/traits/015.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/015.php
<?php trait CommonTrait { public function method() { echo 'Hello'; } } class FinalExampleA { use CommonTrait { CommonTrait::method as final; // The 'final' prevents child classes from overriding the method } } class FinalExampleB extends FinalExampleA { public function 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/01-default/3rdparty/php-doc/language/oop5/traits/007.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/007.php
<?php trait Hello { public function sayHelloWorld() { echo 'Hello' . $this->getWorld(); } abstract public function getWorld(); } class MyHelloWorld { private $world; use Hello; public function getWorld() { return $this->world; } public function setWorld($val)...
php
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/language/oop5/traits/010.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/010.php
<?php trait T { public static $counter = 1; } class A { use T; public static function incrementCounter() { static::$counter++; } } class B extends A { use T; } A::incrementCounter(); echo A::$counter, "\n"; echo B::$counter, "\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/01-default/3rdparty/php-doc/language/oop5/traits/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/003.php
<?php trait Hello { public function sayHello() { echo 'Hello '; } } trait World { public function sayWorld() { echo 'World'; } } class MyHelloWorld { use Hello, World; public function sayExclamationMark() { echo '!'; } } $o = new MyHelloWorld(); $o->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/language/oop5/traits/008.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/008.php
<?php trait Counter { public function inc() { static $c = 0; $c = $c + 1; echo "$c\n"; } } class C1 { use Counter; } class C2 { use Counter; } $o = new C1(); $o->inc(); $p = new C2(); $p->inc(); ?>
php
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/language/oop5/traits/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/000.php
<?php trait TraitA { public function sayHello() { echo 'Hello'; } } trait TraitB { public function sayWorld() { echo 'World'; } } class MyHelloWorld { use TraitA, TraitB; // A class can use multiple traits public function sayHelloWorld() { $this->sayHello...
php
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/language/oop5/traits/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/traits/005.php
<?php trait HelloWorld { public function sayHello() { echo 'Hello World!'; } } // Change visibility of sayHello class MyClass1 { use HelloWorld { sayHello as protected; } } // Alias method with changed visibility // sayHello visibility not changed class MyClass2 { use HelloWorl...
php
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/language/oop5/property-hooks/006.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/006.php
<?php class Example { public string $foo { get { $temp = __PROPERTY__; return $this->$temp; // Doesn't refer to $this->foo, so it doesn't count. } } } ?>
php
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/language/oop5/property-hooks/004.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/004.php
<?php class Example { public function __construct( public private(set) DateTimeInterface $created { set (string|DateTimeInterface $value) { if (is_string($value)) { $value = new DateTimeImmutable($value); } $this->created = $val...
php
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/language/oop5/property-hooks/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/001.php
<?php class Example { private bool $modified = false; public string $foo = 'default value' { get => $this->foo . ($this->modified ? ' (modified)' : ''); set (string $value) { $this->foo = strtolower($value); $this->modified = 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/language/oop5/property-hooks/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/002.php
<?php class Example { private bool $modified = false; public string $foo = 'default value' { get => $this->foo . ($this->modified ? ' (modified)' : ''); set { $this->foo = strtolower($value); $this->modified = 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/language/oop5/property-hooks/011.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/011.php
<?php class Point { public int $x; public int $y; } class PositivePoint extends Point { public int $x { set { if ($value < 0) { throw new \InvalidArgumentException('Too small'); } parent::$x::set($value); } } } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/009.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/009.php
<?php class User { public string $username { final set => strtolower($value); } } class Manager extends User { public string $username { // This is allowed get => strtoupper($this->username); // But this is NOT allowed, because set is final in the parent. set => strt...
php
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/language/oop5/property-hooks/012.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/012.php
<?php class Strings { public string $val; } class CaseFoldingStrings extends Strings { public bool $uppercase = true; public string $val { get => $this->uppercase ? strtoupper(parent::$val::get()) : strtolower(parent::$val::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/01-default/3rdparty/php-doc/language/oop5/property-hooks/007.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/007.php
<?php class Rectangle { // A virtual property. public int $area { get => $this->h * $this->w; } public function __construct( public int $h, public int $w ) {} } $s = new Rectangle(4, 5); print $s->area; // prints 20 $s->area = 30; // Error, as there is no set operation de...
php
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/language/oop5/property-hooks/010.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/010.php
<?php class Point { public int $x; public int $y; } class PositivePoint extends Point { public int $x { set { if ($value < 0) { throw new \InvalidArgumentException('Too small'); } $this->x = $value; } } } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/003.php
<?php class Example { public string $foo = 'default value' { get => $this->foo . ($this->modified ? ' (modified)' : ''); set => strtolower($value); } } ?>
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false
lkrms/pretty-php
https://github.com/lkrms/pretty-php/blob/5d244a4b7a9b484581edbb5df596a4e76ba17fa6/tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/008.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/008.php
<?php class Person { public string $phone { set => $this->sanitizePhone($value); } private function sanitizePhone(string $value): string { $value = ltrim($value, '+'); $value = ltrim($value, '1'); if (!preg_match('/\d\d\d\-\d\d\d\-\d\d\d\d/', $value)) { thro...
php
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/language/oop5/property-hooks/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/000.php
<?php class Example { private bool $modified = false; public string $foo = 'default value' { get { if ($this->modified) { return $this->foo . ' (modified)'; } return $this->foo; } set (string $value) { $this->foo = strtolow...
php
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/language/oop5/property-hooks/005.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/property-hooks/005.php
<?php class Example { public private(set) DateTimeInterface $created { set (string|DateTimeInterface $value) { if (is_string($value)) { $value = new DateTimeImmutable($value); } $this->created = $value; } } public function __construct( ...
php
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/language/oop5/serialization/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/serialization/000.php
<?php // A.php: class A { public $one = 1; public function show_one() { echo $this->one; } } // page1.php: include 'A.php'; $a = new A; $s = serialize($a); // store $s somewhere where page2.php can find it. file_put_contents('store', $s); // page2.php: // this is needed for the unserializ...
php
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/language/oop5/object-comparison/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/object-comparison/000.php
<?php function bool2str($bool) { if ($bool === false) { return 'FALSE'; } else { return 'TRUE'; } } function compareObjects(&$o1, &$o2) { echo 'o1 == o2 : ' . bool2str($o1 == $o2) . "\n"; echo 'o1 != o2 : ' . bool2str($o1 != $o2) . "\n"; echo 'o1 === o2 : ' . bool2str($o1 === $o...
php
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/language/oop5/final/001.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/final/001.php
<?php final class BaseClass { public function test() { echo "BaseClass::test() called\n"; } // As the class is already final, the final keyword is redundant final public function moreTesting() { echo "BaseClass::moreTesting() called\n"; } } class ChildClass extends BaseClas...
php
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/language/oop5/final/002.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/final/002.php
<?php class BaseClass { final protected string $test; } class ChildClass extends BaseClass { public string $test; } // Results in Fatal error: Cannot override final property BaseClass::$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/language/oop5/final/003.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/final/003.php
<?php class Foo { final public const X = 'foo'; } class Bar extends Foo { public const X = 'bar'; } // Fatal error: Bar::X cannot override final constant Foo::X ?>
php
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/language/oop5/final/000.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/oop5/final/000.php
<?php class BaseClass { public function test() { echo "BaseClass::test() called\n"; } final public function moreTesting() { echo "BaseClass::moreTesting() called\n"; } } class ChildClass extends BaseClass { public function moreTesting() { echo "ChildClass::moreT...
php
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/language/variables/028.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/028.php
<?php if (isset($_COOKIE['count'])) { $count = $_COOKIE['count'] + 1; } else { $count = 1; } setcookie('count', $count, time() + 3600); setcookie("Cart[$count]", $item, time() + 3600); ?>
php
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/language/variables/006.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/006.php
<?php $unset_array[] = 'value'; // Does not generate a warning. ?>
php
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/language/variables/018.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/018.php
<?php function test_global_ref() { global $obj; $new = new stdClass; $obj = &$new; } function test_global_noref() { global $obj; $new = new stdClass; $obj = $new; } test_global_ref(); var_dump($obj); test_global_noref(); 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/01-default/3rdparty/php-doc/language/variables/017.php
tests/fixtures/Formatter/out/01-default/3rdparty/php-doc/language/variables/017.php
<?php class Foo { public static function counter() { static $counter = 0; $counter++; return $counter; } } class Bar extends Foo {} var_dump(Foo::counter()); // int(1) var_dump(Foo::counter()); // int(2) var_dump(Bar::counter()); // int(3), prior to PHP 8.1.0 int(1) var_dump(Bar...
php
MIT
5d244a4b7a9b484581edbb5df596a4e76ba17fa6
2026-01-05T04:31:39.990954Z
false