-
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.
test: Exception > cannot set empty content for id-based Token
- Loading branch information
1 parent
9a1d294
commit 7b6a3e4
Showing
1 changed file
with
123 additions
and
0 deletions.
There are no files selected for viewing
123 changes: 123 additions & 0 deletions
123
tests/UseCase/LineBreakBetweenMethods/Regression/Case4.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,123 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace tests\UseCase\LineBreakBetweenMethods\Regression; | ||
|
||
use PedroTroller\CS\Fixer\CodingStyle\LineBreakBetweenMethodArgumentsFixer; | ||
use tests\UseCase; | ||
|
||
/** | ||
* https://github.com/PedroTroller/PhpCSFixer-Custom-Fixers/issues/104 | ||
*/ | ||
final class Case4 implements UseCase | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getFixer() | ||
{ | ||
$fixer = new LineBreakBetweenMethodArgumentsFixer(); | ||
|
||
$fixer->configure([ | ||
'max-args' => 4, | ||
'max-length' => 100, | ||
]); | ||
|
||
return $fixer; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getRawScript() | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
// error, because line is too long and fixer will try to split it | ||
function addDateIntervalaaaaaaaaaaaaaakjfklsdjfklsjfkjklsajlkkldfjklajlkfjaslfjskdfjksajlkfjldaj(DateTimeInterface $date): void | ||
{ | ||
echo 'do something'; | ||
} | ||
//its ok, because we have spaces before function | ||
function addDateIntervalaaaaaaaaaaaaaakjfklsdjfklsjfkjklsajlkkldfjklajlkfjaslfjskdfjksajlkfjldaj(DateTimeInterface $date): void | ||
{ | ||
echo 'do something'; | ||
} | ||
//its ok, because we do not have return type | ||
function addDateIntervalaaaaaaaaaaaaaakjfklsdjfklsjfkjklsajlkkldfjklajlkfjaslfjskdfjksajlkfjldaj(DateTimeInterface $date): void | ||
{ | ||
echo 'do something'; | ||
} | ||
//is ok, because function name less than 100 chars and fixer do not try to split it | ||
function addDateInterval(DateTimeInterface $date): void | ||
{ | ||
echo 'do something'; | ||
} | ||
//error | ||
function someFuncName( | ||
string $format, | ||
string $time, | ||
DateTimeZone $timezone = null | ||
): void { | ||
echo 'do something'; | ||
} | ||
PHP; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getExpectation() | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
// error, because line is too long and fixer will try to split it | ||
function addDateIntervalaaaaaaaaaaaaaakjfklsdjfklsjfkjklsajlkkldfjklajlkfjaslfjskdfjksajlkfjldaj( | ||
DateTimeInterface $date | ||
): void { | ||
echo 'do something'; | ||
} | ||
//its ok, because we have spaces before function | ||
function addDateIntervalaaaaaaaaaaaaaakjfklsdjfklsjfkjklsajlkkldfjklajlkfjaslfjskdfjksajlkfjldaj( | ||
DateTimeInterface $date | ||
): void { | ||
echo 'do something'; | ||
} | ||
//its ok, because we do not have return type | ||
function addDateIntervalaaaaaaaaaaaaaakjfklsdjfklsjfkjklsajlkkldfjklajlkfjaslfjskdfjksajlkfjldaj( | ||
DateTimeInterface $date | ||
): void { | ||
echo 'do something'; | ||
} | ||
//is ok, because function name less than 100 chars and fixer do not try to split it | ||
function addDateInterval(DateTimeInterface $date): void | ||
{ | ||
echo 'do something'; | ||
} | ||
//error | ||
function someFuncName(string $format, string $time, DateTimeZone $timezone = null): void | ||
{ | ||
echo 'do something'; | ||
} | ||
PHP; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getMinSupportedPhpVersion() | ||
{ | ||
return 70000; | ||
} | ||
} |