Skip to content

Missing type in RegexConverter #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Coduo/PHPMatcher/Matcher/Pattern/RegexConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public function toRegex(TypePattern $type)
return "(\\-?[0-9]*)";
case 'double':
return "(\\-?[0-9]*[\\.|\\,][0-9]*)";
case 'null':
return "(null|NULL)";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it have no sense to match "lorem ipsum null" against pattern "lorem ipsum @null@" in texts, maybe instead of supporting @null@ type matcher we could handle UnknownTypeException in TextMatcher and fail matching when this exception is throwed with error message that "@null@ type matcher is not supported in text matching".
What do you think @rklak ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good, but with this change project was switched from 1.1.x to 1.1.4 - I think it was too big refactor to switch only the last number in version. It should be in 1.2 so when we've updated in project this library with 1.1.* format in our composer now we got an Exception.

Null is useless, thats true, so we will remove it from our mocks... but as I said - too big change for the last number :)

You probably now this: http://semver.org/
3. PATCH version when you make backwards-compatible bug fixes.

default:
throw new UnknownTypeException();
}
Expand Down