Skip to content

Document error identifiers#14154

Merged
ondrejmirtes merged 4 commits into2.2.xfrom
document-error-identifiers-batch-8c9f3d83510b5a73
Feb 18, 2026
Merged

Document error identifiers#14154
ondrejmirtes merged 4 commits into2.2.xfrom
document-error-identifiers-batch-8c9f3d83510b5a73

Conversation

@ondrejmirtes
Copy link
Member

No description provided.

Copy link
Member Author

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phpstan-bot Check the review. also please update doctrine.finalEntity.md. Check phpstan/phpstan-doctrine#667 and phpstan/phpstan-doctrine#724 and tell the user how can they keep their entity final.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description and example are wrong. Please read https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type. Also update other *.unresolvableType.md docs here.

@phpstan-bot
Copy link
Contributor

phpstan-bot commented Feb 18, 2026

Claude finished @ondrejmirtes's task in 8m 54s —— View job


Changes pushed

  • Fix argument.unresolvableType.md — rewrote description and example based on the blog post: the error is about calling a generic function where PHPStan can't resolve the template type from arguments (e.g. passing mixed instead of a specific array type), not about a generic class used without type parameters
  • Update callable.unresolvableReturnType.md — added blog post link and clarified the description
  • Update doctrine.finalEntity.md — added second fix option: users on Doctrine ORM 2.11+ or 3.0+ can keep their entity final by adding the #[AllowFinalEntity] attribute from phpstan-doctrine (based on #667 and #724)
  • Commit and push

The other *.unresolvableType.md files in this PR (mixin.unresolvableType.md, property.unresolvableType.md) describe different error scenarios (invalid types in PHPDoc tags rather than template resolution from arguments) and their descriptions looked accurate, so no changes were made to those.
|

- Fix argument.unresolvableType.md: correct description and example to
  match the blog post about template type resolution from arguments
- Add blog post link to callable.unresolvableReturnType.md
- Update doctrine.finalEntity.md with AllowFinalEntity attribute option

Co-authored-by: Ondřej Mirtes <ondrejmirtes@users.noreply.github.com>
Copy link
Member Author

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a hallucination. Talk more about how Doctrine can be configured to enable this.: https://www.doctrine-project.org/2025/06/28/orm-3.4.0-released.html

Also the ghost object mention from 2.11 is not true in this case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no such attribute ffs


In the example above, `firstOrNull` expects `T[]` so that it can resolve `T`. When `mixed` is passed instead of a specific array type, PHPStan cannot determine what `T` is. To prevent `mixed` from being propagated further, PHPStan reports this error and asks for a more specific argument.

Learn more: [Solving PHPStan error "Unable to resolve the template type"](/blog/solving-phpstan-error-unable-to-resolve-template-type)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful. Please search for more *.unresolvableType.md files (they might be pre-existing, not part of this PR) and also change the examples to similar ones like here, but relevant to the identifier.

@phpstan-bot
Copy link
Contributor

phpstan-bot commented Feb 18, 2026

Claude finished @ondrejmirtes's task in 15m 3s —— View job


Changes pushed

  • Fix doctrine.finalEntity.md — removed the hallucinated #[AllowFinalEntity] attribute and the incorrect ghost object claim from ORM 2.11. Replaced with info about Doctrine ORM 3.4 lazy ghost objects (linking to the 3.4.0 release post), setLazyGhostObjectEnabled(true) for older 3.x versions, and a reference to phpstan-doctrine configuration
  • Update all *.unresolvableType.md files with improved examples — replaced abstract Foo/Bar class names with realistic ones (Validator, Config, Repository, Collection, UserService, QueryBuilder, ServiceContainer, DataContainer), added clearer explanations of why the types are unresolvable
    • mixin.unresolvableType.md
    • property.unresolvableType.md
    • selfOut.unresolvableType.md
    • assert.unresolvableType.md
    • classConstant.unresolvableType.md
    • methodTag.unresolvableType.md
    • propertyTag.unresolvableType.md
    • return.unresolvableType.md
    • typeAlias.unresolvableType.md
  • Commit and push

Note: parameter.unresolvableType.md and varTag.unresolvableType.md were left as-is since they already had good realistic examples (Collection with T<int> and $value with string&int).

I was unable to access the phpstan-doctrine repo or the Doctrine ORM 3.4.0 blog post due to tool permission restrictions, so I couldn't verify the exact phpstan-doctrine configuration parameter name. The doctrine.finalEntity.md doc directs users to the phpstan-doctrine documentation for the specific config option rather than guessing a parameter name.

phpstan-bot and others added 2 commits February 18, 2026 11:24
- doctrine.finalEntity.md: Removed hallucinated #[AllowFinalEntity] attribute
  and incorrect ghost object claim from ORM 2.11. Replaced with Doctrine ORM 3.4
  lazy ghost objects info and phpstan-doctrine configuration reference.
- Updated all *.unresolvableType.md files with more realistic examples:
  improved class/method names and clearer explanations.

Co-authored-by: Ondřej Mirtes <ondrejmirtes@users.noreply.github.com>
Removed unnecessary instructions for phpstan-doctrine configuration.
@ondrejmirtes ondrejmirtes merged commit 14b607b into 2.2.x Feb 18, 2026
2 of 3 checks passed
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

Comments