mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 01:52:02 -04:00
Add Safe PHP functions
This commit is contained in:
parent
04a956886a
commit
58cc098058
260 changed files with 49458 additions and 45 deletions
32
vendor/thecodingmachine/safe/generator/tests/PhpStanFunctions/PhpStanFunctionMapReaderTest.php
vendored
Normal file
32
vendor/thecodingmachine/safe/generator/tests/PhpStanFunctions/PhpStanFunctionMapReaderTest.php
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Safe\PhpStanFunctions;
|
||||
|
||||
use PHPStan\Testing\TestCase;
|
||||
|
||||
class PhpStanFunctionMapReaderTest extends TestCase
|
||||
{
|
||||
public function testHas(): void
|
||||
{
|
||||
$mapReader = new PhpStanFunctionMapReader();
|
||||
$this->assertTrue($mapReader->hasFunction('strpos'));
|
||||
$this->assertFalse($mapReader->hasFunction('foobar'));
|
||||
}
|
||||
|
||||
public function testGet(): void
|
||||
{
|
||||
$mapReader = new PhpStanFunctionMapReader();
|
||||
$function = $mapReader->getFunction('apcu_fetch');
|
||||
|
||||
|
||||
// 'apcu_fetch' => ['mixed', 'key'=>'string|string[]', '&w_success='=>'bool'],
|
||||
$this->assertSame('mixed', $function->getReturnType());
|
||||
$parameters = $function->getParameters();
|
||||
$this->assertCount(2, $parameters);
|
||||
$this->assertSame('success', $parameters['success']->getName());
|
||||
$this->assertSame('bool', $parameters['success']->getType());
|
||||
$this->assertFalse($parameters['success']->isVariadic());
|
||||
$this->assertTrue($parameters['success']->isByReference());
|
||||
$this->assertTrue($parameters['success']->isOptional());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue