phpstan-todo-by icon indicating copy to clipboard operation
phpstan-todo-by copied to clipboard

Deprecations that I trigger myself are reported

Open apfelbox opened this issue 1 year ago • 2 comments

Hi,

first up: really great library! Thanks for all your hard work, much appreciated.

So I have this code in my library:

if (!$this->strictIds)
{
	trigger_deprecation("...", "3.2.2", "Not setting strictIds when configuring the page tree is deprecated.");
}

But this gets reported when running PHPStan in this library:

 ------ --------------------------------------------------------------------------------------------------
  Line   src/PageTree/Builder/PageTreeConfig.php
 ------ --------------------------------------------------------------------------------------------------
  47     Since ... 3.2.2: Not setting strictIds when configuring the page tree is deprecated..
         🪪  todoBy.sfDeprecation
         ✏️  src/PageTree/Builder/PageTreeConfig.php
 ------ --------------------------------------------------------------------------------------------------

To be clear: that is not another code block that calls my code, but just the definition / triggering of a deprecation that gets reported.

apfelbox avatar Jun 05 '24 11:06 apfelbox

could you provide a full repro?

wheter a call to trigger_deprecation triggers a phpstan error depends on all the given arguments and additionally depends on your composer.json version constraints

staabm avatar Jun 11 '24 06:06 staabm

I have a repro, however while it's a fairly small library, it is not minimal.

But here goes:

  1. Checkout https://github.com/21TORR/RadBundle
  2. composer up && composer bin all up
  3. composer test

Should be green.

Now go to the ApiResponse and remove the lines https://github.com/21TORR/RadBundle/blob/3.x/src/Api/ApiResponse.php#L24 and line 38.

Rerun composer test.

I now get two issues:

Screenshot_2024-06-11_09 41 08

Hope that helps

apfelbox avatar Jun 11 '24 07:06 apfelbox