src/Parser/Parser.php
/**
     * Try parse modifiers.
     *
     * @param LocationInterface       $location        The location.
     * @param string                  $assertString    The assert command string.
     * @param string                  $modifiersString The modifiers string to parse.
     * @param array                   $parseErrors     The parse errors.
     * @param ModifiersInterface|null $modifiers       The modifiers or null if parsing failed.
     */
Try parse modifiers.
@param LocationInterface       $location        The location.
@param string                  $assertString    The assert command string.
@param string                  $modifiersString The modifiers string to parse.
@param array                   $parseErrors     The parse errors.
@param ModifiersInterface|null $modifiers       The modifiers or null if parsing failed.
Try parse modifiers . @param LocationInterface $location The location . @param string $assertString The assert command string . @param string $modifiersString The modifiers string to parse . @param array $parseErrors The parse errors . @param ModifiersInterface|null $modifiers The modifiers or null if parsing failed .
private static function tryParseModifiers(LocationInterface $location, string $assertString, string $modifiersString, array &$parseErrors, ?ModifiersInterface &$modifiers): void
    {
        $modifiers = new Modifiers();
        $hasErrors = false;
        for ($i = 0; $i < strlen($modifiersString); $i++) {
            $ch = $modifiersString[$i];
            $newModifier = new Modifiers(self::MODIFIERS_INFO[$ch]);
            if ($modifiers->contains($newModifier)) {
                $parseErrors[] = new ParseError($location, 'Duplicate modifier: Modifier "' . $ch . '" is duplicated for assert "' . $assertString . '".');
                $hasErrors = true;
            } else {
                $modifiers = $modifiers->combinedWith($newModifier);
            }
        }
        if ($hasErrors) {
            $modifiers = null;
        }
    }
private static function tryParseModifiers ( LocationInterface $ location , string $ assertString , string $ modifiersString , array & $ parseErrors , ? ModifiersInterface & $ modifiers ) : void { $ modifiers = new Modifiers ( ) ; $ hasErrors = false ; for ( $ i = 0 ; $ i < strlen ( $ modifiersString ) ; $ i ++ ) { $ ch = $ modifiersString [ $ i ] ; $ newModifier = new Modifiers ( self :: MODIFIERS_INFO [ $ ch ] ) ; if ( $ modifiers -> contains ( $ newModifier ) ) { $ parseErrors [ ] = new ParseError ( $ location , 'Duplicate modifier: Modifier "' . $ ch . '" is duplicated for assert "' . $ assertString . '".' ) ; $ hasErrors = true ; } else { $ modifiers = $ modifiers -> combinedWith ( $ newModifier ) ; } } if ( $ hasErrors ) { $ modifiers = null ; } }
Try parse modifiers.
Try parse modifiers .