Skip to content

Conversation

@rvanvelzen
Copy link
Contributor

Leverage the power of late-resolved types when necessary.

@ondrejmirtes
Copy link
Member

Yes, makes a ton of sense, thank you :)

@ondrejmirtes ondrejmirtes merged commit 0e567c4 into phpstan:1.7.x May 5, 2022
@ondrejmirtes
Copy link
Member

BTW Doesn't ParametersAcceptorSelector::hasAcceptorTemplateOrConditionalType() need updating for all late-resolvable types? I'm not sure... (It's an optimization so that this block of code isn't called and some time is saved by not getting the arg types):

		foreach ($args as $i => $arg) {
			$type = $scope->getType($arg->value);
			$index = $arg->name !== null ? $arg->name->toString() : $i;
			if ($arg->unpack) {
				$unpack = true;
				$types[$index] = $type->getIterableValueType();
			} else {
				$types[$index] = $type;
			}

@rvanvelzen
Copy link
Contributor Author

It should be fine right now because value-of and key-of are not resolvable if they contain a template type which is already checked. For simplicity and future-proofing it could be changed to just look for LateResolvableType instead.

@rvanvelzen rvanvelzen deleted the value-of branch May 5, 2022 13:10
@ondrejmirtes
Copy link
Member

Alright, done: 38198f1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants