mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 14:50:39 -04:00
Add Safe PHP functions
This commit is contained in:
parent
04a956886a
commit
58cc098058
260 changed files with 49458 additions and 45 deletions
42
vendor/thecodingmachine/phpstan-safe-rule/tests/Rules/CallMethodRuleTest.php
vendored
Normal file
42
vendor/thecodingmachine/phpstan-safe-rule/tests/Rules/CallMethodRuleTest.php
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace TheCodingMachine\Safe\PHPStan\Rules;
|
||||
|
||||
use PHPStan\Rules\FunctionCallParametersCheck;
|
||||
use PHPStan\Rules\Methods\CallMethodsRule;
|
||||
use PHPStan\Rules\Rule;
|
||||
use PHPStan\Rules\RuleLevelHelper;
|
||||
use PHPStan\Testing\RuleTestCase;
|
||||
use TheCodingMachine\Safe\PHPStan\Type\Php\ReplaceSafeFunctionsDynamicReturnTypeExtension;
|
||||
|
||||
class CallMethodRuleTest extends RuleTestCase
|
||||
{
|
||||
protected function getRule(): Rule
|
||||
{
|
||||
$broker = $this->createBroker();
|
||||
$ruleLevelHelper = new RuleLevelHelper($broker, true, true, true);
|
||||
return new CallMethodsRule(
|
||||
$broker,
|
||||
new FunctionCallParametersCheck($ruleLevelHelper, true, true),
|
||||
$ruleLevelHelper,
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public function testSafePregReplace()
|
||||
{
|
||||
// FIXME: this rule actually runs code but will always return no error because the rule executed is not the correct one.
|
||||
// This provides code coverage but assert is not ok.
|
||||
$this->analyse([__DIR__ . '/data/safe_pregreplace.php'], []);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \PHPStan\Type\DynamicFunctionReturnTypeExtension[]
|
||||
*/
|
||||
public function getDynamicFunctionReturnTypeExtensions(): array
|
||||
{
|
||||
return [new ReplaceSafeFunctionsDynamicReturnTypeExtension()];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue