phpcsFile->getTokens(); $attribute = $this->getTargetToken('/* testLiveCoding */', T_ATTRIBUTE); $this->assertArrayHasKey('attribute_closer', $tokens[$attribute]); $this->assertNull($tokens[$attribute]['attribute_closer']); $expectedTokenCodes = [ 'T_ATTRIBUTE', 'T_STRING', 'T_OPEN_PARENTHESIS', 'T_LNUMBER', 'T_CLOSE_PARENTHESIS', 'T_WHITESPACE', 'T_FUNCTION', ]; $length = count($expectedTokenCodes); $map = array_map( function ($token) { if ($token['code'] === T_ATTRIBUTE) { $this->assertArrayHasKey('attribute_closer', $token); $this->assertNull($token['attribute_closer']); } else { $this->assertArrayNotHasKey('attribute_closer', $token); } return $token['type']; }, array_slice($tokens, $attribute, $length) ); $this->assertSame($expectedTokenCodes, $map); }//end testInvalidAttribute() }//end class