Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 14, 2025

@staabm staabm marked this pull request as ready for review August 14, 2025 20:16
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

Copy link
Member

@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.

  1. This doesn't have to be limited to properties
  2. This doesn't have to be limited to PHP versions with native standalone true/false types support. We have PHPDocs after all.

There are many TooWide* rules with duplicated logic and maybe some variances in the logic. First we should refactor and deduplicate the logic where possible.

Then we could introduce a new bleeding edge toggle to enable reporting "too wide bool".

@staabm staabm force-pushed the bug13384 branch 2 times, most recently from 03b3159 to 59c672f Compare August 30, 2025 10:07
@@ -440,11 +440,13 @@ public function testBug4715(): void
public function testBug4734(): void
{
$errors = $this->runAnalyse(__DIR__ . '/data/bug-4734.php');
$this->assertCount(3, $errors);
$this->assertCount(5, $errors); // could be 3
Copy link
Contributor Author

@staabm staabm Aug 30, 2025

Choose a reason for hiding this comment

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

this is a topic for a followup: NodeScopeResolver's ClassStatementsGatherer works on a per class level, which means access to private properties from a closure-scope (from within a different class) are not seen when analyzing the class which declares the property

@staabm
Copy link
Contributor Author

staabm commented Aug 30, 2025

I think we are good to go

@@ -11,8 +11,10 @@
class LogicalXorConstantConditionRuleTest extends RuleTestCase
{

/** @var true */
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than adding @var true I wonder

  • If we should a test with false
  • If we should just remove the var

Same for others...

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.

never written static private property in final class not detected
4 participants