Skip to content

Commit 63d7ca9

Browse files
committed
[#7] Adding private class/trait methods should generated a PATCH level.
Adding/Removing traits public/protected method should generate a MAJOR level. Adding public/protected class methods should generate a MAJOR level.
1 parent 4202976 commit 63d7ca9

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

docs/Ruleset.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ V010 | MAJOR | Class public method parameter changed
2323
V011 | MAJOR | Class protected method parameter changed
2424
V012 | MAJOR | *New public constructor (does not match supertype)*
2525
V013 | MAJOR | *New protected constructor (does not match supertype)*
26+
V015 | MAJOR | Class public method added
27+
V016 | MAJOR | Class protected method added
2628
V014 | MINOR | Class added
27-
V015 | MINOR | Class public method added *(display a notice that the method may overlap)* (MAJOR when not final)
28-
V016 | MINOR | Class protected method added *(display a notice that the method may overlap)* (MAJOR when not final)
2929
V017 | MINOR | *Final class public method added*
3030
V018 | MINOR | *Final class protected method added*
3131
V019 | MINOR | *Class public property added*
3232
V020 | MINOR | *Class protected property added*
33-
V021 | MINOR | Class protected method parameter changed *(MAJOR when not final)*
34-
V022 | MAJOR | *Final class protected method removed*
33+
V021 | MINOR | *Final class protected method parameter changed*
34+
V022 | PATCH | *Final class protected method removed*
3535
V023 | PATCH | [Final] Class public class method implementation changed
3636
V024 | PATCH | [Final] Class protected class method implementation changed
3737
V025 | PATCH | [Final] Class private class method implementation changed
@@ -69,19 +69,19 @@ V042 | MAJOR | Trait public method parameter changed
6969
V043 | MAJOR | Trait protected method parameter changed
7070
V044 | MAJOR | *New public constructor (does not match supertype)*
7171
V045 | MAJOR | *New protected constructor (does not match supertype)*
72+
V047 | MAJOR | Trait public method added
73+
V048 | MAJOR | Trait protected method added
74+
V049 | MAJOR | *Trait public property added*
75+
V050 | MAJOR | *Trait protected property added*
76+
V055 | MAJOR | *Trait private property added*
77+
V056 | MAJOR | *Trait private property removed*
78+
V057 | MAJOR | Trait private method added
79+
V058 | MAJOR | Trait private method removed
7280
V046 | MINOR | Trait added
73-
V047 | MINOR | Trait public method added *(display a notice that the method may overlap)* (MAJOR when not final)
74-
V048 | MINOR | Trait protected method added *(display a notice that the method may overlap)* (MAJOR when not final)
75-
V049 | MINOR | *Trait public property added*
76-
V050 | MINOR | *Trait protected property added*
7781
V051 | MINOR | *REMOVED*
7882
V052 | PATCH | Trait public method implementation changed
7983
V053 | PATCH | Trait protected method implementation changed
8084
V054 | PATCH | Trait private method implementation changed
81-
V055 | PATCH | *Trait private property added*
82-
V056 | PATCH | *Trait private property removed*
83-
V057 | PATCH | Trait private method added
84-
V058 | PATCH | Trait private method removed
8585
V059 | PATCH | Trait private method parameter changed
8686
V064 | PATCH | Trait public method parameter name changed
8787
V065 | PATCH | Trait protected method parameter name changed

src/PHPSemVerChecker/Operation/ClassMethodAdded.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class ClassMethodAdded extends ClassMethodOperation {
1919
* @var int
2020
*/
2121
protected $level = [
22-
'class' => [Level::MINOR, Level::MINOR, Level::MINOR],
22+
'class' => [Level::MAJOR, Level::MAJOR, Level::PATCH],
2323
'interface' => [Level::MAJOR],
24-
'trait' => [Level::MINOR, Level::MINOR, Level::MINOR],
24+
'trait' => [Level::MAJOR, Level::MAJOR, Level::MAJOR],
2525
];
2626
/**
2727
* @var string

src/PHPSemVerChecker/Operation/ClassMethodRemoved.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ClassMethodRemoved extends ClassMethodOperation {
2222
protected $level = [
2323
'class' => [Level::MAJOR, Level::MAJOR, Level::PATCH],
2424
'interface' => [Level::MAJOR],
25-
'trait' => [Level::MAJOR, Level::MAJOR, Level::PATCH],
25+
'trait' => [Level::MAJOR, Level::MAJOR, Level::MAJOR],
2626
];
2727
/**
2828
* @var string

tests/PHPSemVerChecker/Analyzer/ClassMethodAnalyzerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public function testV015ClassMethodAdded()
6464
$analyzer = new ClassMethodAnalyzer('class');
6565
$report = $analyzer->analyze($classBefore, $classAfter);
6666

67-
Assert::assertDifference($report, 'class', Level::MINOR);
68-
$this->assertSame('Method has been added.', $report['class'][Level::MINOR][0]->getReason());
69-
$this->assertSame('tmp::tmpMethod', $report['class'][Level::MINOR][0]->getTarget());
67+
Assert::assertDifference($report, 'class', Level::MAJOR);
68+
$this->assertSame('Method has been added.', $report['class'][Level::MAJOR][0]->getReason());
69+
$this->assertSame('tmp::tmpMethod', $report['class'][Level::MAJOR][0]->getTarget());
7070
}
7171

7272
public function testSimilarClassMethodSignature()

tests/PHPSemVerChecker/Analyzer/TraitMethodAnalyzerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public function testV047PublicClassMethodAdded()
5656
$analyzer = new ClassMethodAnalyzer('trait');
5757
$report = $analyzer->analyze($traitBefore, $traitAfter);
5858

59-
Assert::assertDifference($report, 'trait', Level::MINOR);
60-
$this->assertSame('Method has been added.', $report['trait'][Level::MINOR][0]->getReason());
61-
$this->assertSame('tmp::tmpMethod', $report['trait'][Level::MINOR][0]->getTarget());
59+
Assert::assertDifference($report, 'trait', Level::MAJOR);
60+
$this->assertSame('Method has been added.', $report['trait'][Level::MAJOR][0]->getReason());
61+
$this->assertSame('tmp::tmpMethod', $report['trait'][Level::MAJOR][0]->getTarget());
6262
}
6363

6464
public function testSimilarPublicClassMethodSignature()

tests/fixtures/after/FunctionParameterNameChanged.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace fixtures;
44

5-
function functionParameterChanged($someOtherParameterName)
5+
function functionParameterNameChanged($someOtherParameterName)
66
{
77

88
}

tests/fixtures/before/FunctionParameterNameChanged.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace fixtures;
44

5-
function functionParameterChanged($someParameter)
5+
function functionParameterNameChanged($someParameter)
66
{
77

88
}

0 commit comments

Comments
 (0)