generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from olivernybroe/types
Add type checking via phpstan
- Loading branch information
Showing
8 changed files
with
57 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
/art export-ignore | ||
/docs export-ignore | ||
/UPGRADING.md export-ignore | ||
/types export-ignore |
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,16 @@ | ||
<?php | ||
|
||
class Example | ||
{ | ||
public function __construct( | ||
private string $mySecret, | ||
protected int $myShared, | ||
public string $myExposed, | ||
) { | ||
} | ||
|
||
public function getMySecret(): string | ||
{ | ||
return $this->mySecret; | ||
} | ||
} |
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,4 @@ | ||
parameters: | ||
paths: | ||
- . | ||
level: max |
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,12 @@ | ||
<?php | ||
|
||
use Spatie\Invade\Invader; | ||
use function PHPStan\Testing\assertType; | ||
|
||
$example = new Example("password", 42, "Pestival"); | ||
$invaded = new Invader($example); | ||
|
||
assertType(Invader::class . '<' . Example::class . '>', $invaded); | ||
assertType('string', $invaded->myExposed); | ||
assertType('int', $invaded->myShared); | ||
assertType('string', $invaded->mySecret); |
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,8 @@ | ||
<?php | ||
|
||
use Spatie\Invade\Invader; | ||
use function PHPStan\Testing\assertType; | ||
|
||
$example = new Example("password", 42, "Pestival"); | ||
|
||
assertType(Invader::class . '<' . Example::class . '>', invade($example)); |