Skip to content

Implement @phpstan-allow-private-mutation#1610

Merged
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
zonuexe:feature/psalm-readonly-allow-private-mutation
Sep 27, 2022
Merged

Implement @phpstan-allow-private-mutation#1610
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
zonuexe:feature/psalm-readonly-allow-private-mutation

Conversation

@zonuexe
Copy link
Copy Markdown
Contributor

@zonuexe zonuexe commented Aug 11, 2022

resolve phpstan/phpstan#7778, refs #1609

@zonuexe zonuexe changed the title Feature/psalm readonly allow private mutation Implement @phpstan-allow-private-mutation Aug 11, 2022
@zonuexe
Copy link
Copy Markdown
Contributor Author

zonuexe commented Aug 11, 2022

ReadOnlyByPhpDocPropertyAssignRuleTest alone will pass with e2d9db8fc29efb52a847de6df704b7a540c0331e patch, but you probably need to rethink how ResolvedPhpDocBlock::$phpDocNode is initialized.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Error: Property PHPStan\PhpDoc\ResolvedPhpDocBlock::$phpDocNode (PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode) in isset() is not nullable.
Error: Property PHPStan\PhpDoc\ResolvedPhpDocBlock::$phpDocNodeResolver (PHPStan\PhpDoc\PhpDocNodeResolver) in isset() is not nullable.
 ------ ------------------------------------------------------------------ 
  Line   src/PhpDoc/ResolvedPhpDocBlock.php                                
 ------ ------------------------------------------------------------------ 
  225    Property PHPStan\PhpDoc\ResolvedPhpDocBlock::$phpDocNode          
         (PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode) in isset() is not    
         nullable.                                                         
  [24](https://github.com/phpstan/phpstan-src/actions/runs/3044344145/jobs/4904629542#step:11:25)3    Property PHPStan\PhpDoc\ResolvedPhpDocBlock::$phpDocNodeResolver  
         (PHPStan\PhpDoc\PhpDocNodeResolver) in isset() is not nullable.   
 ------ ------------------------------------------------------------------

https://github.com/phpstan/phpstan-src/actions/runs/3044344145/jobs/4904629542#step:11:9

@zonuexe
Copy link
Copy Markdown
Contributor Author

zonuexe commented Sep 13, 2022

@ondrejmirtes Could you please review this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi, you¨re adding a simple boolean value which there are already many present. These changes to phpDocNode and phpDocNodeResolver are not required to make this work, and cause these build failures.

If the PR doesn't work without these changes, please observe how different boolean values are handled here, it shouldn't be hard to make them work.

@zonuexe
Copy link
Copy Markdown
Contributor Author

zonuexe commented Sep 25, 2022

Sorry, I accidentally submitted a re-review. Ignore it for once.

@ondrejmirtes
Copy link
Copy Markdown
Member

I've updated the PR with the correct fix.

@ondrejmirtes ondrejmirtes merged commit ea87e95 into phpstan:1.8.x Sep 27, 2022
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you.

@zonuexe zonuexe deleted the feature/psalm-readonly-allow-private-mutation branch January 12, 2023 11:10
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.

@readonly property allows private mutation

2 participants