Skip to content

Commit a11daa5

Browse files
author
Norbert Orzechowicz
committed
Merge pull request #65 from norzechowicz/cleanup
Cleanup before stable release
2 parents ae724fd + c54376c commit a11daa5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+145
-188
lines changed

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# 2.0
2+
3+
* Added support for PHP7
4+
* Updated dependencies to support Symfony3 components
5+
* Added ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\MatchRegexTest`` expander - [email protected]
6+
* Added ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsEmpty`` expander - [email protected]
7+
* Added PHPMatcher facade in order to improve developers experience
8+
9+
10+
# 1.1
11+
12+
* Added pattern expanders mechanism with following expanders:
13+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\Contains``
14+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\EndsWith``
15+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\GreaterThan``
16+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\InArray``
17+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsDateTime``
18+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsEmail``
19+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsUrl``
20+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\LowerThan``
21+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\MatchRegex``
22+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\OneOf``
23+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\StartsWith``
24+
25+
# 1.0
26+
27+
* PHPMatcher initial release with following matchers:
28+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ArrayMatcher``
29+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\CallbackMatcher``
30+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\CaptureMatcher``
31+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ChainMatcher``
32+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ExpressionMatcher``
33+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\JsonMatcher``
34+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\NullMatcher``
35+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ScalarMatcher``
36+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\TypeMatcher``
37+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\WildcardMatcher``
38+
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\XmlMatcher``

CONTRIBUTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#A quick guide to contribute to the project:
2+
3+
##Installing the dev environment
4+
5+
1. Fork the repo
6+
2. Clone the repo to local
7+
3. Install dependencies: `composer update` (this assumes you have 'composer' aliased to whereever your composer.phar lives)
8+
4. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
9+
`./bin/phpunit`
10+
11+
##Coding Standards
12+
13+
Try use similar coding standards to what you see in the project to keep things clear to the contributors. If you're unsure, it's always a safe bet to fall-back to the PSR standards.
14+
15+
[PSR-1: Basic Coding Standard](http://www.php-fig.org/psr/psr-1/)
16+
17+
[PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/)
18+
19+
##Adding new features
20+
21+
Pull requests with new features needs to be created against master branch.
22+
23+
If new feature require BC Breake please note that in your PR comment, it will added in next major version.
24+
New features that does not have any BC Breakes are going to be added in next minor version.
25+
26+
##Patches and bugfixes
27+
28+
1. Check the oldest version that patch/bug fix can be applied.
29+
2. Create PR against that version
30+
31+
For example if you are fixing pattern expander that was introduced in version 1.1 make sure that PR with fix
32+
is created against version 1.1, not master or 2.0
33+
34+
##The actual contribution
35+
36+
1. Make the changes/additions to the code, committing often and making clear what you've done
37+
2. Make sure you write tests for your code, located in the folder structure `tests/Coduo/PHPMatcher/...`
38+
3. Run your tests (often and while coding): `./bin/phpunit`
39+
4. Create Pull Request on github to against proper branch

LICENCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014 Michal Dabrowski, Norbert Orzechowicz
1+
Copyright (c) 2014-2016 Michal Dabrowski, Norbert Orzechowicz
22

33
Permission is hereby granted, free of charge, to any person
44
obtaining a copy of this software and associated documentation

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ $match = $matcher->match("lorem ipsum dolor", "@string@")
5252
* ``isDateTime()``
5353
* ``isEmail()``
5454
* ``isUrl()``
55-
* ``notEmpty()``
5655
* ``isEmpty()``
56+
* ``isNotEmpty()``
5757
* ``lowerThan($boundry)``
5858
* ``greaterThan($boundry)``
5959
* ``inArray($value)``

UPGRADE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Upgrade from 1.1 to 2.0
2+
3+
* All classes are now marked as final in order to close extra extension points
4+
* ``Coduo\PHPMatcher\Matcher\CaptureMatcher`` was removed
5+
* ``Coduo\PHPMatcher\Matcher\TypeMatcher`` was removed
6+
* ``Coduo\PHPMatcher\Matcher\PropertyMatcher`` interface was remved
7+
* Removed ``match`` function, use PHPMatcher facade instead
8+
* Renamed ``@[email protected]()`` expander into ``@[email protected]()``
9+
10+
# Upgrade from 1.0 to 1.1
11+
12+
*No known BC Breakes*

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "coduo/php-matcher",
33
"type": "library",
4-
"keywords": ["json", "matcher", "tests"],
4+
"keywords": ["json", "matcher", "tests", "match"],
55
"license": "MIT",
66
"authors": [
77
{

src/Coduo/PHPMatcher/AST/Expander.php

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

33
namespace Coduo\PHPMatcher\AST;
44

5-
class Expander implements Node
5+
final class Expander implements Node
66
{
77
/**
88
* @var

src/Coduo/PHPMatcher/AST/Pattern.php

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

33
namespace Coduo\PHPMatcher\AST;
44

5-
class Pattern implements Node
5+
final class Pattern implements Node
66
{
77
/**
88
* @var Type

src/Coduo/PHPMatcher/AST/Type.php

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

33
namespace Coduo\PHPMatcher\AST;
44

5-
class Type implements Node
5+
final class Type implements Node
66
{
77
/**
88
* @var string

src/Coduo/PHPMatcher/Lexer.php

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

55
use Doctrine\Common\Lexer\AbstractLexer;
66

7-
class Lexer extends AbstractLexer
7+
final class Lexer extends AbstractLexer
88
{
99
const T_NONE = 1;
1010
const T_EXPANDER_NAME = 2;

src/Coduo/PHPMatcher/Matcher.php

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

55
use Coduo\PHPMatcher\Matcher\ValueMatcher;
66

7-
class Matcher
7+
final class Matcher
88
{
99
/**
1010
* @var ValueMatcher

src/Coduo/PHPMatcher/Matcher/ArrayMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Symfony\Component\PropertyAccess\PropertyAccess;
88
use Symfony\Component\PropertyAccess\PropertyAccessor;
99

10-
class ArrayMatcher extends Matcher
10+
final class ArrayMatcher extends Matcher
1111
{
1212
const UNBOUNDED_PATTERN = '@...@';
1313

src/Coduo/PHPMatcher/Matcher/BooleanMatcher.php

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

55
use Coduo\ToString\StringConverter;
66

7-
class BooleanMatcher extends Matcher
7+
final class BooleanMatcher extends Matcher
88
{
99
const BOOLEAN_PATTERN = '/^@boolean@$/';
1010

src/Coduo/PHPMatcher/Matcher/CallbackMatcher.php

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

33
namespace Coduo\PHPMatcher\Matcher;
44

5-
class CallbackMatcher extends Matcher
5+
final class CallbackMatcher extends Matcher
66
{
77
/**
88
* {@inheritdoc}

src/Coduo/PHPMatcher/Matcher/CaptureMatcher.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/Coduo/PHPMatcher/Matcher/ChainMatcher.php

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

55
use Coduo\ToString\StringConverter;
66

7-
class ChainMatcher extends Matcher
7+
final class ChainMatcher extends Matcher
88
{
99
/**
1010
* @var array|ValueMatcher[]

src/Coduo/PHPMatcher/Matcher/DoubleMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\PHPMatcher\Parser;
66
use Coduo\ToString\StringConverter;
77

8-
class DoubleMatcher extends Matcher
8+
final class DoubleMatcher extends Matcher
99
{
1010
/**
1111
* @var Parser

src/Coduo/PHPMatcher/Matcher/ExpressionMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\ToString\StringConverter;
66
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
77

8-
class ExpressionMatcher extends Matcher
8+
final class ExpressionMatcher extends Matcher
99
{
1010
const MATCH_PATTERN = "/^expr\((.*?)\)$/";
1111

src/Coduo/PHPMatcher/Matcher/IntegerMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\PHPMatcher\Parser;
66
use Coduo\ToString\StringConverter;
77

8-
class IntegerMatcher extends Matcher
8+
final class IntegerMatcher extends Matcher
99
{
1010
/**
1111
* @var Parser

src/Coduo/PHPMatcher/Matcher/JsonMatcher.php

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

55
use Coduo\PHPMatcher\Matcher\Pattern\Assert\Json;
66

7-
class JsonMatcher extends Matcher
7+
final class JsonMatcher extends Matcher
88
{
99
/**
1010
* @var

src/Coduo/PHPMatcher/Matcher/NullMatcher.php

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

55
use Coduo\ToString\StringConverter;
66

7-
class NullMatcher extends Matcher
7+
final class NullMatcher extends Matcher
88
{
99
const MATCH_PATTERN = "/^@null@$/";
1010

src/Coduo/PHPMatcher/Matcher/NumberMatcher.php

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

55
use Coduo\ToString\StringConverter;
66

7-
class NumberMatcher extends Matcher
7+
final class NumberMatcher extends Matcher
88
{
99
const NUMBER_PATTERN = '/^@number@$/';
1010

src/Coduo/PHPMatcher/Matcher/Pattern/Assert/Json.php

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

33
namespace Coduo\PHPMatcher\Matcher\Pattern\Assert;
44

5-
class Json
5+
final class Json
66
{
77
const TRANSFORM_QUOTATION_PATTERN = '/([^"])@([a-zA-Z0-9\.]+)@([^"])/';
88
const TRANSFORM_QUOTATION_REPLACEMENT = '$1"@$2@"$3';

src/Coduo/PHPMatcher/Matcher/Pattern/Assert/Xml.php

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

33
namespace Coduo\PHPMatcher\Matcher\Pattern\Assert;
44

5-
class Xml
5+
final class Xml
66
{
77
/**
88
* @param $value

src/Coduo/PHPMatcher/Matcher/Pattern/Expander/Contains.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
66
use Coduo\ToString\StringConverter;
77

8-
class Contains implements PatternExpander
8+
final class Contains implements PatternExpander
99
{
1010
/**
1111
* @var null|string

src/Coduo/PHPMatcher/Matcher/Pattern/Expander/EndsWith.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
66
use Coduo\ToString\StringConverter;
77

8-
class EndsWith implements PatternExpander
8+
final class EndsWith implements PatternExpander
99
{
1010
/**
1111
* @var

src/Coduo/PHPMatcher/Matcher/Pattern/Expander/GreaterThan.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
66
use Coduo\ToString\StringConverter;
77

8-
class GreaterThan implements PatternExpander
8+
final class GreaterThan implements PatternExpander
99
{
1010
/**
1111
* @var
@@ -22,7 +22,7 @@ class GreaterThan implements PatternExpander
2222
*/
2323
public function __construct($boundary)
2424
{
25-
if (!is_float($boundary) && !is_integer($boundary) && !is_double($boundary)) {
25+
if (!is_float($boundary) && !is_int($boundary)) {
2626
throw new \InvalidArgumentException(sprintf("Boundary value \"%s\" is not a valid number.", new StringConverter($boundary)));
2727
}
2828

@@ -35,7 +35,7 @@ public function __construct($boundary)
3535
*/
3636
public function match($value)
3737
{
38-
if (!is_float($value) && !is_integer($value) && !is_double($value) && !is_numeric($value)) {
38+
if (!is_float($value) && !is_int($value) && !is_numeric($value)) {
3939
$this->error = sprintf("Value \"%s\" is not a valid number.", new StringConverter($value));
4040
return false;
4141
}

src/Coduo/PHPMatcher/Matcher/Pattern/Expander/InArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
66
use Coduo\ToString\StringConverter;
77

8-
class InArray implements PatternExpander
8+
final class InArray implements PatternExpander
99
{
1010
/**
1111
* @var null|string

src/Coduo/PHPMatcher/Matcher/Pattern/Expander/IsDateTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
66
use Coduo\ToString\StringConverter;
77

8-
class IsDateTime implements PatternExpander
8+
final class IsDateTime implements PatternExpander
99
{
1010
/**
1111
* @var null|string

0 commit comments

Comments
 (0)