Comments (3)
Could you share your pattern and data you are trading to match against?
from php-matcher.
I added only the library to the composer.
// src/index.php
<?php
require __DIR__ . '/../vendor/autoload.php';
// https://github.com/coduo/php-matcher/blob/6.x/src/PHPMatcher.php#L55
$factory = new Coduo\PHPMatcher\Factory\MatcherFactory();
$backtrace = new Coduo\PHPMatcher\Backtrace\VoidBacktrace();
$matcher = $factory->createMatcher($backtrace);
$matcher->match('1', '@number@'); // is true
$matcher->match(1, '@number@'); // is true
$matcher->match('1', '@integer@'); // is true <- wrong
$matcher->match(1, '@integer@'); // is true
from php-matcher.
Ahh I see, the problem is that Matcher Factory is creating a chain of matchers, they are executed in a specific order.
It works this way because typically, you want to use matcher against JSON files, so what happens here is that TextMatcher recognizes your input as a text and it's probably using the wrong matcher.
I think the problem is an order of matchers here but it's been a while since I looked into this logic so you might need to play with it a bit.
from php-matcher.
Related Issues (20)
- Confusing error message HOT 3
- How does the `.inArray()` pattern expander work ? HOT 3
- Expecting null but give an array throws strange runtime error HOT 3
- Make possible to use assertMatchesPattern in static methods HOT 2
- generate php-matcher checking rules from Open API swagger annotation
- ValueError: array_fill(): Argument #2 ($count) must be greater than or equal to 0
- Use of mutation testing in php-matcher - Help needed
- Type pattern "@...@" is not supported by TextMatcher. HOT 4
- Cannot use positional argument after named argument HOT 1
- PHPUnit 10 support
- Consider upgrade doctrine/lexer to 2.x branch HOT 3
- Json array of object compare
- When new release with PHP Unit support? HOT 1
- Release 6.0.12 not longer compatible with PHPUnit 9 HOT 1
- Type pattern "@boolean@" is not supported? HOT 1
- Do not hide parsing error exceptions deeply in the code
- Not able to match `@null@||@array@` (again) HOT 3
- Consider adding support for doctrine/lexer 3 HOT 9
- Deprecation notice using Doctrine\Common\Lexer\Token properties via ArrayAccess HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-matcher.