[PR #514] [CLOSED] Improved exception when a type hint class can not be found #8312

Closed
opened 2026-01-22 15:59:20 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/514
Author: @arnaud-lb
Created: 11/14/2012
Status: Closed

Base: 2.3Head: clearer-exception


📝 Commits (1)

  • d0e15b1 Improved exception when a type hint class can not be found

📊 Changes

3 files changed (+44 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/Proxy/ProxyException.php (+9 -0)
📝 lib/Doctrine/ORM/Proxy/ProxyFactory.php (+13 -1)
📝 tests/Doctrine/Tests/ORM/Proxy/ProxyClassGeneratorTest.php (+22 -0)

📄 Description

This improves the exception message when a type hint class was not found during the generation of a proxy.

Example:

<?php
class Foo
{
    function test(\InvalidClass $param) 
    {
    }
}

When generating a proxy for this class Foo, if the type hint class InvalidClass cannot be found, a ReflectionException exception is thrown with the following message: Class InvalidClass does not exist. There is no hint on the real cause of the error (which class, method, ...).

This PR wraps this exception with a message making the cause of the exception more obvious.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/514 **Author:** [@arnaud-lb](https://github.com/arnaud-lb) **Created:** 11/14/2012 **Status:** ❌ Closed **Base:** `2.3` ← **Head:** `clearer-exception` --- ### 📝 Commits (1) - [`d0e15b1`](https://github.com/doctrine/orm/commit/d0e15b104251213cfdad2a65eb8e7b5627c85941) Improved exception when a type hint class can not be found ### 📊 Changes **3 files changed** (+44 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Proxy/ProxyException.php` (+9 -0) 📝 `lib/Doctrine/ORM/Proxy/ProxyFactory.php` (+13 -1) 📝 `tests/Doctrine/Tests/ORM/Proxy/ProxyClassGeneratorTest.php` (+22 -0) </details> ### 📄 Description This improves the exception message when a type hint class was not found during the generation of a proxy. Example: ``` php <?php class Foo { function test(\InvalidClass $param) { } } ``` When generating a proxy for this class `Foo`, if the type hint class `InvalidClass` cannot be found, a `ReflectionException` exception is thrown with the following message: `Class InvalidClass does not exist`. There is no hint on the real cause of the error (which class, method, ...). This PR wraps this exception with a message making the cause of the exception more obvious. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:59:20 +01:00
admin closed this issue 2026-01-22 15:59:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8312