BryanDavis has uploaded a new change for review. https://gerrit.wikimedia.org/r/293780
Change subject: Bump mediawiki-codesniffer to 0.7.2 and fix violations ...................................................................... Bump mediawiki-codesniffer to 0.7.2 and fix violations Use mediawiki-codesniffer v0.7.2 for style checks with the short array syntax (PHP >=5.4) disabled. Change-Id: Ia661499704bfb8f7b7efb1757b377772e856139f --- M composer.json M composer.lock M phpcs.xml M src/AbstractApp.php M src/Auth/AuthManager.php M src/Auth/Password.php M src/Config.php M src/Controller.php M src/Dao/AbstractDao.php M src/HeaderMiddleware.php M src/Mailer.php M src/ParsoidClient.php M tests/ConfigTest.php 13 files changed, 36 insertions(+), 75 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/slimapp refs/changes/80/293780/1 diff --git a/composer.json b/composer.json index 7a78a82..c91293f 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "require-dev": { "jakub-onderka/php-parallel-lint": "~0.9", "phpunit/phpunit": "~4.6", - "mediawiki/mediawiki-codesniffer": "~0.4.0" + "mediawiki/mediawiki-codesniffer": "0.7.2" }, "autoload-dev": { "psr-4": { @@ -39,10 +39,13 @@ } }, "scripts": { + "lint": "parallel-lint . --exclude vendor", + "phpcs": "phpcs", + "fix": "phpcbf", "test": [ - "parallel-lint . --exclude vendor", + "composer lint", "phpunit $PHPUNIT_ARGS", - "phpcs -p" + "composer phpcs" ] } } diff --git a/composer.lock b/composer.lock index 70a8d99..b3e6853 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "a8d05afafc84f3f8b67808f2e91c82db", - "content-hash": "076d63cccea542e5b94938ca0f4a2889", + "hash": "e5e583d0316ad3183b22b2e369a1ad08", + "content-hash": "2eb96b25fe31bc87de1eb568491c75dd", "packages": [ { "name": "bd808/monolog-udp2log-handler", @@ -538,24 +538,26 @@ }, { "name": "mediawiki/mediawiki-codesniffer", - "version": "v0.4.0", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-tools-codesniffer.git", - "reference": "0104c7063441e179ee0a6598e0a028223bf480dd" + "reference": "6b713bcbb9c20a3bdad76f9477458c9b4ae0773b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-tools-codesniffer/zipball/0104c7063441e179ee0a6598e0a028223bf480dd", - "reference": "0104c7063441e179ee0a6598e0a028223bf480dd", + "url": "https://api.github.com/repos/wikimedia/mediawiki-tools-codesniffer/zipball/6b713bcbb9c20a3bdad76f9477458c9b4ae0773b", + "reference": "6b713bcbb9c20a3bdad76f9477458c9b4ae0773b", "shasum": "" }, "require": { - "squizlabs/php_codesniffer": "2.3.4" + "php": ">= 5.5.9", + "squizlabs/php_codesniffer": "2.6.0" }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.*", - "phpunit/phpunit": "~4.1.0" + "mikey179/vfsstream": "~1.6", + "phpunit/phpunit": "~4.1" }, "type": "library", "notification-url": "https://packagist.org/downloads/", @@ -568,7 +570,7 @@ "codesniffer", "mediawiki" ], - "time": "2015-09-26 21:34:16" + "time": "2016-05-28 01:08:59" }, { "name": "phpdocumentor/reflection-docblock", @@ -1420,22 +1422,26 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.3.4", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "11a2545c44a5915f883e2e5ec12e14ed345e3ab2" + "reference": "1bcdf03b068a530ac1962ce671dead356eeba43b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/11a2545c44a5915f883e2e5ec12e14ed345e3ab2", - "reference": "11a2545c44a5915f883e2e5ec12e14ed345e3ab2", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1bcdf03b068a530ac1962ce671dead356eeba43b", + "reference": "1bcdf03b068a530ac1962ce671dead356eeba43b", "shasum": "" }, "require": { + "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" }, "bin": [ "scripts/phpcs", @@ -1444,7 +1450,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -1490,7 +1496,7 @@ "phpcs", "standards" ], - "time": "2015-09-09 00:18:50" + "time": "2016-04-03 22:58:34" }, { "name": "symfony/yaml", diff --git a/phpcs.xml b/phpcs.xml index 66943fa..83c2fd8 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,11 +1,18 @@ <?xml version="1.0"?> <ruleset name="wikimedia-slimapp"> - <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/> <file>.</file> <exclude-pattern>coverage</exclude-pattern> <exclude-pattern>vendor</exclude-pattern> <exclude-pattern>doc/html</exclude-pattern> - <arg name="report" value="full"/> + <arg name="encoding" value="utf-8"/> <arg name="extensions" value="php"/> + <arg name="report" value="full"/> + <arg name="report" value="summary"/> + <arg value="sp"/> + + <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/> + <rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"> + <severity>0</severity> + </rule> </ruleset> diff --git a/src/AbstractApp.php b/src/AbstractApp.php index 5c32965..98e444c 100644 --- a/src/AbstractApp.php +++ b/src/AbstractApp.php @@ -131,14 +131,12 @@ $this->configureRoutes( $this->slim ); } - /** * Apply settings to the Slim application. * * @param \Slim\Slim $slim Application */ abstract protected function configureSlim( \Slim\Slim $slim ); - /** * Configure inversion of control/dependency injection container. @@ -147,7 +145,6 @@ */ abstract protected function configureIoc( \Slim\Helper\Set $container ); - /** * Configure view behavior. * @@ -155,14 +152,12 @@ */ abstract protected function configureView( \Slim\View $view ); - /** * Configure routes to be handled by application. * * @param \Slim\Slim $slim Application */ abstract protected function configureRoutes( \Slim\Slim $slim ); - /** * Main entry point for all requests. @@ -175,7 +170,6 @@ register_shutdown_function( 'session_write_close' ); $this->slim->run(); } - /** * Add a redirect route to the app. @@ -195,7 +189,6 @@ } )->name( $routeName ); } - /** * Add a static template route to the app. * @param \Slim\Slim $slim App @@ -211,7 +204,6 @@ $slim->render( "{$name}.html" ); } )->name( $routeName ); } - /** * Configure the default HeaderMiddleware installed for all routes. diff --git a/src/Auth/AuthManager.php b/src/Auth/AuthManager.php index f41abeb..94b2b6d 100644 --- a/src/Auth/AuthManager.php +++ b/src/Auth/AuthManager.php @@ -39,14 +39,12 @@ */ protected $manager; - /** * @param UserManager $manager */ public function __construct( UserManager $manager ) { $this->manager = $manager; } - /** * Get the current user's information @@ -61,7 +59,6 @@ } } - /** * Get the current user's Id. * @return int|bool Numeric user id or false if not available @@ -71,7 +68,6 @@ return $user ? $user->getId() : false; } - /** * Store the user's information. * @param UserData $user User information @@ -79,7 +75,6 @@ public function setUser( UserData $user ) { $_SESSION[self::USER_SESSION_KEY] = $user; } - /** * Is the user authenticated? @@ -89,7 +84,6 @@ return $this->getUserData() !== null; } - /** * Is the user anonymous? * @return bool True if the user is not authenticated, false otherwise @@ -97,7 +91,6 @@ public function isAnonymous() { return $this->getUserData() === null; } - /** * Attempt to authenticate a user. @@ -117,7 +110,6 @@ } } - /** * Add authentication. * @@ -135,7 +127,6 @@ // store user info in session $this->setUser( $user ); } - /** * Remove authentication. diff --git a/src/Auth/Password.php b/src/Auth/Password.php index 6a66be2..bd9a202 100644 --- a/src/Auth/Password.php +++ b/src/Auth/Password.php @@ -37,7 +37,6 @@ */ const BLOWFISH_PREFIX = '$2y$'; - /** * Compare a plain text string to a stored password hash. * @@ -57,7 +56,6 @@ return self::hashEquals( $hash, $check ); } - /** * Encode a password for database storage. * @@ -73,7 +71,6 @@ $salt = self::blowfishSalt(); return crypt( $plainText, $salt ); } - /** * Generate a blowfish salt specification. @@ -117,7 +114,6 @@ return $output; } - /** * Get N high entropy random bytes. @@ -187,7 +183,6 @@ return substr( $bytes, 0, $count ); } - /** * Check a salt specification to see if it is a blowfish crypt value. * @@ -200,7 +195,6 @@ substr( $hash, 0, $peek ) == self::BLOWFISH_PREFIX; } - // @codingStandardsIgnoreStart : Line exceeds 100 characters const CHARSET_PRINTABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~'; // @codingStandardsIgnoreEnd @@ -209,7 +203,6 @@ const CHARSET_DIGIT = '0123456789'; const CHARSET_ALPHANUM = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; const CHARSET_SYMBOL = '!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~'; - /** * Generate a random password. @@ -240,7 +233,6 @@ return $password; } - /** * Check whether a user-provided string is equal to a fixed-length secret @@ -280,7 +272,6 @@ return $result === 0; } } - /** * Construction of utility class is not allowed. diff --git a/src/Config.php b/src/Config.php index c789182..4fb58ae 100644 --- a/src/Config.php +++ b/src/Config.php @@ -42,7 +42,6 @@ return ( $val === null ) ? $default : $val; } - /** * Get a string value * @param string $name Setting name @@ -60,7 +59,6 @@ return ( $var === false ) ? $default : $var; } - /** * Get a date value * @param string $name Setting name @@ -69,7 +67,6 @@ public static function getDate( $name ) { return strtotime( self::getStr( $name ) ); } - /** * Load configuration data from file diff --git a/src/Controller.php b/src/Controller.php index b540d26..47139d5 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -61,7 +61,6 @@ */ protected $i18nctx; - /** * @param \Slim\Slim $slim */ @@ -69,7 +68,6 @@ $this->slim = $slim ?: \Slim\Slim::getInstance(); $this->form = new Form( $this->slim->log ); } - /** * Set default DAO @@ -79,7 +77,6 @@ $this->dao = $dao; } - /** * Set default form * @param Form $form @@ -87,7 +84,6 @@ public function setForm( Form $form ) { $this->form = $form; } - /** * Set mailer @@ -97,7 +93,6 @@ $this->mailer = $mailer; } - /** * Set i18n context * @param I18nContext $i18nctx @@ -105,7 +100,6 @@ public function setI18nContext( I18nContext $i18nctx ) { $this->i18nctx = $i18nctx; } - /** * Default request handler. @@ -115,7 +109,6 @@ protected function handle() { $this->slim->pass(); } - /** * Handle request by calling handleMethod on self. @@ -133,7 +126,6 @@ call_user_func_array( array( $this, 'handle' ), $argv ); } } - /** * Handle calls to undefined methods by proxying to the Slim member. @@ -153,7 +145,6 @@ ); } - /** * Handle access to undefined member variables by proxying to the Slim * member. @@ -164,7 +155,6 @@ public function __get( $name ) { return $this->slim->{$name}; } - /** * Get a flash message. @@ -180,7 +170,6 @@ } } - /** * Get a message from the I18nContext. * @@ -191,7 +180,6 @@ protected function msg( $key, $params = array() ) { return $this->i18nctx->message( $key, $params ); } - /** * Compute pagination data. diff --git a/src/Dao/AbstractDao.php b/src/Dao/AbstractDao.php index a22c263..d0c2f6f 100644 --- a/src/Dao/AbstractDao.php +++ b/src/Dao/AbstractDao.php @@ -45,7 +45,6 @@ */ protected $logger; - /** * @param string $dsn PDO data source name * @param string $user Database user @@ -62,7 +61,6 @@ ) ); } - /** * Bind values to a prepared statement. @@ -113,7 +111,6 @@ } } - /** * Prepare and execute an SQL statement and return the first row of results. * @@ -127,7 +124,6 @@ $stmt->execute(); return $stmt->fetch(); } - /** * Prepare and execute an SQL statement and return all results. @@ -143,7 +139,6 @@ $stmt->execute(); return $stmt->fetchAll(); } - /** * Prepare and execute an SQL statement and return all results plus the @@ -166,7 +161,6 @@ return $ret; } - /** * Prepare and execute an SQL statement in a transaction. @@ -195,7 +189,6 @@ } } - /** * Prepare and execute an SQL statement in a transaction. * @@ -223,7 +216,6 @@ return false; } } - /** * Construct a where clause. diff --git a/src/HeaderMiddleware.php b/src/HeaderMiddleware.php index e782fe5..64182cc 100644 --- a/src/HeaderMiddleware.php +++ b/src/HeaderMiddleware.php @@ -49,7 +49,6 @@ $this->headers = $headers; } - public function call() { $resp = $this->app->response; foreach ( $this->headers as $name => $value ) { diff --git a/src/Mailer.php b/src/Mailer.php index e525aeb..71d2e53 100644 --- a/src/Mailer.php +++ b/src/Mailer.php @@ -54,7 +54,6 @@ 'XMailer' => 'Wikimedia Grants review system', ); - /** * @param array $settings Configuration settings for PHPMailer * @param LoggerInterface $logger Log channel @@ -64,7 +63,6 @@ $settings = is_array( $settings ) ? $settings : array(); $this->settings = array_merge( $this->settings, $settings ); } - /** * @param string $to Recipent(s) @@ -88,7 +86,6 @@ ) ); } } - /** * Create and configure a PHPMailer instance. diff --git a/src/ParsoidClient.php b/src/ParsoidClient.php index 699ffaf..c257485 100644 --- a/src/ParsoidClient.php +++ b/src/ParsoidClient.php @@ -49,7 +49,6 @@ */ protected $logger; - /** * @param string $url URL to parsoid API * @param string $cache Cache directory diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index eba8849..69c5c9e 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -56,7 +56,6 @@ $this->assertEquals( $expect, $_SERVER[$var] ); } - public function testGetStrDefault() { $name = 'CONFIG_TEST_VALUE_NOT_SET'; putenv( $name ); -- To view, visit https://gerrit.wikimedia.org/r/293780 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia661499704bfb8f7b7efb1757b377772e856139f Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/slimapp Gerrit-Branch: master Gerrit-Owner: BryanDavis <bda...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits