The Dispose pattern (see [0]) can be useful when dealing with persistent resources that need to be freed, closed or cleaned-up. A common mistake is to forget to run this clean-up operation, or to miss it when an exception is thrown, or when a certain branch of the program is taken. The dispose pattern helps with those mistakes by ensuring that the clean-up operation is always done at the end of a function.
TypeScript 5.2 (see [1]) introduced it at the language-level. It would be useful to have it also in PHP (at a library-level however). For example, it could help us with database integration tests: it is easy to forget cleaning up data, and since the same database is shared by all tests, it can quickly lead to flaky tests.
[0] https://en.wikipedia.org/wiki/Dispose_pattern
[1] https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management