-
-
Notifications
You must be signed in to change notification settings - Fork 51
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 #223 from gsteel/improve-plugin-manager-type-infer…
…ence Improve plugin manager type inference
- Loading branch information
Showing
5 changed files
with
71 additions
and
24 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
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaminasTest\Cache\StaticAnalysis; | ||
|
||
use Laminas\Cache\Storage\Adapter\Memory; | ||
use Laminas\Cache\Storage\AdapterPluginManager; | ||
use Laminas\Cache\Storage\StorageInterface; | ||
|
||
final class AdapterPluginManagerTypes | ||
{ | ||
public function willReturnAnAdapterUsingFQCN(AdapterPluginManager $manager): StorageInterface | ||
{ | ||
return $manager->get(Memory::class); | ||
} | ||
|
||
public function validateWillAssertInstanceType(AdapterPluginManager $manager, object $instance): StorageInterface | ||
{ | ||
$manager->validate($instance); | ||
|
||
return $instance; | ||
} | ||
|
||
public function buildWillReturnAdapterUsingFQCN(AdapterPluginManager $manager): StorageInterface | ||
{ | ||
return $manager->build(Memory::class); | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaminasTest\Cache\StaticAnalysis; | ||
|
||
use Laminas\Cache\Storage\Plugin\PluginInterface; | ||
use Laminas\Cache\Storage\Plugin\Serializer; | ||
use Laminas\Cache\Storage\PluginManager; | ||
|
||
final class PluginManagerTypes | ||
{ | ||
public function willReturnAPluginUsingFQCN(PluginManager $manager): PluginInterface | ||
{ | ||
return $manager->get(Serializer::class); | ||
} | ||
|
||
public function validateWillAssertInstanceType(PluginManager $manager, object $instance): PluginInterface | ||
{ | ||
$manager->validate($instance); | ||
|
||
return $instance; | ||
} | ||
|
||
public function buildWillReturnPluginUsingFQCN(PluginManager $manager): PluginInterface | ||
{ | ||
return $manager->build(Serializer::class); | ||
} | ||
} |