Skip to content

Commit

Permalink
chore(deps/composer): bump the mediawiki group with 1 update (#28)
Browse files Browse the repository at this point in the history
* chore(deps/composer): bump the mediawiki group with 1 update

Bumps the mediawiki group with 1 update: [mediawiki/mediawiki-codesniffer](https://github.com/wikimedia/mediawiki-tools-codesniffer).

- [Changelog](https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/HISTORY.md)
- [Commits](wikimedia/mediawiki-tools-codesniffer@v40.0.0...v42.0.0)

---
updated-dependencies:
- dependency-name: mediawiki/mediawiki-codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: mediawiki
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: apply auto-fixable PHPCS errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samantha Nguyen <contact@samanthanguyen.me>
  • Loading branch information
dependabot[bot] and neoncitylights authored Dec 11, 2023
1 parent 75b7ca2 commit 03c49e3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 40 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"ext-intl": "*"
},
"require-dev": {
"mediawiki/mediawiki-codesniffer": "40.0.0",
"mediawiki/mediawiki-codesniffer": "42.0.0",
"mediawiki/minus-x": "1.1.1",
"ockcyp/covers-validator": "1.6.0",
"php-parallel-lint/php-console-highlighter": "1.0.0",
Expand Down
49 changes: 25 additions & 24 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function __toString(): string {

$onlyContainsHttpCodepoints = Utf8Utils::onlyContains(
$value,
fn( string $s ) => Utf8Utils::isHttpTokenCodepoint( $s ) );
fn ( string $s ) => Utf8Utils::isHttpTokenCodepoint( $s ) );

if ( $value === '' || !$onlyContainsHttpCodepoints ) {
$serializedValue = $this->serializeParameterValue( $value );
Expand Down
20 changes: 10 additions & 10 deletions src/MediaTypeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public function parse( string $s ): MediaType {
private function collectType( string $s, int $length, int &$position ): string {
$type = Utf8Utils::collectCodepoints(
$s, $position,
fn( string $c ) => $c !== Token::Slash->value
fn ( string $c ) => $c !== Token::Slash->value
);

if ( $type === '' ) {
throw new MediaTypeParserException( "type: is empty" );
}

$onlyContainsHttpCodepoints = Utf8Utils::onlyContains(
$type, fn( string $c ) => Utf8Utils::isHttpTokenCodepoint( $c ) );
$type, fn ( string $c ) => Utf8Utils::isHttpTokenCodepoint( $c ) );
if ( !$onlyContainsHttpCodepoints ) {
throw new MediaTypeParserException( "type: should only contain HTTP codepoints" );
}
Expand All @@ -70,7 +70,7 @@ private function collectType( string $s, int $length, int &$position ): string {
private function collectSubType( string $s, int &$position ): string {
$subType = Utf8Utils::collectCodepoints(
$s, $position,
fn( string $c ) => $c !== Token::Semicolon->value
fn ( string $c ) => $c !== Token::Semicolon->value
);
$subType = Utf8Utils::trimHttpWhitespace( $subType );

Expand All @@ -79,7 +79,7 @@ private function collectSubType( string $s, int &$position ): string {
}

$onlyContainsHttpCodepoints = Utf8Utils::onlyContains(
$subType, fn( string $c ) => Utf8Utils::isHttpTokenCodepoint( $c ) );
$subType, fn ( string $c ) => Utf8Utils::isHttpTokenCodepoint( $c ) );
if ( !$onlyContainsHttpCodepoints ) {
throw new MediaTypeParserException( "subtype: should only contain HTTP codepoints" );
}
Expand All @@ -98,13 +98,13 @@ private function collectParameters( string $s, int $length, int &$position ): ar
// skip whitespace
Utf8Utils::collectCodepoints(
$s, $position,
fn( string $c ) => Utf8Utils::isHttpWhitespace( $c )
fn ( string $c ) => Utf8Utils::isHttpWhitespace( $c )
);

// collect parameter name
$parameterName = Utf8Utils::collectCodepoints(
$s, $position,
fn( string $c ) => $c !== Token::Semicolon->value && $c !== Token::Equal->value
fn ( string $c ) => $c !== Token::Semicolon->value && $c !== Token::Equal->value
);
$parameterName = \strtolower( $parameterName );

Expand All @@ -123,10 +123,10 @@ private function collectParameters( string $s, int $length, int &$position ): ar
$parameterValue = null;
if ( $s[$position] === '"' ) {
$parameterValue = Utf8Utils::collectHttpQuotedString( $s, $position, true );
Utf8Utils::collectCodepoints( $s, $position, fn( string $c ) => $c !== Token::Semicolon->value );
Utf8Utils::collectCodepoints( $s, $position, fn ( string $c ) => $c !== Token::Semicolon->value );
} else {
$parameterValue = Utf8Utils::collectCodepoints( $s, $position,
fn( string $c ) => $c !== Token::Semicolon->value );
fn ( string $c ) => $c !== Token::Semicolon->value );
$parameterValue = Utf8Utils::trimHttpWhitespace( $parameterValue );

if ( $parameterValue === '' ) {
Expand All @@ -138,9 +138,9 @@ private function collectParameters( string $s, int $length, int &$position ): ar
if (
$parameterName !== ''
&& Utf8Utils::onlyContains( $parameterName,
fn( string $c ) => Utf8Utils::isHttpTokenCodepoint( $c ) )
fn ( string $c ) => Utf8Utils::isHttpTokenCodepoint( $c ) )
&& Utf8Utils::onlyContains( $parameterValue,
fn( string $c ) => Utf8Utils::isHttpQuotedStringTokenCodepoint( $c ) )
fn ( string $c ) => Utf8Utils::isHttpQuotedStringTokenCodepoint( $c ) )
&& !\array_key_exists( $parameterName, $parameters )
) {
$parameters[$parameterName] = $parameterValue;
Expand Down
8 changes: 4 additions & 4 deletions src/Utf8Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ public static function collectHttpQuotedString(
$positionStart = $position;
$value = '';

$expectedQuote = fn( string $input, int $position, string $value ) =>
$expectedQuote = fn ( string $input, int $position, string $value ) =>
"Codepoint in \"{$input}\" at position {$position} is {$value}, expected U+0022 (\")";
Assert::invariant(
fn() => $input[$position] === '"',
fn () => $input[$position] === '"',
$expectedQuote( $input, $position, $input[$position] ) );

$position++;

while ( true ) {
$value .= self::collectCodepoints(
$input, $position,
fn( string $c ) => $c !== '"' && $c !== '\\' );
fn ( string $c ) => $c !== '"' && $c !== '\\' );

if ( $position >= \strlen( $input ) ) {
break;
Expand All @@ -89,7 +89,7 @@ public static function collectHttpQuotedString(
$position++;
} else {
Assert::invariant(
fn() => $quoteOrBackslash === '"',
fn () => $quoteOrBackslash === '"',
$expectedQuote( $input, $position, $quoteOrBackslash ) );
break;
}
Expand Down

0 comments on commit 03c49e3

Please sign in to comment.