-
-
Notifications
You must be signed in to change notification settings - Fork 12
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 #28 from InvisibleSmiley/master
Support Interop and PSR containers for $container->get() resolution
- Loading branch information
Showing
13 changed files
with
187 additions
and
31 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,7 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Parameter \\#2 \\$args of static method PHPStan\\\\Reflection\\\\ParametersAcceptorSelector\\:\\:selectFromArgs\\(\\) expects array\\<PhpParser\\\\Node\\\\Arg\\>, array\\<PhpParser\\\\Node\\\\Arg\\|PhpParser\\\\Node\\\\VariadicPlaceholder\\> given\\.$#" | ||
count: 1 | ||
path: src/Type/Laminas/PluginMethodDynamicReturnTypeExtension/AbstractPluginMethodDynamicReturnTypeExtension.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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
includes: | ||
- vendor/phpstan/phpstan-phpunit/extension.neon | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
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
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
43 changes: 43 additions & 0 deletions
43
tests/Rules/Laminas/ServiceManagerGetMethodCallRule/InteropContainerFoo.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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaminasPhpStan\Tests\Rules\Laminas\ServiceManagerGetMethodCallRule; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use Laminas\Form\FormElementManager; | ||
use Laminas\Mvc\Controller\ControllerManager; | ||
use stdClass; | ||
|
||
final class InteropContainerFoo | ||
{ | ||
private ContainerInterface $container; | ||
|
||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
public function foo(): void | ||
{ | ||
$this->container->get('non_existent_service'); | ||
|
||
$this->container->get('EventManager'); | ||
$this->container->get('foo', 'bar'); | ||
$this->container->get([]); | ||
|
||
$getterName = 'get'; | ||
$this->container->{$getterName}('EventManager'); | ||
$this->container->has('EventManager'); | ||
|
||
$stdClass = new stdClass(); | ||
$stdClass->get('non_existent_service'); | ||
|
||
$this->container->get(ControllerManager::class); | ||
$this->container->get(FormElementManager::class); | ||
} | ||
|
||
public function get(string $foo): void | ||
{ | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
tests/Rules/Laminas/ServiceManagerGetMethodCallRule/PsrContainerFoo.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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaminasPhpStan\Tests\Rules\Laminas\ServiceManagerGetMethodCallRule; | ||
|
||
use Laminas\Form\FormElementManager; | ||
use Laminas\Mvc\Controller\ControllerManager; | ||
use Psr\Container\ContainerInterface; | ||
use stdClass; | ||
|
||
final class PsrContainerFoo | ||
{ | ||
private ContainerInterface $container; | ||
|
||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
public function foo(): void | ||
{ | ||
$this->container->get('non_existent_service'); | ||
|
||
$this->container->get('EventManager'); | ||
$this->container->get('foo', 'bar'); | ||
$this->container->get([]); | ||
|
||
$getterName = 'get'; | ||
$this->container->{$getterName}('EventManager'); | ||
$this->container->has('EventManager'); | ||
|
||
$stdClass = new stdClass(); | ||
$stdClass->get('non_existent_service'); | ||
|
||
$this->container->get(ControllerManager::class); | ||
$this->container->get(FormElementManager::class); | ||
} | ||
|
||
public function get(string $foo): void | ||
{ | ||
} | ||
} |
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