Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt at a better type resolution on Yii::createObject #28

Merged
merged 3 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions extension.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
parameters:
yii2:
config_path: null
stubFiles:
- stubs/BaseYii.stub

parametersSchema:
yii2: structure([
Expand Down Expand Up @@ -38,8 +40,5 @@ services:
-
class: Proget\PHPStan\Yii2\Type\ContainerDynamicMethodReturnTypeExtension
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
-
class: Proget\PHPStan\Yii2\Type\YiiDynamicStaticMethodReturnTypeExtension
tags: [phpstan.broker.dynamicStaticMethodReturnTypeExtension]

- Proget\PHPStan\Yii2\ServiceMap(%yii2.config_path%)
84 changes: 0 additions & 84 deletions src/Type/YiiDynamicStaticMethodReturnTypeExtension.php

This file was deleted.

16 changes: 16 additions & 0 deletions stubs/BaseYii.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php declare(strict_types=1);

namespace yii;


class BaseYii
{
/**
* @template T
* @param class-string<T>|array{class: class-string<T>}|callable(): T $type
* @param array<mixed> $params
*
* @return T
*/
public static function createObject($type, array $params = []);
}