### Get Triggered Deprecations Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Retrieves all triggered deprecations and their individual counts when tracking is enabled. This provides insight into how many times each deprecation message has been triggered. ```php $deprecations = \Doctrine\Deprecations\Deprecation::getTriggeredDeprecations(); foreach ($deprecations as $identifier => $count) { echo $identifier . " was triggered " . $count . " times\n"; } ``` -------------------------------- ### Enable Deprecations with PSR3 Logger Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Enables Doctrine deprecations to be sent to a PSR3 logger. This is the recommended approach for libraries. ```php \Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger); ``` -------------------------------- ### PHPUnit Configuration for Deprecations Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Configures PHPUnit to display deprecations triggered during test execution and to fail the test suite if deprecations occur. It also sets an environment variable to ensure native PHP deprecations are used and ignores deprecation suppression in source code. ```xml src ``` -------------------------------- ### PHPUnit Configuration with Custom Bootstrap Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Updates the PHPUnit configuration to use a custom bootstrap file (`tests/bootstrap.php`) which can be used to configure deprecation handling, such as disabling deduplication. ```xml ``` -------------------------------- ### Enable Deprecation Tracking Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Enables deprecation tracking without logging or calling trigger_error. This mode can be combined with other modes. It can also be controlled via the DOCTRINE_DEPRECATIONS environment variable set to 'track'. ```php \Doctrine\Deprecations\Deprecation::enableTrackingDeprecations(); ``` -------------------------------- ### Disable Deprecation Deduplication in PHPUnit Bootstrap Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md A PHP bootstrap file for PHPUnit that disables the deduplication of deprecations. This ensures that every deprecation is reported, even if it occurs multiple times. The file requires the autoloader and then calls `Deprecation::withoutDeduplication()`. ```php // tests/bootstrap.php expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234'); triggerTheCodeWithDeprecation(); } } ``` -------------------------------- ### Disable Deprecation Tracking Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Disables all forms of deprecation tracking, logging, and triggering. This effectively turns off the deprecation layer. ```php \Doctrine\Deprecations\Deprecation::disable(); ``` -------------------------------- ### Trigger Deprecation (Producer) Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Unconditionally triggers a deprecation message. This method is intended for library producers to signal deprecations to consumers. Variable arguments are used with sprintf on the message. ```php \Doctrine\Deprecations\Deprecation::trigger( "doctrine/orm", "https://link/to/deprecations-description", "message" ); ``` ```php \Doctrine\Deprecations\Deprecation::trigger( "doctrine/orm", "https://github.com/doctrine/orm/issue/1234", "message %s %d", "foo", 1234 ); ``` -------------------------------- ### PHPUnit Test - Expect No Deprecation Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Uses the VerifyDeprecations trait to assert that a specific deprecation message is NOT triggered during a test. This is useful for verifying that fixes have been applied. ```php use Doctrine\Deprecations\PHPUnit\VerifyDeprecations; class MyTest extends TestCase { use VerifyDeprecations; public function testSomethingDeprecationFixed() { $this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234'); triggerTheCodeWithoutDeprecation(); } } ``` -------------------------------- ### Enable Deprecations with trigger_error Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Enables Doctrine deprecations to be sent as @trigger_error(E_USER_DEPRECATED) messages. This can also be controlled via the DOCTRINE_DEPRECATIONS environment variable set to 'trigger'. ```php \Doctrine\Deprecations\Deprecation::enableWithTriggerError(); ``` -------------------------------- ### Ignore Specific Deprecations Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Disables triggering of specific deprecation messages identified by a URL. This is useful for suppressing known deprecations. ```php \Doctrine\Deprecations\Deprecation::ignoreDeprecations("https://link/to/deprecations-description-identifier"); ``` -------------------------------- ### Trigger Deprecation If Called From Outside (Producer) Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Triggers a deprecation message only when the call originates from outside the current package. This prevents a library from deprecating its own internal calls. ```php \Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside( "doctrine/orm", "https://link/to/deprecations-description", "message" ); ``` -------------------------------- ### Disable Deprecation Deduplication Source: https://github.com/doctrine/deprecations/blob/1.1.x/README.md Disables the deduplication of deprecation messages. This is useful in testing environments like PHPUnit where multiple instances of the same deprecation might be intentionally triggered. ```php \Doctrine\Deprecations\Deprecation::withoutDeduplication(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.