Skip to content

Commit

Permalink
Merge branch '2.16'
Browse files Browse the repository at this point in the history
* 2.16:
  NoUnsetOnPropertyFixer - risky description tweaks
  • Loading branch information
SpacePossum committed Sep 16, 2020
2 parents 7e974d5 + 23ec312 commit 33a5be0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
token:
secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
file: php-cs-fixer.phar
cleanup : false
cleanup: false
on:
repo: FriendsOfPHP/PHP-CS-Fixer
tags: true
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ Choose from the list of available rules:

Properties should be set to ``null`` instead of using ``unset``.

*Risky rule: changing variables to ``null`` instead of unsetting them will mean they still show up when looping over class variables. With PHP 7.4, this rule might introduce ``null`` assignments to property whose type declaration does not allow it.*
*Risky rule: risky when relying on attributes to be removed using ``unset`` rather than be set to ``null``. Changing variables to ``null`` instead of unsetting means these still show up when looping over class variables and reference properties remain unbroken. With PHP 7.4, this rule might introduce ``null`` assignments to properties whose type declaration does not allow it.*

* **no_unused_imports** [@Symfony, @PhpCsFixer]

Expand Down
4 changes: 3 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


UPGRADE GUIDE FROM 1.x to 2.0
=============================

Expand All @@ -12,7 +14,7 @@ Default ruleset was changed from Symfony standard to more generic PSR2. You can
The term of risky fixers was introduced. Risky fixer is a fixer that may change the meaning of code (like `StrictComparisonFixer` fixer, which will change `==` into `===`). No rules that are followed by risky fixers are run by default. You need to explicitly permit risky fixers to run them.

Default configuration changes
----------------------------
-----------------------------
By default, PSR2 rules are used instead of Symfony rules.
Files that will be fixed are php/phpt/twig instead of php/twig/xml/yml.
Finally, the caching mechanism is enabled by default.
Expand Down
7 changes: 4 additions & 3 deletions src/Fixer/LanguageConstruct/NoUnsetOnPropertyFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ public function getDefinition()
'Properties should be set to `null` instead of using `unset`.',
[new CodeSample("<?php\nunset(\$this->a);\n")],
null,
'Changing variables to `null` instead of unsetting them will mean they still show up '.
'when looping over class variables. With PHP 7.4, this rule might introduce `null` assignments to '.
'property whose type declaration does not allow it.'
'Risky when relying on attributes to be removed using `unset` rather than be set to `null`.'.
' Changing variables to `null` instead of unsetting means these still show up when looping over class variables'.
' and reference properties remain unbroken.'.
' With PHP 7.4, this rule might introduce `null` assignments to properties whose type declaration does not allow it.'
);
}

Expand Down

0 comments on commit 33a5be0

Please sign in to comment.