-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'meaningful' checks to php (#114)
Add 'meaningful' checks to php (#114) Part of #110 We do not look for "redundant" overrides as with class names etc it can be quite hard. We'll filter out comments/whitespace etc which should do a good job anyway. (This is inline with the issue as it was raised #85) For ignoring non-meaningful changes these are split into two groups - Preferences/Plugins - Downgrade from `WARN` to `IGNR` if the change is identified as non-meaningful. - Setup/Schema/Etc - Do not even run the check, because they are `INFO` level anyway just ignore them and remove from the report entirely. For example ``` | IGNR | Preference | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndIgnore.php | Ampersand\Test\Model\ToPreferenceAndIgnore | ``` In this case `vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndIgnore.php` had some whitespace/comment style change, and theres no need to report you have a preference of `Ampersand\Test\Model\ToPreferenceAndIgnore` defined.
- Loading branch information
1 parent
a894a50
commit 470ba5e
Showing
26 changed files
with
255 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
dev/TestModule/app/code/Ampersand/Test/Model/ToPreferenceAndIgnore.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
namespace Ampersand\Test\Model; | ||
|
||
class ToPreferenceAndIgnore | ||
{ | ||
} |
10 changes: 10 additions & 0 deletions
10
dev/TestModule/app/code/Ampersand/Test/Plugin/ToPluginAndIgnore.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Ampersand\Test\Plugin; | ||
|
||
class ToPluginAndIgnore | ||
{ | ||
public function beforeSuperCool($subject) | ||
{ | ||
// do stuff | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
dev/TestVendorModule/src/module/Model/ToPluginAndIgnore.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Ampersand\TestVendor\Model; | ||
|
||
class ToPluginAndIgnore | ||
{ | ||
public function superCool() | ||
{ | ||
return '1234'; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
dev/TestVendorModule/src/module/Model/ToPreferenceAndIgnore.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace Ampersand\TestVendor\Model; | ||
|
||
class ToPreferenceAndIgnore | ||
{ | ||
// Dummy class to be overridden | ||
} |
20 changes: 20 additions & 0 deletions
20
dev/TestVendorModule/src/module/Setup/Patch/Data/SomeDataNonChanges.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace Ampersand\TestVendor\Setup\Patch\Data; | ||
|
||
class SomeDataNonChanges implements \Magento\Framework\Setup\Patch\DataPatchInterface | ||
{ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
|
||
public static function getDependencies() | ||
{ | ||
return []; | ||
} | ||
|
||
public function apply() | ||
{ | ||
return $this; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
dev/TestVendorModule/src/module/Setup/Patch/Schema/SomeSchemaNonChanges.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace Ampersand\TestVendor\Setup\Patch\Schema; | ||
|
||
class SomeSchemaNonChanges implements \Magento\Framework\Setup\Patch\SchemaPatchInterface | ||
{ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
|
||
public static function getDependencies() | ||
{ | ||
return []; | ||
} | ||
|
||
public function apply() | ||
{ | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
dev/phpunit/unit/resources/patchfile/sanitiser/php/FooBarBaz.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
// Some comment | ||
namespace Foo\Bar; | ||
|
||
/** | ||
* yup | ||
* yip | ||
* yap | ||
*/ | ||
class Baz { | ||
// | ||
// | ||
// | ||
/** | ||
* @param $here | ||
* @return void | ||
*/ | ||
private function foobar() { | ||
// some internal | ||
/* | ||
asdf | ||
*/ | ||
$b=1; | ||
/** | ||
* comment | ||
*/ | ||
} | ||
|
||
/** | ||
* @param there | ||
* comment | ||
*/ | ||
private function asdfasdf() { | ||
|
||
} | ||
|
||
} // |
17 changes: 17 additions & 0 deletions
17
dev/phpunit/unit/resources/patchfile/sanitiser/php/FooBarBazExpected.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
namespace Foo\Bar; | ||
class Baz { | ||
/** | ||
* @param $here | ||
* @return void | ||
*/ | ||
private function foobar() { | ||
$b=1; | ||
} | ||
/** | ||
* @param there | ||
* comment | ||
*/ | ||
private function asdfasdf() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.