jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/401070 )
Change subject: build: Updating mediawiki/mediawiki-codesniffer to 15.0.0 ...................................................................... build: Updating mediawiki/mediawiki-codesniffer to 15.0.0 The following sniffs are failing and were disabled: * MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected * MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic * MediaWiki.Commenting.FunctionComment.MissingParamComment * MediaWiki.Commenting.FunctionComment.MissingParamName * MediaWiki.Commenting.FunctionComment.MissingParamTag * MediaWiki.Commenting.FunctionComment.MissingReturn * MediaWiki.Files.ClassMatchesFilename.NotMatch And moved phpcs.xml to .phpcs.xml (T177256). Also added phpcbf to "composer fix" command. Change-Id: I713be5442edc42b2f509434116570fa6951c4c97 --- A .phpcs.xml M composer.json D phpcs.xml M shared/Page.php 4 files changed, 49 insertions(+), 39 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/.phpcs.xml b/.phpcs.xml new file mode 100644 index 0000000..c2ab9d5 --- /dev/null +++ b/.phpcs.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ruleset name="CDB"> + <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn" /> + <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" /> + </rule> + <file>.</file> + <arg name="encoding" value="utf8"/> + <arg name="extensions" value="php"/> + <rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"> + <severity>0</severity> + </rule> + <rule ref="Generic.Files.LineLength.TooLong"> + <severity>0</severity> + </rule> + <rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine"> + <severity>0</severity> + </rule> + <rule ref="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"> + <severity>0</severity> + </rule> + <exclude-pattern>vendor</exclude-pattern> +</ruleset> diff --git a/composer.json b/composer.json index 672564a..ff9c61a 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,20 @@ { - "require": { - "php": ">= 5.5.9" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9", - "mediawiki/mediawiki-codesniffer": "0.7.2", - "phpunit/phpunit": "4.8.*" - }, - "scripts": { - "test": [ - "parallel-lint . --exclude vendor", - "phpunit", - "phpcs -p -s" - ] - } + "require": { + "php": ">= 5.5.9" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "0.9", + "mediawiki/mediawiki-codesniffer": "15.0.0", + "phpunit/phpunit": "4.8.*" + }, + "scripts": { + "test": [ + "parallel-lint . --exclude vendor", + "phpunit", + "phpcs -p -s" + ], + "fix": [ + "phpcbf" + ] + } } diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 76e2f1b..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<ruleset name="CDB"> - <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/> - <file>.</file> - <arg name="encoding" value="utf8"/> - <arg name="extensions" value="php"/> - <rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"> - <severity>0</severity> - </rule> - <rule ref="Generic.Files.LineLength.TooLong"> - <severity>0</severity> - </rule> - <rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine"> - <severity>0</severity> - </rule> - <rule ref="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"> - <severity>0</severity> - </rule> - <exclude-pattern>vendor</exclude-pattern> -</ruleset> diff --git a/shared/Page.php b/shared/Page.php index 96aed10..801aa40 100644 --- a/shared/Page.php +++ b/shared/Page.php @@ -121,14 +121,14 @@ $path = dirname( $_SERVER['SCRIPT_NAME'] ) . '/'; } if ( !$path || !isset( $_SERVER['DOCUMENT_ROOT'] ) ) { - Page::error( 'Invalid context.' ); + self::error( 'Invalid context.' ); } // Use realpath() to prevent escalation through e.g. "../" // Note: realpath() also normalises paths to have no trailing slash $realPath = realpath( $_SERVER['DOCUMENT_ROOT'] . $path ); if ( !$realPath || strpos( $realPath, $_SERVER['DOCUMENT_ROOT'] ) !== 0 ) { // Path escalation. Should be impossible as Apache normalises this. - Page::error( 'Invalid context.' ); + self::error( 'Invalid context.' ); } if ( substr( $path, -1 ) === '/' ) { $realPath .= '/'; @@ -164,7 +164,7 @@ } /** - * @return string: URL path to shared/lib (without trailing slash). + * @return string URL path to shared/lib (without trailing slash). */ public function getLibPath() { if ( $this->libPath ) { @@ -216,7 +216,6 @@ * @param string $file */ public function addHtmlFile( $file ) { - $isRelativePath = ( substr( $file, 0 ) !== '/' ); if ( $isRelativePath && $this->dir ) { -- To view, visit https://gerrit.wikimedia.org/r/401070 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I713be5442edc42b2f509434116570fa6951c4c97 Gerrit-PatchSet: 1 Gerrit-Project: integration/docroot Gerrit-Branch: master Gerrit-Owner: Libraryupgrader <tools.libraryupgra...@tools.wmflabs.org> Gerrit-Reviewer: Hashar <has...@free.fr> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits