utils icon indicating copy to clipboard operation
utils copied to clipboard

Feature Request: matching method from nette/tester

Open f3l1x opened this issue 4 years ago • 5 comments

I find my self very useful nette/tester (Assert::matching and Assert::isMatching).

https://github.com/nette/tester/blob/55057023d08aa2e3018c21a8c40ea2b60c5ae80f/src/Framework/Assert.php#L525

Would you consider to add this kind of method to nette/utils? I can handle PR.

I know there is already Strings::match method, but I like predefined patterns.

https://github.com/nette/tester/blob/55057023d08aa2e3018c21a8c40ea2b60c5ae80f/src/Framework/Assert.php#L437-L454

WDYT?

f3l1x avatar Jan 05 '21 16:01 f3l1x

Btw. I'll refactor Tester to match() & matchRe() or similar.

milo avatar Jan 05 '21 16:01 milo

So no more isMatching('Hello %a%', 'Hello world?')?

f3l1x avatar Jan 05 '21 18:01 f3l1x

No. Only split pattern matching and regexp matching to be API more clear.

milo avatar Jan 05 '21 20:01 milo

I see. Anyway, it will be part of the nette/tester API. Does it make sense introduce something like that in nette/utils?

f3l1x avatar Jan 06 '21 10:01 f3l1x

Matching is (surprisingly) quite a complex matter. Maybe it is a topic for a separate package.

Matching in Tester I don't find so ingenious, because I'm still unable to remember what each %?% means…

dg avatar Jan 06 '21 15:01 dg