/** * Returns a Closure matching a Token by Value * * @param string|array $values * @return \Closure */ public static function getHasValueClosure($values) { return function (Token $token) use($values) { $helper = new AHelper(); return $helper->hasValue($token, $values); }; }
/** * @param \PHP\Manipulator\TokenContainer\Iterator $iterator * @param \Closure $closure * @param \PHP\Manipulator\Token $token * * @dataProvider getNextMatchingTokenProvider * @covers \PHP\Manipulator\AHelper::getNextMatchingToken */ public function testGetNextMatchingToken($iterator, $closure, $token) { $ahelper = new AHelper(); $start = $iterator->current(); $matchingToken = $ahelper->getNextMatchingToken($iterator, $closure); $this->assertTrue($iterator->valid(), 'Iterator is not valid'); $this->assertSame($start, $iterator->current(), 'Iterator is not at starting-position'); $this->assertSame($token, $matchingToken); }