-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
273 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--TEST-- | ||
Integration of @PER. | ||
--RULESET-- | ||
{"@PER": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
abstract class PER | ||
{ | ||
static | ||
protected string $keywords; | ||
|
||
static public | ||
abstract function keywords(); | ||
|
||
public function heredocAndNowdoc() | ||
{ | ||
$notAllowed = <<<COUNTEREXAMPLE | ||
Wrong indentation. | ||
Also, should be nowdoc. | ||
COUNTEREXAMPLE; | ||
} | ||
|
||
public function shortClosures() | ||
{ | ||
$identity =fn(int $x) :int=>$x ; | ||
|
||
$sum = fn (int $x, int $y): int => | ||
$x + $y | ||
; | ||
} | ||
|
||
public function trailingCommas() | ||
{ | ||
$min = min(3, M_PI,); | ||
$min = min( | ||
3, | ||
M_PI | ||
); | ||
|
||
[$foo, $bar,] = ['foo', 'bar',]; | ||
[ | ||
$foo, | ||
$bar | ||
] = [ | ||
'foo', | ||
'bar' | ||
]; | ||
|
||
list($foo, $bar,) = array('foo', 'bar',); | ||
list( | ||
$foo, | ||
$bar | ||
) = array( | ||
'foo', | ||
'bar' | ||
); | ||
} | ||
|
||
public function chaining() | ||
{ | ||
$this->foo() | ||
->bar()->baz(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
abstract class PER | ||
{ | ||
protected static string $keywords; | ||
|
||
abstract public static function keywords(); | ||
|
||
public function heredocAndNowdoc() | ||
{ | ||
$notAllowed = <<<'COUNTEREXAMPLE' | ||
Wrong indentation. | ||
Also, should be nowdoc. | ||
COUNTEREXAMPLE; | ||
} | ||
|
||
public function shortClosures() | ||
{ | ||
$identity = fn (int $x): int => $x; | ||
|
||
$sum = fn (int $x, int $y): int | ||
=> $x + $y; | ||
} | ||
|
||
public function trailingCommas() | ||
{ | ||
$min = min(3, M_PI); | ||
$min = min( | ||
3, | ||
M_PI, | ||
); | ||
|
||
[$foo, $bar] = ['foo', 'bar']; | ||
[ | ||
$foo, | ||
$bar, | ||
] = [ | ||
'foo', | ||
'bar', | ||
]; | ||
|
||
list($foo, $bar) = array('foo', 'bar'); | ||
list( | ||
$foo, | ||
$bar, | ||
) = array( | ||
'foo', | ||
'bar', | ||
); | ||
} | ||
|
||
public function chaining() | ||
{ | ||
$this | ||
->foo() | ||
->bar() | ||
->baz(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--TEST-- | ||
Integration of @PER [PHP 8.0 version]. | ||
--RULESET-- | ||
{"@PER": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
class PER80 | ||
{ | ||
public function trailingCommas( | ||
int|float $num | ||
) { | ||
$match = match ($num) { | ||
3 => 'three', | ||
M_PI => 'pi', | ||
default => 'other' | ||
}; | ||
|
||
$sum = fn (int $x, | ||
int $y | ||
) => $x + $y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
class PER80 | ||
{ | ||
public function trailingCommas( | ||
int|float $num, | ||
) { | ||
$match = match ($num) { | ||
3 => 'three', | ||
M_PI => 'pi', | ||
default => 'other', | ||
}; | ||
|
||
$sum = fn ( | ||
int $x, | ||
int $y, | ||
) => $x + $y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--TEST-- | ||
Integration of @PER [PHP 8.1 version]. | ||
--RULESET-- | ||
{"@PER": true} |
Oops, something went wrong.