-
Notifications
You must be signed in to change notification settings - Fork 28
Case insensitive method names #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tomzx
merged 25 commits into
tomzx:master
from
semver-sentry:case-insensitive-method-names
Feb 22, 2018
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
e6cb7e2
Dont treat case changes in method names as breaking
emmetog 4f565b6
Change indentation to tabs
emmetog a382291
Add some tests for Signature comparator
emmetog 63f11e9
Detect method name case changes
emmetog d2418c3
Make renaming method case a PATCH change
emmetog 6424295
Remove commented var_dump
emmetog 5b091f4
Detect interface case name changes as PATCH
emmetog d0191d8
Revert Signature::analyze
emmetog b9de798
Detect case only name change for Traits
emmetog 558aaae
Detect case only name changes for Classes
emmetog f8e54b3
Add rule for trait renamed case only
emmetog e1d49be
Split method and trait rename into visibility
emmetog 9ca9220
Add tests for all visibilities of case change
emmetog 50b291d
Merge branch 'master' into case-insensitive-method-names
emmetog e527747
Interface operation extend from Delta
emmetog 596646c
Rename $mappingsBeforeKeyed to $filesBeforeKeyed
emmetog 0c24711
Remove unneccessary compare of lowercase names
emmetog d49730c
Remove empty line
emmetog a15c6b7
Make ClassMethodRenamedCaseOnly extend Delta
emmetog fbdb940
Make TraitRenamedCaseOnly extend Delta
emmetog d672b2d
Spaces to tabs
emmetog ce3e042
Rename test methods
emmetog 667e0be
Detect function renaming too
emmetog e50e738
Rename all operations to CaseChanged
emmetog 931d81f
Use case changed instead of rename in rule names
emmetog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Detect case only name change for Traits
- Loading branch information
commit b9de798637ce956ccffe15a70d481765ef67cf2c
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,59 @@ | ||
<?php | ||
|
||
namespace PHPSemVerChecker\Operation; | ||
|
||
use PhpParser\Node\Stmt\Trait_; | ||
use PHPSemVerChecker\Node\Statement\Trait_ as PTrait; | ||
|
||
class TraitRenamedCaseOnly extends Operation { | ||
/** | ||
* @var string | ||
*/ | ||
protected $code = 'V152'; | ||
/** | ||
* @var string | ||
*/ | ||
protected $reason = 'Trait was renamed (case only).'; | ||
/** | ||
* @var string | ||
*/ | ||
protected $fileAfter; | ||
/** | ||
* @var \PhpParser\Node\Stmt\Trait_ | ||
*/ | ||
protected $traitAfter; | ||
|
||
/** | ||
* @param string $fileAfter | ||
* @param \PhpParser\Node\Stmt\Trait_ $traitAfter | ||
*/ | ||
public function __construct($fileAfter, Trait_ $traitAfter) | ||
{ | ||
$this->fileAfter = $fileAfter; | ||
$this->traitAfter = $traitAfter; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getLocation() | ||
{ | ||
return $this->fileAfter; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getLine() | ||
{ | ||
return $this->traitAfter->getLine(); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getTarget() | ||
{ | ||
return PTrait::getFullyQualifiedName($this->traitAfter); | ||
} | ||
} |
This file contains hidden or 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 |
---|---|---|
|
@@ -62,4 +62,23 @@ public function testTraitAdded() | |
$this->assertSame('Trait was added.', $report[$context][$expectedLevel][0]->getReason()); | ||
$this->assertSame('tmp', $report[$context][$expectedLevel][0]->getTarget()); | ||
} | ||
|
||
public function testTraitRenamedCaseOnly() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method name should be |
||
{ | ||
$before = new Registry(); | ||
$after = new Registry(); | ||
|
||
$before->addTrait(new Trait_('testTRAIT')); | ||
$after->addTrait(new Trait_('testtrait')); | ||
|
||
$analyzer = new TraitAnalyzer(); | ||
$report = $analyzer->analyze($before, $after); | ||
|
||
$context = 'trait'; | ||
$expectedLevel = Level::PATCH; | ||
Assert::assertDifference($report, $context, $expectedLevel); | ||
$this->assertSame('V152', $report[$context][$expectedLevel][0]->getCode()); | ||
$this->assertSame('Trait was renamed (case only).', $report[$context][$expectedLevel][0]->getReason()); | ||
$this->assertSame('testtrait', $report[$context][$expectedLevel][0]->getTarget()); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a delta operation.