Skip to content

Commit 5210c93

Browse files
committed
Merge pull request #25 from norzechowicz/naming
Deprecated PropertyMatcher and match function
2 parents f92fb38 + c24b5e6 commit 5210c93

File tree

9 files changed

+51
-38
lines changed

9 files changed

+51
-38
lines changed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"extra": {
3636
"branch-alias": {
37-
"dev-master": "1.1-dev"
37+
"dev-master": "1.2-dev"
3838
}
3939
}
4040
}

Diff for: match.php

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
);
1717
}
1818

19+
/**
20+
* @deprecated since 1.1, to be removed in 2.0. Use SimpleFactory and object approach instead
21+
*/
1922
if (!function_exists('match')) {
2023
/**
2124
* @param mixed $value

Diff for: src/Coduo/PHPMatcher/Matcher.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?php
22
namespace Coduo\PHPMatcher;
33

4-
use Coduo\PHPMatcher\Matcher\PropertyMatcher;
4+
use Coduo\PHPMatcher\Matcher\ValueMatcher;
55

66
class Matcher
77
{
88
/**
9-
* @var Matcher\PropertyMatcher
9+
* @var ValueMatcher
1010
*/
1111
private $matcher;
1212

1313
/**
14-
* @param PropertyMatcher $matcher
14+
* @param ValueMatcher $matcher
1515
*/
16-
public function __construct(PropertyMatcher $matcher)
16+
public function __construct(ValueMatcher $matcher)
1717
{
1818
$this->matcher = $matcher;
1919
}

Diff for: src/Coduo/PHPMatcher/Matcher/ArrayMatcher.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class ArrayMatcher extends Matcher
2020
private $accessor;
2121

2222
/**
23-
* @param PropertyMatcher $propertyMatcher
23+
* @param ValueMatcher $propertyMatcher
2424
*/
25-
public function __construct(PropertyMatcher $propertyMatcher)
25+
public function __construct(ValueMatcher $propertyMatcher)
2626
{
2727
$this->propertyMatcher = $propertyMatcher;
2828
}

Diff for: src/Coduo/PHPMatcher/Matcher/ChainMatcher.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
class ChainMatcher extends Matcher
88
{
99
/**
10-
* @var array|PropertyMatcher[]
10+
* @var array|ValueMatcher[]
1111
*/
1212
private $matchers;
1313

1414
/**
15-
* @param array|PropertyMatcher[] $matchers
15+
* @param array|ValueMatcher[] $matchers
1616
*/
1717
public function __construct(array $matchers = array())
1818
{
1919
$this->matchers = $matchers;
2020
}
2121

2222
/**
23-
* @param PropertyMatcher $matcher
23+
* @param ValueMatcher $matcher
2424
*/
25-
public function addMatcher(PropertyMatcher $matcher)
25+
public function addMatcher(ValueMatcher $matcher)
2626
{
2727
$this->matchers[] = $matcher;
2828
}

Diff for: src/Coduo/PHPMatcher/Matcher/JsonMatcher.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class JsonMatcher extends Matcher
1313
private $matcher;
1414

1515
/**
16-
* @param PropertyMatcher $matcher
16+
* @param ValueMatcher $matcher
1717
*/
18-
public function __construct(PropertyMatcher $matcher)
18+
public function __construct(ValueMatcher $matcher)
1919
{
2020
$this->matcher = $matcher;
2121
}

Diff for: src/Coduo/PHPMatcher/Matcher/Matcher.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Coduo\PHPMatcher\Matcher;
44

5-
abstract class Matcher implements PropertyMatcher
5+
abstract class Matcher implements ValueMatcher
66
{
77
/**
88
* @var string|null

Diff for: src/Coduo/PHPMatcher/Matcher/PropertyMatcher.php

+4-24
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,9 @@
22

33
namespace Coduo\PHPMatcher\Matcher;
44

5-
interface PropertyMatcher
5+
/**
6+
* @deprecated since 1.1, to be removed in 2.0. Use ValueMatcher instead
7+
*/
8+
interface PropertyMatcher extends ValueMatcher
69
{
7-
/**
8-
* Matches value against the pattern
9-
*
10-
* @param $value
11-
* @param $pattern
12-
* @return boolean
13-
*/
14-
public function match($value, $pattern);
15-
16-
/**
17-
* Checks if matcher can match the pattern
18-
*
19-
* @param $pattern
20-
* @return boolean
21-
*/
22-
public function canMatch($pattern);
23-
24-
/**
25-
* Returns a string description why matching failed
26-
*
27-
* @return null|string
28-
*/
29-
public function getError();
3010
}

Diff for: src/Coduo/PHPMatcher/Matcher/ValueMatcher.php

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Coduo\PHPMatcher\Matcher;
4+
5+
interface ValueMatcher
6+
{
7+
/**
8+
* Matches value against the pattern
9+
*
10+
* @param $value
11+
* @param $pattern
12+
* @return boolean
13+
*/
14+
public function match($value, $pattern);
15+
16+
/**
17+
* Checks if matcher can match the pattern
18+
*
19+
* @param $pattern
20+
* @return boolean
21+
*/
22+
public function canMatch($pattern);
23+
24+
/**
25+
* Returns a string description why matching failed
26+
*
27+
* @return null|string
28+
*/
29+
public function getError();
30+
}

0 commit comments

Comments
 (0)