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
178 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Base; | ||
|
||
final class Foobar implements IFoobar | ||
{ | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Base; | ||
|
||
interface IFoobar | ||
{ | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Base; | ||
|
||
/** | ||
* @mixin IFoobar | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Base; | ||
|
||
interface IFoobar | ||
{ | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Base; | ||
|
||
/** | ||
* @mixin IFoobar | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Next; | ||
|
||
use Exception; | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Next; | ||
|
||
interface IFoobar | ||
{ | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Next; | ||
|
||
/** | ||
* @mixin IFoobar | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Php80; | ||
|
||
use Exception; | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Php80; | ||
|
||
interface IFoobar | ||
{ | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Php80; | ||
|
||
/** | ||
* @mixin IFoobar | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Php81; | ||
|
||
use Exception; | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Php81; | ||
|
||
interface IFoobar | ||
{ | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests; | ||
namespace Tests\Php81; | ||
|
||
/** | ||
* @mixin IFoobar | ||
|
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,116 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Php82; | ||
|
||
use Exception; | ||
|
||
final class Foobar implements IFoobar | ||
{ | ||
|
||
use TFoo; | ||
|
||
public const FOO_LENGTH = 5; | ||
public const FOO_BAR = 'foo.bar'; | ||
public const FOO_BAZ = [ | ||
'first', | ||
'second', | ||
]; | ||
|
||
/** @inject */ | ||
public Foobar $service; | ||
|
||
/** @var array<string> */ | ||
public array $foo = []; | ||
|
||
protected string $bar; | ||
|
||
private int $baz; | ||
|
||
public function __construct() | ||
{ | ||
$this->foo = ['1', '2', '3']; | ||
$this->bar = 'bar'; | ||
$this->baz = 0; | ||
|
||
$this->getSwitchCase(); | ||
} | ||
|
||
public function isBaz(mixed $value): bool | ||
{ | ||
if (is_bool($value)) { | ||
return true; | ||
} | ||
|
||
return $this->baz !== 0; | ||
} | ||
|
||
/** | ||
* @return array<string> | ||
*/ | ||
public function getArrayFunction(): array | ||
{ | ||
return array_map(fn (string $val): string => mb_strtolower($val), $this->getForEach()); | ||
} | ||
|
||
/** | ||
* Needs implementation | ||
* | ||
* @param array<mixed>|null $baz | ||
*/ | ||
public function interfaceMethod(string $foo, int $bar, ?array $baz = null): void | ||
{ | ||
throw new Exception('Not yet implemented'); | ||
} | ||
|
||
/** | ||
* @return array<string> | ||
*/ | ||
protected function getForEach(): array | ||
{ | ||
$result = []; | ||
|
||
foreach ($this->foo as $foo) { | ||
if (strlen($foo) === self::FOO_LENGTH) { | ||
continue; | ||
} | ||
|
||
$result[] = $foo; | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
private function getSwitchCase(): void | ||
{ | ||
switch ($this->bar) { | ||
case 'case1': | ||
$this->baz = 1; | ||
|
||
break; | ||
case 'case2': | ||
$this->baz = 2; | ||
|
||
break; | ||
case 'case3': | ||
throw new Exception('Case 3 error'); | ||
default: | ||
$this->baz = 4; | ||
} | ||
} | ||
|
||
private function ifElseStatement(): void | ||
{ | ||
$this->foobar = 1; | ||
|
||
if ($this->bar === 'case1') { | ||
$this->baz = 1; | ||
} elseif ($this->bar === 'case2') { | ||
$this->baz = 2; | ||
} else { | ||
$this->baz = 3; | ||
} | ||
|
||
$this->bar = 'case3'; | ||
} | ||
|
||
} |
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,13 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Php82; | ||
|
||
interface IFoobar | ||
{ | ||
|
||
/** | ||
* @param array<mixed>|null $baz | ||
*/ | ||
public function interfaceMethod(string $foo, int $bar, ?array $baz = null): void; | ||
|
||
} |
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 declare(strict_types = 1); | ||
|
||
namespace Tests\Php82; | ||
|
||
/** | ||
* @mixin IFoobar | ||
*/ | ||
trait TFoo | ||
{ | ||
|
||
protected mixed $foobar; | ||
|
||
protected function contextFoobar(): void | ||
{ | ||
$this->interfaceMethod('foo', 3); | ||
} | ||
|
||
} |
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,3 @@ | ||
tests/Sets/php81/1-good/Foobar.php | ||
tests/Sets/php81/1-good/IFoobar.php | ||
tests/Sets/php81/1-good/TFoo.php |
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,6 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Test ruleset-8.2.xml"> | ||
<arg name="basepath" value="."/> | ||
<arg name="extensions" value="php"/> | ||
<rule ref="./../../../../ruleset-8.2.xml"/> | ||
</ruleset> |
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