Skip to content

Commit

Permalink
Merge pull request #65 from norzechowicz/cleanup
Browse files Browse the repository at this point in the history
Cleanup before stable release
  • Loading branch information
Norbert Orzechowicz committed Jan 24, 2016
2 parents ae724fd + c54376c commit a11daa5
Show file tree
Hide file tree
Showing 51 changed files with 145 additions and 188 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 2.0

* Added support for PHP7
* Updated dependencies to support Symfony3 components
* Added ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\MatchRegexTest`` expander - [email protected]
* Added ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsEmpty`` expander - [email protected]
* Added PHPMatcher facade in order to improve developers experience


# 1.1

* Added pattern expanders mechanism with following expanders:
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\Contains``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\EndsWith``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\GreaterThan``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\InArray``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsDateTime``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsEmail``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\IsUrl``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\LowerThan``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\MatchRegex``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\OneOf``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\StartsWith``

# 1.0

* PHPMatcher initial release with following matchers:
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ArrayMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\CallbackMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\CaptureMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ChainMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ExpressionMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\JsonMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\NullMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\ScalarMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\TypeMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\WildcardMatcher``
* ``Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander\XmlMatcher``
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#A quick guide to contribute to the project:

##Installing the dev environment

1. Fork the repo
2. Clone the repo to local
3. Install dependencies: `composer update` (this assumes you have 'composer' aliased to whereever your composer.phar lives)
4. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
`./bin/phpunit`

##Coding Standards

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.

[PSR-1: Basic Coding Standard](http://www.php-fig.org/psr/psr-1/)

[PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/)

##Adding new features

Pull requests with new features needs to be created against master branch.

If new feature require BC Breake please note that in your PR comment, it will added in next major version.
New features that does not have any BC Breakes are going to be added in next minor version.

##Patches and bugfixes

1. Check the oldest version that patch/bug fix can be applied.
2. Create PR against that version

For example if you are fixing pattern expander that was introduced in version 1.1 make sure that PR with fix
is created against version 1.1, not master or 2.0

##The actual contribution

1. Make the changes/additions to the code, committing often and making clear what you've done
2. Make sure you write tests for your code, located in the folder structure `tests/Coduo/PHPMatcher/...`
3. Run your tests (often and while coding): `./bin/phpunit`
4. Create Pull Request on github to against proper branch
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Michal Dabrowski, Norbert Orzechowicz
Copyright (c) 2014-2016 Michal Dabrowski, Norbert Orzechowicz

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ $match = $matcher->match("lorem ipsum dolor", "@string@")
* ``isDateTime()``
* ``isEmail()``
* ``isUrl()``
* ``notEmpty()``
* ``isEmpty()``
* ``isNotEmpty()``
* ``lowerThan($boundry)``
* ``greaterThan($boundry)``
* ``inArray($value)``
Expand Down
12 changes: 12 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Upgrade from 1.1 to 2.0

* All classes are now marked as final in order to close extra extension points
* ``Coduo\PHPMatcher\Matcher\CaptureMatcher`` was removed
* ``Coduo\PHPMatcher\Matcher\TypeMatcher`` was removed
* ``Coduo\PHPMatcher\Matcher\PropertyMatcher`` interface was remved
* Removed ``match`` function, use PHPMatcher facade instead
* Renamed ``@[email protected]()`` expander into ``@[email protected]()``

# Upgrade from 1.0 to 1.1

*No known BC Breakes*
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "coduo/php-matcher",
"type": "library",
"keywords": ["json", "matcher", "tests"],
"keywords": ["json", "matcher", "tests", "match"],
"license": "MIT",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/AST/Expander.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Coduo\PHPMatcher\AST;

class Expander implements Node
final class Expander implements Node
{
/**
* @var
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/AST/Pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Coduo\PHPMatcher\AST;

class Pattern implements Node
final class Pattern implements Node
{
/**
* @var Type
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/AST/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Coduo\PHPMatcher\AST;

class Type implements Node
final class Type implements Node
{
/**
* @var string
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Doctrine\Common\Lexer\AbstractLexer;

class Lexer extends AbstractLexer
final class Lexer extends AbstractLexer
{
const T_NONE = 1;
const T_EXPANDER_NAME = 2;
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Coduo\PHPMatcher\Matcher\ValueMatcher;

class Matcher
final class Matcher
{
/**
* @var ValueMatcher
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/ArrayMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessor;

class ArrayMatcher extends Matcher
final class ArrayMatcher extends Matcher
{
const UNBOUNDED_PATTERN = '@...@';

Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/BooleanMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Coduo\ToString\StringConverter;

class BooleanMatcher extends Matcher
final class BooleanMatcher extends Matcher
{
const BOOLEAN_PATTERN = '/^@boolean@$/';

Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/CallbackMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Coduo\PHPMatcher\Matcher;

class CallbackMatcher extends Matcher
final class CallbackMatcher extends Matcher
{
/**
* {@inheritdoc}
Expand Down
56 changes: 0 additions & 56 deletions src/Coduo/PHPMatcher/Matcher/CaptureMatcher.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/ChainMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Coduo\ToString\StringConverter;

class ChainMatcher extends Matcher
final class ChainMatcher extends Matcher
{
/**
* @var array|ValueMatcher[]
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/DoubleMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\PHPMatcher\Parser;
use Coduo\ToString\StringConverter;

class DoubleMatcher extends Matcher
final class DoubleMatcher extends Matcher
{
/**
* @var Parser
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/ExpressionMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\ToString\StringConverter;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;

class ExpressionMatcher extends Matcher
final class ExpressionMatcher extends Matcher
{
const MATCH_PATTERN = "/^expr\((.*?)\)$/";

Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/IntegerMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\PHPMatcher\Parser;
use Coduo\ToString\StringConverter;

class IntegerMatcher extends Matcher
final class IntegerMatcher extends Matcher
{
/**
* @var Parser
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/JsonMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

class JsonMatcher extends Matcher
final class JsonMatcher extends Matcher
{
/**
* @var
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/NullMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Coduo\ToString\StringConverter;

class NullMatcher extends Matcher
final class NullMatcher extends Matcher
{
const MATCH_PATTERN = "/^@null@$/";

Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/NumberMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Coduo\ToString\StringConverter;

class NumberMatcher extends Matcher
final class NumberMatcher extends Matcher
{
const NUMBER_PATTERN = '/^@number@$/';

Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/Pattern/Assert/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Coduo\PHPMatcher\Matcher\Pattern\Assert;

class Json
final class Json
{
const TRANSFORM_QUOTATION_PATTERN = '/([^"])@([a-zA-Z0-9\.]+)@([^"])/';
const TRANSFORM_QUOTATION_REPLACEMENT = '$1"@$2@"$3';
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/Pattern/Assert/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Coduo\PHPMatcher\Matcher\Pattern\Assert;

class Xml
final class Xml
{
/**
* @param $value
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/Pattern/Expander/Contains.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
use Coduo\ToString\StringConverter;

class Contains implements PatternExpander
final class Contains implements PatternExpander
{
/**
* @var null|string
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/Pattern/Expander/EndsWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
use Coduo\ToString\StringConverter;

class EndsWith implements PatternExpander
final class EndsWith implements PatternExpander
{
/**
* @var
Expand Down
6 changes: 3 additions & 3 deletions src/Coduo/PHPMatcher/Matcher/Pattern/Expander/GreaterThan.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
use Coduo\ToString\StringConverter;

class GreaterThan implements PatternExpander
final class GreaterThan implements PatternExpander
{
/**
* @var
Expand All @@ -22,7 +22,7 @@ class GreaterThan implements PatternExpander
*/
public function __construct($boundary)
{
if (!is_float($boundary) && !is_integer($boundary) && !is_double($boundary)) {
if (!is_float($boundary) && !is_int($boundary)) {
throw new \InvalidArgumentException(sprintf("Boundary value \"%s\" is not a valid number.", new StringConverter($boundary)));
}

Expand All @@ -35,7 +35,7 @@ public function __construct($boundary)
*/
public function match($value)
{
if (!is_float($value) && !is_integer($value) && !is_double($value) && !is_numeric($value)) {
if (!is_float($value) && !is_int($value) && !is_numeric($value)) {
$this->error = sprintf("Value \"%s\" is not a valid number.", new StringConverter($value));
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/Pattern/Expander/InArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
use Coduo\ToString\StringConverter;

class InArray implements PatternExpander
final class InArray implements PatternExpander
{
/**
* @var null|string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Coduo\PHPMatcher\Matcher\Pattern\PatternExpander;
use Coduo\ToString\StringConverter;

class IsDateTime implements PatternExpander
final class IsDateTime implements PatternExpander
{
/**
* @var null|string
Expand Down
Loading

0 comments on commit a11daa5

Please sign in to comment.