123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- --TEST--
- PHP 8.2 test.
- --RULESET--
- {
- "@PhpCsFixer": true,
- "@PHP82Migration": true
- }
- --REQUIREMENTS--
- {"php": 80200}
- --EXPECT--
- <?php
- // https://wiki.php.net/rfc/readonly_classes
- final readonly class Foo
- {
- public string $prop;
- }
- // https://wiki.php.net/rfc/fetch_property_in_const_expressions
- enum A: string
- {
- case B = 'B';
- public const C = [self::B->name => self::B->value];
- public const D = self::B?->value;
- }
- #[Attr(A::B->name)]
- class E {}
- // https://wiki.php.net/rfc/null-false-standalone-types
- class FalseNull
- {
- private false $a = false;
- private null $b = null;
- public function __construct(
- private false $falsy = false,
- private null $nully = null
- ) {}
- public function falsy(): false
- {
- return $this->falsy;
- }
- public function nully(): null
- {
- return $this->nully;
- }
- public function setAB(false $a, null $b): void
- {
- $this->a = $a;
- $this->b = $b;
- }
- }
- function falsyNull(null $n, false $f): ?false {}
- array_filter([], fn (null $n) => null === $n);
- array_filter([], fn (false $n) => false === $n);
- // https://wiki.php.net/rfc/true-type
- class TrueType
- {
- private true $a = true;
- public function __construct(
- private true $havingABud = true
- ) {}
- public function havingABud(): true
- {
- return $this->havingABud;
- }
- public function setA(true $a): void
- {
- $this->a = $a;
- }
- }
- function truish(true $true): true
- {
- return $true;
- }
- array_filter([], fn (true $n) => true === $n);
- // https://wiki.php.net/rfc/constants_in_traits
- trait WithConstants
- {
- public const ONE = 'one';
- protected const TWO = 'two';
- private const THREE = 'three';
- }
- // https://wiki.php.net/rfc/dnf_types
- function generateSlug(null|(HasId&HasTitle) $post)
- {
- throw new Exception('not implemented');
- }
- --INPUT--
- <?php
- // https://wiki.php.net/rfc/readonly_classes
- READONLY final class Foo
- {
- public string $prop;
- }
- // https://wiki.php.net/rfc/fetch_property_in_const_expressions
- enum A: string
- {
- case B = 'B';
- const C = [self::B -> name => self::B->value];
- const D = self::B ?-> value;
- }
- #[Attr(A::B -> name)]
- class E
- {
- }
- // https://wiki.php.net/rfc/null-false-standalone-types
- class FalseNull {
- private FALSE $a = FALSE;
- private NULL $b = NULL;
- public function __construct(
- private FALSE $falsy = FALSE,
- private NULL $nully = NULL
- ) {
- }
- public function falsy() : FALSE
- {
- return $this -> falsy;
- }
- public function nully() : NULL
- {
- return $this -> nully;
- }
- public function setAB(FALSE $a, NULL $b): void
- {
- $this->a = $a;
- $this->b = $b;
- }
- }
- function falsyNull (NULL $n, FALSE $f): NULL|FALSE
- {
- }
- array_filter([], fn (NULL $n) => NULL === $n);
- array_filter([], fn (FALSE $n) => FALSE === $n);
- // https://wiki.php.net/rfc/true-type
- class TrueType {
- private TRUE $a = TRUE;
- public function __construct(
- private TRUE $havingABud = TRUE
- ) {
- }
- public function havingABud() : TRUE
- {
- return $this -> havingABud;
- }
- public function setA(TRUE $a): void
- {
- $this->a = $a;
- }
- }
- function truish (TRUE $true) : TRUE
- {
- return $true;
- }
- array_filter([], fn (TRUE $n) => TRUE === $n);
- // https://wiki.php.net/rfc/constants_in_traits
- trait WithConstants {
- public const ONE = 'one';
- protected const TWO = 'two';
- private const THREE = 'three';
- }
- // https://wiki.php.net/rfc/dnf_types
- function generateSlug((HasTitle&HasId)|null $post)
- {
- throw new \Exception('not implemented');
- }
|