Skip to content

Commit 0c24711

Browse files
committed
Remove unneccessary compare of lowercase names
1 parent 596646c commit 0c24711

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/PHPSemVerChecker/Analyzer/ClassMethodAnalyzer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ public function analyze(Stmt $contextBefore, Stmt $contextAfter)
9393
if ($methodBefore != $methodAfter) {
9494

9595
// Detect method renamed case only.
96-
if(
97-
$methodBefore->name !== $methodAfter->name
98-
&& strtolower($methodBefore->name) === strtolower($methodAfter->name)
99-
) {
96+
// If we entered this section then the normalized names (lowercase) were equal.
97+
if($methodBefore->name !== $methodAfter->name) {
10098
$report->add($this->context, new ClassMethodRenamedCaseOnly($this->context, $this->fileAfter, $contextAfter, $methodAfter));
10199
}
102100

src/PHPSemVerChecker/Analyzer/InterfaceAnalyzer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
6868
if ($interfaceBefore != $interfaceAfter) {
6969

7070
// Check if the name of the interface has changed case.
71+
// If we entered this section then the normalized names (lowercase) were equal.
7172
if ($interfaceBefore->name !== $interfaceAfter->name) {
7273
$report->add(
7374
'interface',

src/PHPSemVerChecker/Analyzer/TraitAnalyzer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ public function analyze(Registry $registryBefore, Registry $registryAfter)
6868
if ($traitBefore != $traitAfter) {
6969

7070
// Check for name case change.
71-
if(
72-
$traitBefore->name !== $traitAfter->name
73-
&& strtolower($traitBefore->name) === strtolower($traitAfter->name)
74-
) {
71+
// If we entered this section then the normalized names (lowercase) were equal.
72+
if($traitBefore->name !== $traitAfter->name) {
7573
$report->add($this->context, new TraitRenamedCaseOnly($fileAfter, $traitAfter));
7674
}
7775

0 commit comments

Comments
 (0)