generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added enum case type, invokable type inference, method calls extensio…
…ns for exception inference (#627) * implemented enum case * implemented invokable inference * extensions for exceptions * Fix styling * removed dummy code --------- Co-authored-by: romalytvynenko <romalytvynenko@users.noreply.github.com>
- Loading branch information
1 parent
e8c2b8f
commit 859708d
Showing
10 changed files
with
129 additions
and
11 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
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,17 @@ | ||
<?php | ||
|
||
namespace Dedoc\Scramble\Infer\Extensions; | ||
|
||
use Dedoc\Scramble\Infer\Extensions\Event\MethodCallEvent; | ||
use Dedoc\Scramble\Support\Type\ObjectType; | ||
use Dedoc\Scramble\Support\Type\Type; | ||
|
||
interface MethodCallExceptionsExtension extends InferExtension | ||
{ | ||
public function shouldHandle(ObjectType $type): bool; | ||
|
||
/** | ||
* @return array<Type> | ||
*/ | ||
public function getMethodCallExceptions(MethodCallEvent $event): array; | ||
} |
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
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,23 @@ | ||
<?php | ||
|
||
namespace Dedoc\Scramble\Support\Type; | ||
|
||
class EnumCaseType extends ObjectType | ||
{ | ||
public function __construct( | ||
string $name, | ||
public string $caseName, | ||
) { | ||
parent::__construct($name); | ||
} | ||
|
||
public function isSame(Type $type) | ||
{ | ||
return $type instanceof static && $type->toString() === $this->toString(); | ||
} | ||
|
||
public function toString(): string | ||
{ | ||
return "{$this->name}::{$this->caseName}"; | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
namespace Dedoc\Scramble\Tests\Infer\stubs; | ||
|
||
class InvokableFoo | ||
{ | ||
public function __invoke($bar) | ||
{ | ||
return $bar; | ||
} | ||
} |