-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove strict lambda in phpspec files
- Loading branch information
1 parent
b25f454
commit 1ae8b58
Showing
6 changed files
with
144 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace tests\UseCase\Phpspec\Regression; | ||
|
||
use PedroTroller\CS\Fixer\PhpspecFixer; | ||
use tests\UseCase; | ||
|
||
final class Case3 implements UseCase | ||
{ | ||
public function getFixers(): iterable | ||
{ | ||
yield new PhpspecFixer(); | ||
} | ||
|
||
public function getRawScript(): string | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
declare(strict_types=1); | ||
namespace spec\App; | ||
use PhpSpec\ObjectBehavior; | ||
class MyClass extends ObjectBehavior | ||
{ | ||
function it_is_a_scenario(FileManager $fileManager) | ||
{ | ||
$fileManager | ||
->createTemporaryFile(Argument::any(), Argument::any()) | ||
->will( | ||
static fn ($args) => tempnam($args[1] ?? sys_get_temp_dir(), $args[0] ?? uniqid()) | ||
) | ||
; | ||
$fileManager | ||
->createTemporaryFile(Argument::any(), Argument::any()) | ||
->will( | ||
static function ($args) { | ||
return tempnam($args[1] ?? sys_get_temp_dir(), $args[0] ?? uniqid()); | ||
} | ||
) | ||
; | ||
} | ||
private static function staticFunc(): string | ||
{ | ||
return 'Hello'; | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function getExpectation(): string | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
declare(strict_types=1); | ||
namespace spec\App; | ||
use PhpSpec\ObjectBehavior; | ||
class MyClass extends ObjectBehavior | ||
{ | ||
function it_is_a_scenario(FileManager $fileManager) | ||
{ | ||
$fileManager | ||
->createTemporaryFile(Argument::any(), Argument::any()) | ||
->will( | ||
fn ($args) => tempnam($args[1] ?? sys_get_temp_dir(), $args[0] ?? uniqid()) | ||
) | ||
; | ||
$fileManager | ||
->createTemporaryFile(Argument::any(), Argument::any()) | ||
->will( | ||
function ($args) { | ||
return tempnam($args[1] ?? sys_get_temp_dir(), $args[0] ?? uniqid()); | ||
} | ||
) | ||
; | ||
} | ||
private static function staticFunc(): string | ||
{ | ||
return 'Hello'; | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function getMinSupportedPhpVersion(): int | ||
{ | ||
return 0; | ||
} | ||
} |