-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure AssertFunctionTypeSpecifyingExtension works with namespaced…
… functions
- Loading branch information
1 parent
151d71b
commit 8e11b1a
Showing
3 changed files
with
68 additions
and
2 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
36 changes: 36 additions & 0 deletions
36
tests/Type/PHPUnit/AssertFunctionTypeSpecifyingExtensionTest.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,36 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Type\PHPUnit; | ||
|
||
use PHPStan\Testing\TypeInferenceTestCase; | ||
|
||
class AssertFunctionTypeSpecifyingExtensionTest extends TypeInferenceTestCase | ||
{ | ||
|
||
/** @return mixed[] */ | ||
public function dataFileAsserts(): iterable | ||
{ | ||
yield from $this->gatherAssertTypes(__DIR__ . '/data/assert-function.php'); | ||
} | ||
|
||
/** | ||
* @dataProvider dataFileAsserts | ||
* @param string $assertType | ||
* @param string $file | ||
* @param mixed ...$args | ||
*/ | ||
public function testFileAsserts( | ||
string $assertType, | ||
string $file, | ||
...$args | ||
): void | ||
{ | ||
$this->assertFileAsserts($assertType, $file, ...$args); | ||
} | ||
|
||
public static function getAdditionalConfigFiles(): array | ||
{ | ||
return [__DIR__ . '/../../../extension.neon']; | ||
} | ||
|
||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace AssertFunction; | ||
|
||
use function PHPStan\Testing\assertType; | ||
use function PHPUnit\Framework\assertInstanceOf; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @param object $o | ||
*/ | ||
public function doFoo($o): void | ||
{ | ||
assertInstanceOf(self::class, $o); | ||
assertType(self::class, $o); | ||
} | ||
|
||
} |