jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/405068 )
Change subject: Update wikimedia dependancies ...................................................................... Update wikimedia dependancies Updated: * wikimedia/ip-set 1.1.0 -> 1.2.0 * wikimedia/relpath 2.0.0 -> 2.1.1 * wikimedia/running-stat 1.1.0 -> 1.2.1 * wikimedia/wrappedstring 2.2.0 -> 2.3.0 https://github.com/wikimedia/IPSet/compare/1.1.0...1.2.0 https://github.com/wikimedia/relpath/compare/2.0.0...2.1.1 https://github.com/wikimedia/runningstat/compare/v1.1.0...v1.2.1 https://github.com/wikimedia/WrappedString/compare/v2.2.0...v2.3.0 Bug: T182273 Change-Id: Ib2402f41262549207c8386d74855240ca0d4a54b --- M composer.json M composer.lock M composer/autoload_classmap.php M composer/autoload_files.php M composer/autoload_psr4.php M composer/autoload_static.php M composer/installed.json A wikimedia/ip-set/.phpcs.xml M wikimedia/ip-set/README.md A wikimedia/ip-set/src/IPSet/IPSet.php R wikimedia/ip-set/src/Wikimedia/IPSet.php A wikimedia/relpath/.phpcs.xml M wikimedia/relpath/README.md D wikimedia/relpath/src/RelPath.php A wikimedia/relpath/src/RelPath/RelPath.php A wikimedia/relpath/src/Wikimedia/RelPath.php A wikimedia/running-stat/.phpcs.xml M wikimedia/running-stat/COPYING M wikimedia/running-stat/README.md A wikimedia/running-stat/src/RunningStat/PSquare.php A wikimedia/running-stat/src/RunningStat/RunningStat.php R wikimedia/running-stat/src/Wikimedia/PSquare.php R wikimedia/running-stat/src/Wikimedia/RunningStat.php A wikimedia/wrappedstring/.phpcs.xml M wikimedia/wrappedstring/README.md R wikimedia/wrappedstring/src/Wikimedia/WrappedString.php R wikimedia/wrappedstring/src/Wikimedia/WrappedStringList.php A wikimedia/wrappedstring/src/WrappedString/WrappedString.php A wikimedia/wrappedstring/src/WrappedString/WrappedStringList.php 29 files changed, 544 insertions(+), 377 deletions(-) Approvals: MaxSem: Looks good to me, approved jenkins-bot: Verified Jforrester: Looks good to me, but someone else must approve diff --git a/composer.json b/composer.json index 23c9403..285e003 100644 --- a/composer.json +++ b/composer.json @@ -116,20 +116,20 @@ "wikimedia/css-sanitizer": "1.0.2", "wikimedia/equivset": "1.2.0", "wikimedia/html-formatter": "1.0.1", - "wikimedia/ip-set": "1.1.0", + "wikimedia/ip-set": "1.2.0", "wikimedia/lucene-explain-parser": "1.0.0", "wikimedia/php-session-serializer": "1.0.4", "wikimedia/purtle": "1.0.6", - "wikimedia/relpath": "2.0.0", + "wikimedia/relpath": "2.1.1", "wikimedia/remex-html": "1.0.2", - "wikimedia/running-stat": "1.1.0", + "wikimedia/running-stat": "1.2.1", "wikimedia/scoped-callback": "1.0.0", "wikimedia/testing-access-wrapper": "1.0.0", "wikimedia/textcat": "1.2.0", "wikimedia/timestamp": "1.0.0", "wikimedia/utfnormal": "1.1.0", "wikimedia/wait-condition-loop": "1.0.1", - "wikimedia/wrappedstring": "2.2.0", + "wikimedia/wrappedstring": "2.3.0", "zordius/lightncandy": "0.23" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 79b8e27..58c9371 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "837c313a820d305f7d8972f339ad3f58", + "content-hash": "55ccb0d45b1afbfc53e1263ca3a357d8", "packages": [ { "name": "composer/semver", @@ -2972,25 +2972,25 @@ }, { "name": "wikimedia/ip-set", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/wikimedia/IPSet.git", - "reference": "b71a3834b42e2bcb2d9fa037abbb654e82117a01" + "reference": "cabb679f440c87fd4053e4ea5e0120e769c9447f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/IPSet/zipball/b71a3834b42e2bcb2d9fa037abbb654e82117a01", - "reference": "b71a3834b42e2bcb2d9fa037abbb654e82117a01", + "url": "https://api.github.com/repos/wikimedia/IPSet/zipball/cabb679f440c87fd4053e4ea5e0120e769c9447f", + "reference": "cabb679f440c87fd4053e4ea5e0120e769c9447f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.5.1", - "phpunit/phpunit": "4.7.2" + "mediawiki/mediawiki-codesniffer": "15.0.0", + "phpunit/phpunit": "^4.8" }, "type": "library", "autoload": { @@ -3010,7 +3010,7 @@ ], "description": "Efficiently match IP addresses against a set of CIDR specifications.", "homepage": "https://github.com/wikimedia/IPSet", - "time": "2016-02-12T15:19:10+00:00" + "time": "2017-12-30T10:52:03+00:00" }, { "name": "wikimedia/lucene-explain-parser", @@ -3163,16 +3163,16 @@ }, { "name": "wikimedia/relpath", - "version": "2.0.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/wikimedia/RelPath.git", - "reference": "b0eeb17d31e4cde22dea0932dfb920a71a167c33" + "reference": "35e701ff16abf461bb8676a9d9177f86fa0b2c94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/RelPath/zipball/b0eeb17d31e4cde22dea0932dfb920a71a167c33", - "reference": "b0eeb17d31e4cde22dea0932dfb920a71a167c33", + "url": "https://api.github.com/repos/wikimedia/RelPath/zipball/35e701ff16abf461bb8676a9d9177f86fa0b2c94", + "reference": "35e701ff16abf461bb8676a9d9177f86fa0b2c94", "shasum": "" }, "require": { @@ -3180,13 +3180,14 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "^0.9.0.0", - "mediawiki/mediawiki-codesniffer": "^0.4.0.0", + "mediawiki/mediawiki-codesniffer": "15.0.0", "phpunit/phpunit": "^4.8.9.0" }, "type": "library", "autoload": { "files": [ - "src/RelPath.php" + "src/RelPath/RelPath.php", + "src/Wikimedia/RelPath.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3201,7 +3202,7 @@ ], "description": "Compute a relative filepath between two paths.", "homepage": "https://www.mediawiki.org/wiki/RelPath", - "time": "2017-07-28T21:20:05+00:00" + "time": "2018-01-18T21:23:40+00:00" }, { "name": "wikimedia/remex-html", @@ -3246,25 +3247,25 @@ }, { "name": "wikimedia/running-stat", - "version": "v1.1.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/wikimedia/RunningStat.git", - "reference": "9d7170d3eeb6f418b9f0266b2bbe6e4681ab73dd" + "reference": "60eebada7cc64b7073d90e7d4bab00efaafa0ba9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/RunningStat/zipball/9d7170d3eeb6f418b9f0266b2bbe6e4681ab73dd", - "reference": "9d7170d3eeb6f418b9f0266b2bbe6e4681ab73dd", + "url": "https://api.github.com/repos/wikimedia/RunningStat/zipball/60eebada7cc64b7073d90e7d4bab00efaafa0ba9", + "reference": "60eebada7cc64b7073d90e7d4bab00efaafa0ba9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { "jakub-onderka/php-parallel-lint": "^0.9.0.0", - "mediawiki/mediawiki-codesniffer": "^0.5.0.0", - "phpunit/phpunit": "4.6.*" + "mediawiki/mediawiki-codesniffer": "15.0.0", + "phpunit/phpunit": "4.8.*" }, "type": "library", "autoload": { @@ -3284,7 +3285,7 @@ ], "description": "PHP implementations of online statistical algorithms", "homepage": "https://www.mediawiki.org/wiki/RunningStat", - "time": "2015-10-28T22:29:15+00:00" + "time": "2018-01-18T22:18:47+00:00" }, { "name": "wikimedia/scoped-callback", @@ -3555,16 +3556,16 @@ }, { "name": "wikimedia/wrappedstring", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/wikimedia/WrappedString.git", - "reference": "738a89411fec30cb381b88905cacbcbe082db6a9" + "reference": "7e94b5d61551cfa95f9c0d070c9018b08ac24979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/WrappedString/zipball/738a89411fec30cb381b88905cacbcbe082db6a9", - "reference": "738a89411fec30cb381b88905cacbcbe082db6a9", + "url": "https://api.github.com/repos/wikimedia/WrappedString/zipball/7e94b5d61551cfa95f9c0d070c9018b08ac24979", + "reference": "7e94b5d61551cfa95f9c0d070c9018b08ac24979", "shasum": "" }, "require": { @@ -3572,13 +3573,14 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "^0.9.0.0", - "mediawiki/mediawiki-codesniffer": "0.4.0", - "phpunit/phpunit": "^4.7.7.0" + "mediawiki/mediawiki-codesniffer": "15.0.0", + "phpunit/phpunit": "^4.8" }, "type": "library", "autoload": { "psr-4": { - "WrappedString\\": "src/" + "Wikimedia\\": "src/Wikimedia", + "WrappedString\\": "src/WrappedString" } }, "notification-url": "https://packagist.org/downloads/", @@ -3593,7 +3595,7 @@ ], "description": "Automatically compact sequentially-outputted strings that share a common prefix / suffix pair.", "homepage": "https://www.mediawiki.org/wiki/WrappedString", - "time": "2016-07-21T00:41:10+00:00" + "time": "2017-12-30T10:52:27+00:00" }, { "name": "zordius/lightncandy", diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index ae2709a..60b3ec9 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -544,7 +544,7 @@ 'GDText\\Color' => $vendorDir . '/stil/gd-text/src/Color.php', 'Hashable' => $vendorDir . '/data-values/data-values/src/interfaces/Hashable.php', 'HtmlFormatter\\HtmlFormatter' => $vendorDir . '/wikimedia/html-formatter/src/HtmlFormatter.php', - 'IPSet\\IPSet' => $vendorDir . '/wikimedia/ip-set/src/IPSet.php', + 'IPSet\\IPSet' => $vendorDir . '/wikimedia/ip-set/src/IPSet/IPSet.php', 'Image_XMP' => $vendorDir . '/james-heinrich/getid3/getid3/module.tag.xmp.php', 'Immutable' => $vendorDir . '/data-values/data-values/src/interfaces/Immutable.php', 'JakubOnderka\\PhpConsoleColor\\ConsoleColor' => $vendorDir . '/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/ConsoleColor.php', @@ -1283,8 +1283,8 @@ 'RemexHtml\\TreeBuilder\\TreeBuilderError' => $vendorDir . '/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeBuilderError.php', 'RemexHtml\\TreeBuilder\\TreeHandler' => $vendorDir . '/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeHandler.php', 'RemexHtml\\TreeBuilder\\TreeMutationTracer' => $vendorDir . '/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeMutationTracer.php', - 'RunningStat\\PSquare' => $vendorDir . '/wikimedia/running-stat/src/PSquare.php', - 'RunningStat\\RunningStat' => $vendorDir . '/wikimedia/running-stat/src/RunningStat.php', + 'RunningStat\\PSquare' => $vendorDir . '/wikimedia/running-stat/src/RunningStat/PSquare.php', + 'RunningStat\\RunningStat' => $vendorDir . '/wikimedia/running-stat/src/RunningStat/RunningStat.php', 'Serializers\\DispatchableSerializer' => $vendorDir . '/serialization/serialization/src/Serializers/DispatchableSerializer.php', 'Serializers\\DispatchingSerializer' => $vendorDir . '/serialization/serialization/src/Serializers/DispatchingSerializer.php', 'Serializers\\Exceptions\\SerializationException' => $vendorDir . '/serialization/serialization/src/Serializers/Exceptions/SerializationException.php', @@ -1728,6 +1728,8 @@ 'Wikimedia\\Equivset\\Equivset' => $vendorDir . '/wikimedia/equivset/src/Equivset.php', 'Wikimedia\\Equivset\\EquivsetInterface' => $vendorDir . '/wikimedia/equivset/src/EquivsetInterface.php', 'Wikimedia\\Equivset\\Exception\\EquivsetException' => $vendorDir . '/wikimedia/equivset/src/Exception/EquivsetException.php', + 'Wikimedia\\IPSet' => $vendorDir . '/wikimedia/ip-set/src/Wikimedia/IPSet.php', + 'Wikimedia\\PSquare' => $vendorDir . '/wikimedia/running-stat/src/Wikimedia/PSquare.php', 'Wikimedia\\PhpSessionSerializer' => $vendorDir . '/wikimedia/php-session-serializer/src/Wikimedia/PhpSessionSerializer.php', 'Wikimedia\\Purtle\\BNodeLabeler' => $vendorDir . '/wikimedia/purtle/src/BNodeLabeler.php', 'Wikimedia\\Purtle\\N3Quoter' => $vendorDir . '/wikimedia/purtle/src/N3Quoter.php', @@ -1747,13 +1749,16 @@ 'Wikimedia\\Purtle\\TurtleRdfWriter' => $vendorDir . '/wikimedia/purtle/src/TurtleRdfWriter.php', 'Wikimedia\\Purtle\\UnicodeEscaper' => $vendorDir . '/wikimedia/purtle/src/UnicodeEscaper.php', 'Wikimedia\\Purtle\\XmlRdfWriter' => $vendorDir . '/wikimedia/purtle/src/XmlRdfWriter.php', + 'Wikimedia\\RunningStat' => $vendorDir . '/wikimedia/running-stat/src/Wikimedia/RunningStat.php', 'Wikimedia\\ScopedCallback' => $vendorDir . '/wikimedia/scoped-callback/src/ScopedCallback.php', 'Wikimedia\\TestingAccessWrapper' => $vendorDir . '/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php', 'Wikimedia\\Timestamp\\ConvertibleTimestamp' => $vendorDir . '/wikimedia/timestamp/src/ConvertibleTimestamp.php', 'Wikimedia\\Timestamp\\TimestampException' => $vendorDir . '/wikimedia/timestamp/src/TimestampException.php', 'Wikimedia\\WaitConditionLoop' => $vendorDir . '/wikimedia/wait-condition-loop/src/WaitConditionLoop.php', - 'WrappedString\\WrappedString' => $vendorDir . '/wikimedia/wrappedstring/src/WrappedString.php', - 'WrappedString\\WrappedStringList' => $vendorDir . '/wikimedia/wrappedstring/src/WrappedStringList.php', + 'Wikimedia\\WrappedString' => $vendorDir . '/wikimedia/wrappedstring/src/Wikimedia/WrappedString.php', + 'Wikimedia\\WrappedStringList' => $vendorDir . '/wikimedia/wrappedstring/src/Wikimedia/WrappedStringList.php', + 'WrappedString\\WrappedString' => $vendorDir . '/wikimedia/wrappedstring/src/WrappedString/WrappedString.php', + 'WrappedString\\WrappedStringList' => $vendorDir . '/wikimedia/wrappedstring/src/WrappedString/WrappedStringList.php', 'XdgBaseDir\\Xdg' => $vendorDir . '/dnoegel/php-xdg-base-dir/src/Xdg.php', 'getID3' => $vendorDir . '/james-heinrich/getid3/getid3/getid3.php', 'getID3_cached_dbm' => $vendorDir . '/james-heinrich/getid3/getid3/extension.cache.dbm.php', diff --git a/composer/autoload_files.php b/composer/autoload_files.php index 792d69b..0399ac8 100644 --- a/composer/autoload_files.php +++ b/composer/autoload_files.php @@ -21,6 +21,7 @@ '04c6c5c2f7095ccf6c481d3e53e1776f' => $vendorDir . '/mustangostang/spyc/Spyc.php', 'e7223560d890eab89cda23685e711e2c' => $vendorDir . '/psy/psysh/src/Psy/functions.php', 'c3f7f0e81464740a933532e81fa26cc7' => $vendorDir . '/wikimedia/base-convert/src/Functions.php', - 'd55c27a601de788b19a09b7d057d07ae' => $vendorDir . '/wikimedia/relpath/src/RelPath.php', + '4d945db823e5f6ca6dd83ad1f5fbcc43' => $vendorDir . '/wikimedia/relpath/src/RelPath/RelPath.php', + '6513700b70192b7dfd0e5e9fc8082cf3' => $vendorDir . '/wikimedia/relpath/src/Wikimedia/RelPath.php', 'c50606d667a3fde2b80a955639479d3d' => $vendorDir . '/wikimedia/timestamp/src/defines.php', ); diff --git a/composer/autoload_psr4.php b/composer/autoload_psr4.php index ce42d9b..b1ddd13 100644 --- a/composer/autoload_psr4.php +++ b/composer/autoload_psr4.php @@ -7,13 +7,14 @@ return array( 'XdgBaseDir\\' => array($vendorDir . '/dnoegel/php-xdg-base-dir/src'), - 'WrappedString\\' => array($vendorDir . '/wikimedia/wrappedstring/src'), + 'WrappedString\\' => array($vendorDir . '/wikimedia/wrappedstring/src/WrappedString'), 'Wikimedia\\Purtle\\Tests\\' => array($vendorDir . '/wikimedia/purtle/tests/phpunit'), 'Wikimedia\\Purtle\\' => array($vendorDir . '/wikimedia/purtle/src'), 'Wikimedia\\Equivset\\' => array($vendorDir . '/wikimedia/equivset/src'), 'Wikimedia\\Composer\\' => array($vendorDir . '/wikimedia/composer-merge-plugin/src'), 'Wikimedia\\Assert\\Test\\' => array($vendorDir . '/wikimedia/assert/tests/phpunit'), 'Wikimedia\\Assert\\' => array($vendorDir . '/wikimedia/assert/src'), + 'Wikimedia\\' => array($vendorDir . '/wikimedia/wrappedstring/src/Wikimedia'), 'Wikibase\\InternalSerialization\\' => array($vendorDir . '/wikibase/internal-serialization/src'), 'Wikibase\\DataModel\\Services\\' => array($vendorDir . '/wikibase/data-model-services/src'), 'Wikibase\\DataModel\\' => array($vendorDir . '/wikibase/data-model/src', $vendorDir . '/wikibase/data-model-serialization/src'), diff --git a/composer/autoload_static.php b/composer/autoload_static.php index b37e186..99e931f 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -22,7 +22,8 @@ '04c6c5c2f7095ccf6c481d3e53e1776f' => __DIR__ . '/..' . '/mustangostang/spyc/Spyc.php', 'e7223560d890eab89cda23685e711e2c' => __DIR__ . '/..' . '/psy/psysh/src/Psy/functions.php', 'c3f7f0e81464740a933532e81fa26cc7' => __DIR__ . '/..' . '/wikimedia/base-convert/src/Functions.php', - 'd55c27a601de788b19a09b7d057d07ae' => __DIR__ . '/..' . '/wikimedia/relpath/src/RelPath.php', + '4d945db823e5f6ca6dd83ad1f5fbcc43' => __DIR__ . '/..' . '/wikimedia/relpath/src/RelPath/RelPath.php', + '6513700b70192b7dfd0e5e9fc8082cf3' => __DIR__ . '/..' . '/wikimedia/relpath/src/Wikimedia/RelPath.php', 'c50606d667a3fde2b80a955639479d3d' => __DIR__ . '/..' . '/wikimedia/timestamp/src/defines.php', ); @@ -40,6 +41,7 @@ 'Wikimedia\\Composer\\' => 19, 'Wikimedia\\Assert\\Test\\' => 22, 'Wikimedia\\Assert\\' => 17, + 'Wikimedia\\' => 10, 'Wikibase\\InternalSerialization\\' => 31, 'Wikibase\\DataModel\\Services\\' => 28, 'Wikibase\\DataModel\\' => 19, @@ -116,7 +118,7 @@ ), 'WrappedString\\' => array ( - 0 => __DIR__ . '/..' . '/wikimedia/wrappedstring/src', + 0 => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/WrappedString', ), 'Wikimedia\\Purtle\\Tests\\' => array ( @@ -141,6 +143,10 @@ 'Wikimedia\\Assert\\' => array ( 0 => __DIR__ . '/..' . '/wikimedia/assert/src', + ), + 'Wikimedia\\' => + array ( + 0 => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/Wikimedia', ), 'Wikibase\\InternalSerialization\\' => array ( @@ -910,7 +916,7 @@ 'GDText\\Color' => __DIR__ . '/..' . '/stil/gd-text/src/Color.php', 'Hashable' => __DIR__ . '/..' . '/data-values/data-values/src/interfaces/Hashable.php', 'HtmlFormatter\\HtmlFormatter' => __DIR__ . '/..' . '/wikimedia/html-formatter/src/HtmlFormatter.php', - 'IPSet\\IPSet' => __DIR__ . '/..' . '/wikimedia/ip-set/src/IPSet.php', + 'IPSet\\IPSet' => __DIR__ . '/..' . '/wikimedia/ip-set/src/IPSet/IPSet.php', 'Image_XMP' => __DIR__ . '/..' . '/james-heinrich/getid3/getid3/module.tag.xmp.php', 'Immutable' => __DIR__ . '/..' . '/data-values/data-values/src/interfaces/Immutable.php', 'JakubOnderka\\PhpConsoleColor\\ConsoleColor' => __DIR__ . '/..' . '/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/ConsoleColor.php', @@ -1649,8 +1655,8 @@ 'RemexHtml\\TreeBuilder\\TreeBuilderError' => __DIR__ . '/..' . '/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeBuilderError.php', 'RemexHtml\\TreeBuilder\\TreeHandler' => __DIR__ . '/..' . '/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeHandler.php', 'RemexHtml\\TreeBuilder\\TreeMutationTracer' => __DIR__ . '/..' . '/wikimedia/remex-html/RemexHtml/TreeBuilder/TreeMutationTracer.php', - 'RunningStat\\PSquare' => __DIR__ . '/..' . '/wikimedia/running-stat/src/PSquare.php', - 'RunningStat\\RunningStat' => __DIR__ . '/..' . '/wikimedia/running-stat/src/RunningStat.php', + 'RunningStat\\PSquare' => __DIR__ . '/..' . '/wikimedia/running-stat/src/RunningStat/PSquare.php', + 'RunningStat\\RunningStat' => __DIR__ . '/..' . '/wikimedia/running-stat/src/RunningStat/RunningStat.php', 'Serializers\\DispatchableSerializer' => __DIR__ . '/..' . '/serialization/serialization/src/Serializers/DispatchableSerializer.php', 'Serializers\\DispatchingSerializer' => __DIR__ . '/..' . '/serialization/serialization/src/Serializers/DispatchingSerializer.php', 'Serializers\\Exceptions\\SerializationException' => __DIR__ . '/..' . '/serialization/serialization/src/Serializers/Exceptions/SerializationException.php', @@ -2094,6 +2100,8 @@ 'Wikimedia\\Equivset\\Equivset' => __DIR__ . '/..' . '/wikimedia/equivset/src/Equivset.php', 'Wikimedia\\Equivset\\EquivsetInterface' => __DIR__ . '/..' . '/wikimedia/equivset/src/EquivsetInterface.php', 'Wikimedia\\Equivset\\Exception\\EquivsetException' => __DIR__ . '/..' . '/wikimedia/equivset/src/Exception/EquivsetException.php', + 'Wikimedia\\IPSet' => __DIR__ . '/..' . '/wikimedia/ip-set/src/Wikimedia/IPSet.php', + 'Wikimedia\\PSquare' => __DIR__ . '/..' . '/wikimedia/running-stat/src/Wikimedia/PSquare.php', 'Wikimedia\\PhpSessionSerializer' => __DIR__ . '/..' . '/wikimedia/php-session-serializer/src/Wikimedia/PhpSessionSerializer.php', 'Wikimedia\\Purtle\\BNodeLabeler' => __DIR__ . '/..' . '/wikimedia/purtle/src/BNodeLabeler.php', 'Wikimedia\\Purtle\\N3Quoter' => __DIR__ . '/..' . '/wikimedia/purtle/src/N3Quoter.php', @@ -2113,13 +2121,16 @@ 'Wikimedia\\Purtle\\TurtleRdfWriter' => __DIR__ . '/..' . '/wikimedia/purtle/src/TurtleRdfWriter.php', 'Wikimedia\\Purtle\\UnicodeEscaper' => __DIR__ . '/..' . '/wikimedia/purtle/src/UnicodeEscaper.php', 'Wikimedia\\Purtle\\XmlRdfWriter' => __DIR__ . '/..' . '/wikimedia/purtle/src/XmlRdfWriter.php', + 'Wikimedia\\RunningStat' => __DIR__ . '/..' . '/wikimedia/running-stat/src/Wikimedia/RunningStat.php', 'Wikimedia\\ScopedCallback' => __DIR__ . '/..' . '/wikimedia/scoped-callback/src/ScopedCallback.php', 'Wikimedia\\TestingAccessWrapper' => __DIR__ . '/..' . '/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php', 'Wikimedia\\Timestamp\\ConvertibleTimestamp' => __DIR__ . '/..' . '/wikimedia/timestamp/src/ConvertibleTimestamp.php', 'Wikimedia\\Timestamp\\TimestampException' => __DIR__ . '/..' . '/wikimedia/timestamp/src/TimestampException.php', 'Wikimedia\\WaitConditionLoop' => __DIR__ . '/..' . '/wikimedia/wait-condition-loop/src/WaitConditionLoop.php', - 'WrappedString\\WrappedString' => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/WrappedString.php', - 'WrappedString\\WrappedStringList' => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/WrappedStringList.php', + 'Wikimedia\\WrappedString' => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/Wikimedia/WrappedString.php', + 'Wikimedia\\WrappedStringList' => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/Wikimedia/WrappedStringList.php', + 'WrappedString\\WrappedString' => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/WrappedString/WrappedString.php', + 'WrappedString\\WrappedStringList' => __DIR__ . '/..' . '/wikimedia/wrappedstring/src/WrappedString/WrappedStringList.php', 'XdgBaseDir\\Xdg' => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src/Xdg.php', 'getID3' => __DIR__ . '/..' . '/james-heinrich/getid3/getid3/getid3.php', 'getID3_cached_dbm' => __DIR__ . '/..' . '/james-heinrich/getid3/getid3/extension.cache.dbm.php', diff --git a/composer/installed.json b/composer/installed.json index b272b6c..98e330e 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -3077,28 +3077,28 @@ }, { "name": "wikimedia/ip-set", - "version": "1.1.0", - "version_normalized": "1.1.0.0", + "version": "1.2.0", + "version_normalized": "1.2.0.0", "source": { "type": "git", "url": "https://github.com/wikimedia/IPSet.git", - "reference": "b71a3834b42e2bcb2d9fa037abbb654e82117a01" + "reference": "cabb679f440c87fd4053e4ea5e0120e769c9447f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/IPSet/zipball/b71a3834b42e2bcb2d9fa037abbb654e82117a01", - "reference": "b71a3834b42e2bcb2d9fa037abbb654e82117a01", + "url": "https://api.github.com/repos/wikimedia/IPSet/zipball/cabb679f440c87fd4053e4ea5e0120e769c9447f", + "reference": "cabb679f440c87fd4053e4ea5e0120e769c9447f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.5.1", - "phpunit/phpunit": "4.7.2" + "mediawiki/mediawiki-codesniffer": "15.0.0", + "phpunit/phpunit": "^4.8" }, - "time": "2016-02-12T15:19:10+00:00", + "time": "2017-12-30T10:52:03+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -3276,17 +3276,17 @@ }, { "name": "wikimedia/relpath", - "version": "2.0.0", - "version_normalized": "2.0.0.0", + "version": "2.1.1", + "version_normalized": "2.1.1.0", "source": { "type": "git", "url": "https://github.com/wikimedia/RelPath.git", - "reference": "b0eeb17d31e4cde22dea0932dfb920a71a167c33" + "reference": "35e701ff16abf461bb8676a9d9177f86fa0b2c94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/RelPath/zipball/b0eeb17d31e4cde22dea0932dfb920a71a167c33", - "reference": "b0eeb17d31e4cde22dea0932dfb920a71a167c33", + "url": "https://api.github.com/repos/wikimedia/RelPath/zipball/35e701ff16abf461bb8676a9d9177f86fa0b2c94", + "reference": "35e701ff16abf461bb8676a9d9177f86fa0b2c94", "shasum": "" }, "require": { @@ -3294,15 +3294,16 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "^0.9.0.0", - "mediawiki/mediawiki-codesniffer": "^0.4.0.0", + "mediawiki/mediawiki-codesniffer": "15.0.0", "phpunit/phpunit": "^4.8.9.0" }, - "time": "2017-07-28T21:20:05+00:00", + "time": "2018-01-18T21:23:40+00:00", "type": "library", "installation-source": "dist", "autoload": { "files": [ - "src/RelPath.php" + "src/RelPath/RelPath.php", + "src/Wikimedia/RelPath.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3363,28 +3364,28 @@ }, { "name": "wikimedia/running-stat", - "version": "v1.1.0", - "version_normalized": "1.1.0.0", + "version": "v1.2.1", + "version_normalized": "1.2.1.0", "source": { "type": "git", "url": "https://github.com/wikimedia/RunningStat.git", - "reference": "9d7170d3eeb6f418b9f0266b2bbe6e4681ab73dd" + "reference": "60eebada7cc64b7073d90e7d4bab00efaafa0ba9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/RunningStat/zipball/9d7170d3eeb6f418b9f0266b2bbe6e4681ab73dd", - "reference": "9d7170d3eeb6f418b9f0266b2bbe6e4681ab73dd", + "url": "https://api.github.com/repos/wikimedia/RunningStat/zipball/60eebada7cc64b7073d90e7d4bab00efaafa0ba9", + "reference": "60eebada7cc64b7073d90e7d4bab00efaafa0ba9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5.9" }, "require-dev": { "jakub-onderka/php-parallel-lint": "^0.9.0.0", - "mediawiki/mediawiki-codesniffer": "^0.5.0.0", - "phpunit/phpunit": "4.6.*" + "mediawiki/mediawiki-codesniffer": "15.0.0", + "phpunit/phpunit": "4.8.*" }, - "time": "2015-10-28T22:29:15+00:00", + "time": "2018-01-18T22:18:47+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -3686,17 +3687,17 @@ }, { "name": "wikimedia/wrappedstring", - "version": "v2.2.0", - "version_normalized": "2.2.0.0", + "version": "v2.3.0", + "version_normalized": "2.3.0.0", "source": { "type": "git", "url": "https://github.com/wikimedia/WrappedString.git", - "reference": "738a89411fec30cb381b88905cacbcbe082db6a9" + "reference": "7e94b5d61551cfa95f9c0d070c9018b08ac24979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/WrappedString/zipball/738a89411fec30cb381b88905cacbcbe082db6a9", - "reference": "738a89411fec30cb381b88905cacbcbe082db6a9", + "url": "https://api.github.com/repos/wikimedia/WrappedString/zipball/7e94b5d61551cfa95f9c0d070c9018b08ac24979", + "reference": "7e94b5d61551cfa95f9c0d070c9018b08ac24979", "shasum": "" }, "require": { @@ -3704,15 +3705,16 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "^0.9.0.0", - "mediawiki/mediawiki-codesniffer": "0.4.0", - "phpunit/phpunit": "^4.7.7.0" + "mediawiki/mediawiki-codesniffer": "15.0.0", + "phpunit/phpunit": "^4.8" }, - "time": "2016-07-21T00:41:10+00:00", + "time": "2017-12-30T10:52:27+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { - "WrappedString\\": "src/" + "Wikimedia\\": "src/Wikimedia", + "WrappedString\\": "src/WrappedString" } }, "notification-url": "https://packagist.org/downloads/", diff --git a/wikimedia/ip-set/.phpcs.xml b/wikimedia/ip-set/.phpcs.xml new file mode 100644 index 0000000..317e4ab --- /dev/null +++ b/wikimedia/ip-set/.phpcs.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<ruleset name="IPSet"> + <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> + <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" /> + </rule> + <file>.</file> + <exclude-pattern>coverage</exclude-pattern> + <exclude-pattern>vendor</exclude-pattern> + <exclude-pattern>doc/html</exclude-pattern> +</ruleset> diff --git a/wikimedia/ip-set/README.md b/wikimedia/ip-set/README.md index 480e167..59a93a8 100644 --- a/wikimedia/ip-set/README.md +++ b/wikimedia/ip-set/README.md @@ -7,12 +7,13 @@ Here is how you use it: <pre lang="php"> +use Wikimedia\IPSet; // At startup, calculate the optimized data structure for the set: -$ipset = new IPSet( array( +$ipset = new IPSet( [ '208.80.154.0/26', '2620:0:861:1::/64', '10.64.0.0/22', -) ); +] ); // Runtime check against cached set (returns bool): if ( $ipset->match( $ip ) ) { @@ -47,16 +48,16 @@ The v4 tree would look like: <pre lang="php"> -root4 => array( +root4 => [ 'comp' => 25, - 'next' => array( + 'next' => [ 0 => true, - 1 => array( + 1 => [ 0 => false, 1 => true, - ), - ), -); + ], + ], +]; </pre> (multi-byte compression nodes were attempted as well, but were diff --git a/wikimedia/ip-set/src/IPSet/IPSet.php b/wikimedia/ip-set/src/IPSet/IPSet.php new file mode 100644 index 0000000..31264cb --- /dev/null +++ b/wikimedia/ip-set/src/IPSet/IPSet.php @@ -0,0 +1,6 @@ +<?php + +namespace IPSet; + +class IPSet extends \Wikimedia\IPSet { +} diff --git a/wikimedia/ip-set/src/IPSet.php b/wikimedia/ip-set/src/Wikimedia/IPSet.php similarity index 93% rename from wikimedia/ip-set/src/IPSet.php rename to wikimedia/ip-set/src/Wikimedia/IPSet.php index d8a417f..d97392c 100644 --- a/wikimedia/ip-set/src/IPSet.php +++ b/wikimedia/ip-set/src/Wikimedia/IPSet.php @@ -20,19 +20,20 @@ * @file * @author Brandon Black <blbl...@gmail.com> */ -namespace IPSet; +namespace Wikimedia; /** * Matches IP addresses against a set of CIDR specifications * * Usage: * + * use Wikimedia\IPSet; * // At startup, calculate the optimized data structure for the set: - * $ipset = new IPSet( array( + * $ipset = new IPSet( [ * '208.80.154.0/26', * '2620:0:861:1::/64', * '10.64.0.0/22', - * ) ); + * ] ); * * // Runtime check against cached set (returns bool): * $allowme = $ipset->match( $ip ); @@ -65,16 +66,16 @@ * * The v4 tree would look like: * - * root4 => array( + * root4 => [ * 'comp' => 25, - * 'next' => array( + * 'next' => [ * 0 => true, - * 1 => array( + * 1 => [ * 0 => false, * 1 => true, - * ), - * ), - * ); + * ], + * ], + * ]; * * (multi-byte compression nodes were attempted as well, but were * a net loss in my test scenarios due to additional match complexity) @@ -151,9 +152,9 @@ } elseif ( $node === false ) { // create new subarray to go deeper if ( !( $curBit & 7 ) && $curBit <= $mask - 8 ) { - $node = array( 'comp' => $rawOrd[$curBit >> 3], 'next' => false ); + $node = [ 'comp' => $rawOrd[$curBit >> 3], 'next' => false ]; } else { - $node = array( false, false ); + $node = [ false, false ]; } } @@ -170,8 +171,8 @@ $unode = $node['next']; for ( $i = 0; $i < 8; ++$i ) { $unode = ( $comp & ( 1 << $i ) ) - ? array( false, $unode ) - : array( $unode, false ); + ? [ false, $unode ] + : [ $unode, false ]; } $node = $unode; } @@ -185,8 +186,8 @@ } $node =& $node[$index]; ++$curBit; - } - } + } // Unreachable outside 'while' + } // @codeCoverageIgnore /** * Match an IP address against the set diff --git a/wikimedia/relpath/.phpcs.xml b/wikimedia/relpath/.phpcs.xml new file mode 100644 index 0000000..a575d0c --- /dev/null +++ b/wikimedia/relpath/.phpcs.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<ruleset> + <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> + <exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" /> + </rule> + + <file>.</file> + <arg name="encoding" value="UTF-8"/> + <arg name="extensions" value="php"/> + <exclude-pattern>coverage</exclude-pattern> + <exclude-pattern>vendor</exclude-pattern> + <exclude-pattern>doc/html</exclude-pattern> +</ruleset> diff --git a/wikimedia/relpath/README.md b/wikimedia/relpath/README.md index 421be52..0595c9c 100644 --- a/wikimedia/relpath/README.md +++ b/wikimedia/relpath/README.md @@ -7,10 +7,10 @@ Here is how you use it: <pre lang="php"> -$relPath = RelPath\getRelativePath( '/srv/mediawiki/resources/src/startup.js', '/srv/mediawiki' ); +$relPath = \Wikimedia\RelPath::getRelativePath( '/srv/mediawiki/resources/src/startup.js', '/srv/mediawiki' ); // Result: string(24) "resources/src/startup.js" -$fullPath = RelPath\joinPath( '/srv/mediawiki', 'resources/src/startup.js' ); +$fullPath = \Wikimedia\RelPath::joinPath( '/srv/mediawiki', 'resources/src/startup.js' ); // Result: string(39) "/srv/mediawiki/resources/src/startup.js" </pre> diff --git a/wikimedia/relpath/src/RelPath.php b/wikimedia/relpath/src/RelPath.php deleted file mode 100644 index 62b5bbe..0000000 --- a/wikimedia/relpath/src/RelPath.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php -/** - * Copyright (c) 2015 Ori Livneh <o...@wikimedia.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * @file - * @author Ori Livneh <o...@wikimedia.org> - */ - -namespace RelPath; - -/** - * Split a path into path components. - * - * @param string $path File path. - * @return array Array of path components. - */ -function splitPath( $path ) { - $fragments = array(); - - while ( true ) { - $cur = dirname( $path ); - if ( $cur[0] === DIRECTORY_SEPARATOR ) { - // dirname() on Windows sometimes returns a leading backslash, but other - // times retains the leading forward slash. Slashes other than the leading one - // are returned as-is, and therefore do not need to be touched. - // Furthermore, don't break on *nix where \ is allowed in file/directory names. - $cur[0] = '/'; - } - - if ( $cur === $path || ( $cur === '.' && basename( $path ) === $path ) ) { - break; - } - - $fragment = trim( substr( $path, strlen( $cur ) ), '/' ); - - if ( !$fragments ) { - $fragments[] = $fragment; - } elseif ( $fragment === '..' && basename( $cur ) !== '..' ) { - $cur = dirname( $cur ); - } elseif ( $fragment !== '.' ) { - $fragments[] = $fragment; - } - - $path = $cur; - } - - if ( $path !== '' ) { - $fragments[] = trim( $path, '/' ); - } - - return array_reverse( $fragments ); -} - -/** - * Return a relative filepath to path either from the current directory or from - * an optional start directory. Both paths must be absolute. - * - * @param string $path File path. - * @param string $start Start directory. Optional; if not specified, the current - * working directory will be used. - * @return string|bool Relative path, or false if input was invalid. - */ -function getRelativePath( $path, $start = null ) { - if ( $start === null ) { - // @codeCoverageIgnoreStart - $start = getcwd(); - } - // @codeCoverageIgnoreEnd - - if ( substr( $path, 0, 1 ) !== '/' || substr( $start, 0, 1 ) !== '/' ) { - return false; - } - - $pathParts = splitPath( $path ); - $countPathParts = count( $pathParts ); - - $startParts = splitPath( $start ); - $countStartParts = count( $startParts ); - - $commonLength = min( $countPathParts, $countStartParts ); - for ( $i = 0; $i < $commonLength; $i++ ) { - if ( $startParts[$i] !== $pathParts[$i] ) { - break; - } - } - - $relList = ( $countStartParts > $i ) - ? array_fill( 0, $countStartParts - $i, '..' ) - : array(); - - $relList = array_merge( $relList, array_slice( $pathParts, $i ) ); - - return implode( '/', $relList ) ?: '.'; -} - - -/** - * Join path components. - * - * @param string $base Base path. - * @param string $path File path to join to base path. - * @return string - */ -function joinPath( $base, $path ) { - if ( substr( $path, 0, 1 ) === '/' ) { - return $path; // $path is absolute. - } - - if ( substr( $base, 0, 1 ) !== '/' ) { - return false; // $base is relative. - } - - $pathParts = splitPath( $path ); - $resultParts = splitPath( $base ); - - while ( ( $part = array_shift( $pathParts ) ) !== null ) { - switch ( $part ) { - case '.': - break; - case '..': - if ( count( $resultParts ) > 1 ) { - array_pop( $resultParts ); - } - break; - default: - $resultParts[] = $part; - break; - } - } - - return implode( '/', $resultParts ); -} diff --git a/wikimedia/relpath/src/RelPath/RelPath.php b/wikimedia/relpath/src/RelPath/RelPath.php new file mode 100644 index 0000000..7c8d8a9 --- /dev/null +++ b/wikimedia/relpath/src/RelPath/RelPath.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright (c) 2015 Ori Livneh <o...@wikimedia.org> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @file + * @author Ori Livneh <o...@wikimedia.org> + */ + +namespace RelPath; + +use Wikimedia\RelPath; + +/** + * Split a path into path components. + * + * @param string $path File path. + * @return array Array of path components. + */ +function splitPath( $path ) { + return RelPath::splitPath( $path ); +} + +/** + * Return a relative filepath to path either from the current directory or from + * an optional start directory. Both paths must be absolute. + * + * @param string $path File path. + * @param string $start Start directory. Optional; if not specified, the current + * working directory will be used. + * @return string|bool Relative path, or false if input was invalid. + */ +function getRelativePath( $path, $start = null ) { + return RelPath::getRelativePath( $path, $start ); +} + +/** + * Join path components. + * + * @param string $base Base path. + * @param string $path File path to join to base path. + * @return string + */ +function joinPath( $base, $path ) { + return RelPath::joinPath( $base, $path ); +} diff --git a/wikimedia/relpath/src/Wikimedia/RelPath.php b/wikimedia/relpath/src/Wikimedia/RelPath.php new file mode 100644 index 0000000..aa8d16e --- /dev/null +++ b/wikimedia/relpath/src/Wikimedia/RelPath.php @@ -0,0 +1,154 @@ +<?php +/** + * Copyright (c) 2015 Ori Livneh <o...@wikimedia.org> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @file + * @author Ori Livneh <o...@wikimedia.org> + */ + +namespace Wikimedia; + +class RelPath { + /** + * Split a path into path components. + * + * @param string $path File path. + * @return array Array of path components. + */ + public static function splitPath( $path ) { + $fragments = []; + + while ( true ) { + $cur = dirname( $path ); + if ( $cur[0] === DIRECTORY_SEPARATOR ) { + // dirname() on Windows sometimes returns a leading backslash, but other + // times retains the leading forward slash. Slashes other than the leading one + // are returned as-is, and therefore do not need to be touched. + // Furthermore, don't break on *nix where \ is allowed in file/directory names. + $cur[0] = '/'; + } + + if ( $cur === $path || ( $cur === '.' && basename( $path ) === $path ) ) { + break; + } + + $fragment = trim( substr( $path, strlen( $cur ) ), '/' ); + + if ( !$fragments ) { + $fragments[] = $fragment; + } elseif ( $fragment === '..' && basename( $cur ) !== '..' ) { + $cur = dirname( $cur ); + } elseif ( $fragment !== '.' ) { + $fragments[] = $fragment; + } + + $path = $cur; + } + + if ( $path !== '' ) { + $fragments[] = trim( $path, '/' ); + } + + return array_reverse( $fragments ); + } + + /** + * Return a relative filepath to path either from the current directory or from + * an optional start directory. Both paths must be absolute. + * + * @param string $path File path. + * @param string $start Start directory. Optional; if not specified, the current + * working directory will be used. + * @return string|bool Relative path, or false if input was invalid. + */ + public static function getRelativePath( $path, $start = null ) { + if ( $start === null ) { + // @codeCoverageIgnoreStart + $start = getcwd(); + } + // @codeCoverageIgnoreEnd + + if ( substr( $path, 0, 1 ) !== '/' || substr( $start, 0, 1 ) !== '/' ) { + return false; + } + + $pathParts = self::splitPath( $path ); + $countPathParts = count( $pathParts ); + + $startParts = self::splitPath( $start ); + $countStartParts = count( $startParts ); + + $commonLength = min( $countPathParts, $countStartParts ); + for ( $i = 0; $i < $commonLength; $i++ ) { + if ( $startParts[$i] !== $pathParts[$i] ) { + break; + } + } + + $relList = ( $countStartParts > $i ) + ? array_fill( 0, $countStartParts - $i, '..' ) + : []; + + $relList = array_merge( $relList, array_slice( $pathParts, $i ) ); + + return implode( '/', $relList ) ?: '.'; + } + + /** + * Join path components. + * + * @param string $base Base path. + * @param string $path File path to join to base path. + * @return string + */ + public static function joinPath( $base, $path ) { + if ( substr( $path, 0, 1 ) === '/' ) { + // $path is absolute. + return $path; + } + + if ( substr( $base, 0, 1 ) !== '/' ) { + // $base is relative. + return false; + } + + $pathParts = self::splitPath( $path ); + $resultParts = self::splitPath( $base ); + + while ( ( $part = array_shift( $pathParts ) ) !== null ) { + switch ( $part ) { + case '.': + break; + case '..': + if ( count( $resultParts ) > 1 ) { + array_pop( $resultParts ); + } + break; + default: + $resultParts[] = $part; + break; + } + } + + return implode( '/', $resultParts ); + } +} diff --git a/wikimedia/running-stat/.phpcs.xml b/wikimedia/running-stat/.phpcs.xml new file mode 100644 index 0000000..91282e4 --- /dev/null +++ b/wikimedia/running-stat/.phpcs.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<ruleset> + <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" /> + <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" /> + </rule> + <file>.</file> + <arg name="encoding" value="UTF-8"/> + <arg name="extensions" value="php"/> + <exclude-pattern>coverage</exclude-pattern> + <exclude-pattern>vendor</exclude-pattern> + <exclude-pattern>doc/html</exclude-pattern> +</ruleset> diff --git a/wikimedia/running-stat/COPYING b/wikimedia/running-stat/COPYING index 019694a..d159169 100644 --- a/wikimedia/running-stat/COPYING +++ b/wikimedia/running-stat/COPYING @@ -1,65 +1,65 @@ -== GNU GENERAL PUBLIC LICENSE == + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 -Version 2, June 1991 + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. + Preamble -=== Preamble === - -The licenses for most software are designed to take away your + The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. -When we speak of free software, we are referring to freedom, not + When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. -To protect your rights, we need to make restrictions that forbid + To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. -For example, if you distribute copies of such a program, whether + For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. -We protect your rights with two steps: (1) copyright the software, and + We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. -Also, for each author's protection and ours, we want to make certain + Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. -Finally, any free program is threatened constantly by software + Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. -The precise terms and conditions for copying, distribution and + The precise terms and conditions for copying, distribution and modification follow. -== TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION == + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -'''0.''' This License applies to any program or other work which contains + 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" @@ -76,7 +76,7 @@ Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. -'''1.''' You may copy and distribute verbatim copies of the Program's + 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the @@ -87,29 +87,29 @@ You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. -'''2.''' You may modify your copy or copies of the Program or any portion + 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - '''a)''' You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. - '''b)''' You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. - '''c)''' If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, @@ -131,26 +131,26 @@ a storage or distribution medium does not bring the other work under the scope of this License. -'''3.''' You may copy and distribute the Program (or a work based on it, + 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - '''a)''' Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, - '''b)''' Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, - '''c)''' Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source @@ -169,7 +169,7 @@ distribution of the source code, even though third parties are not compelled to copy the source along with the object code. -'''4.''' You may not copy, modify, sublicense, or distribute the Program + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. @@ -177,7 +177,7 @@ this License will not have their licenses terminated so long as such parties remain in full compliance. -'''5.''' You are not required to accept this License, since you have not + 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by @@ -186,7 +186,7 @@ all its terms and conditions for copying, distributing or modifying the Program or works based on it. -'''6.''' Each time you redistribute the Program (or any work based on the + 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further @@ -194,7 +194,7 @@ You are not responsible for enforcing compliance by third parties to this License. -'''7.''' If, as a consequence of a court judgment or allegation of patent + 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not @@ -226,7 +226,7 @@ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. -'''8.''' If the distribution and/or use of the Program is restricted in + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding @@ -234,7 +234,7 @@ countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. -'''9.''' The Free Software Foundation may publish revised and/or new versions + 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. @@ -247,7 +247,7 @@ this License, you may choose any version ever published by the Free Software Foundation. -'''10.''' If you wish to incorporate parts of the Program into other free + 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes @@ -255,9 +255,9 @@ of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. -=== NO WARRANTY === + NO WARRANTY -'''11.''' BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED @@ -267,7 +267,7 @@ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -'''12.''' IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING @@ -277,47 +277,45 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - '''END OF TERMS AND CONDITIONS''' + END OF TERMS AND CONDITIONS -== How to Apply These Terms to Your New Programs == + How to Apply These Terms to Your New Programs -If you develop a new program, and you want it to be of the greatest + If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. -To do so, attach the following notices to the program. It is safest + To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - <one line to give the program's name and a brief idea of what it does.> + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> - Copyright (C) <year> <name of author> + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may @@ -328,15 +326,14 @@ school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. - <signature of Ty Coon>, 1 April 1989 - - Ty Coon, President of Vice + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/wikimedia/running-stat/README.md b/wikimedia/running-stat/README.md index 8deefac..93927e1 100644 --- a/wikimedia/running-stat/README.md +++ b/wikimedia/running-stat/README.md @@ -4,7 +4,7 @@ RunningStat computes the central tendency, shape, and extrema of a set of points online, in constant space. It uses a neat one-pass algorithm for calculating variance, described here: - <en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm> + <https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm> This particular implementation adapts a sample C++ implementation by John D. Cook to PHP. See <http://www.johndcook.com/standard_deviation.html> and @@ -26,15 +26,15 @@ Here is how you use it: <pre lang="php"> -use RunningStat\RunningStat; +use Wikimedia\RunningStat; $rstat = new RunningStat(); -foreach ( array( +foreach ( [ 49.7168, 74.3804, 7.0115, 96.5769, 34.9458, 36.9947, 33.8926, 89.0774, 23.7745, 73.5154, 86.1322, 53.2124, 16.2046, 73.5130, 10.4209, 42.7299, 49.3330, 47.0215, 34.9950, 18.2914, -) as $sample ) { +] as $sample ) { $rstat->addObservation( $sample ); } diff --git a/wikimedia/running-stat/src/RunningStat/PSquare.php b/wikimedia/running-stat/src/RunningStat/PSquare.php new file mode 100644 index 0000000..5ab2ef9 --- /dev/null +++ b/wikimedia/running-stat/src/RunningStat/PSquare.php @@ -0,0 +1,5 @@ +<?php +namespace RunningStat; + +class PSquare extends \Wikimedia\PSquare { +} diff --git a/wikimedia/running-stat/src/RunningStat/RunningStat.php b/wikimedia/running-stat/src/RunningStat/RunningStat.php new file mode 100644 index 0000000..c27d24c --- /dev/null +++ b/wikimedia/running-stat/src/RunningStat/RunningStat.php @@ -0,0 +1,5 @@ +<?php +namespace RunningStat; + +class RunningStat extends \Wikimedia\RunningStat { +} diff --git a/wikimedia/running-stat/src/PSquare.php b/wikimedia/running-stat/src/Wikimedia/PSquare.php similarity index 93% rename from wikimedia/running-stat/src/PSquare.php rename to wikimedia/running-stat/src/Wikimedia/PSquare.php index aae7e70..b50e1e8 100644 --- a/wikimedia/running-stat/src/PSquare.php +++ b/wikimedia/running-stat/src/Wikimedia/PSquare.php @@ -27,7 +27,7 @@ * @author Ori Livneh <o...@wikimedia.org> */ -namespace RunningStat; +namespace Wikimedia; /** * Represents a running, online estimate of a p-quantile for a series @@ -39,13 +39,13 @@ private $p; /** @var float[] Height of each marker. **/ - private $heights = array(); + private $heights = []; /** @var int[] Position of each marker. **/ - private $positions = array(); + private $positions = []; /** @var float[] Desired position of each marker. **/ - private $desired = array(); + private $desired = []; /** @var int Number of observations. **/ private $numObservations = 0; @@ -57,9 +57,9 @@ */ public function __construct( $p = 0.5 ) { $this->p = $p; - $this->positions = array( 0, 1, 2, 3, 4 ); - $this->desired = array( 0, ( 2 * $p ), ( 4 * $p ), 2 + ( 2 * $p ), 4 ); - $this->increments = array( 0, ( $p / 2 ), $p, ( ( 1 + $p ) / 2 ), 1 ); + $this->positions = [ 0, 1, 2, 3, 4 ]; + $this->desired = [ 0, ( 2 * $p ), ( 4 * $p ), 2 + ( 2 * $p ), 4 ]; + $this->increments = [ 0, ( $p / 2 ), $p, ( ( 1 + $p ) / 2 ), 1 ]; } /** @@ -192,7 +192,6 @@ } else { return $this->heights[floor( $i )]; } - return $result; } return $this->heights[2]; diff --git a/wikimedia/running-stat/src/RunningStat.php b/wikimedia/running-stat/src/Wikimedia/RunningStat.php similarity index 97% rename from wikimedia/running-stat/src/RunningStat.php rename to wikimedia/running-stat/src/Wikimedia/RunningStat.php index 1168755..349bae6 100644 --- a/wikimedia/running-stat/src/RunningStat.php +++ b/wikimedia/running-stat/src/Wikimedia/RunningStat.php @@ -23,10 +23,10 @@ * @author Ori Livneh <o...@wikimedia.org> */ -namespace RunningStat; +namespace Wikimedia; // Needed due to PHP non-bug <https://bugs.php.net/bug.php?id=49828>. -define( 'RUNNINGSTAT_NEGATIVE_INF', -INF ); +define( 'RUNNINGSTAT_NEGATIVE_INF', -INF ); // @codeCoverageIgnore /** * Represents a running summary of a stream of numbers. @@ -81,7 +81,7 @@ * @param int|float $x Value to add */ public function addObservation( $x ) { - $x = (float) $x; + $x = (float)$x; $this->min = min( $this->min, $x ); $this->max = max( $this->max, $x ); diff --git a/wikimedia/wrappedstring/.phpcs.xml b/wikimedia/wrappedstring/.phpcs.xml new file mode 100644 index 0000000..b669c65 --- /dev/null +++ b/wikimedia/wrappedstring/.phpcs.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<ruleset> + <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" /> + </rule> + + <file>.</file> + <arg name="encoding" value="UTF-8"/> + <arg name="extensions" value="php"/> + <exclude-pattern>coverage</exclude-pattern> + <exclude-pattern>vendor</exclude-pattern> + <exclude-pattern>doc/html</exclude-pattern> +</ruleset> diff --git a/wikimedia/wrappedstring/README.md b/wikimedia/wrappedstring/README.md index 5c8b8fb..b828e6f 100644 --- a/wikimedia/wrappedstring/README.md +++ b/wikimedia/wrappedstring/README.md @@ -8,12 +8,12 @@ Here is how you use it: <pre lang="php"> -use WrappedString\WrappedString; +use Wikimedia\WrappedString; -$buffer = array( +$buffer = [ new WrappedString( '[foo]', '[', ']' ), new WrappedString( '[bar]', '[', ']' ), -); +]; $output = WrappedString::join( "\n", $buffer ); // Result: '[foobar]' </pre> diff --git a/wikimedia/wrappedstring/src/WrappedString.php b/wikimedia/wrappedstring/src/Wikimedia/WrappedString.php similarity index 96% rename from wikimedia/wrappedstring/src/WrappedString.php rename to wikimedia/wrappedstring/src/Wikimedia/WrappedString.php index 5f69389..f432dc1 100644 --- a/wikimedia/wrappedstring/src/WrappedString.php +++ b/wikimedia/wrappedstring/src/Wikimedia/WrappedString.php @@ -24,7 +24,7 @@ * @file */ -namespace WrappedString; +namespace Wikimedia; class WrappedString { /** @var string */ @@ -72,9 +72,10 @@ * @return WrappedString[] Compacted list */ public static function compact( array $wraps ) { - $consolidated = array(); + $consolidated = []; $prev = current( $wraps ); - while ( ( $wrap = next( $wraps ) ) !== false ) { + while ( next( $wraps ) !== false ) { + $wrap = current( $wraps ); if ( $prev instanceof WrappedString && $wrap instanceof WrappedString && $prev->prefix !== null diff --git a/wikimedia/wrappedstring/src/WrappedStringList.php b/wikimedia/wrappedstring/src/Wikimedia/WrappedStringList.php similarity index 95% rename from wikimedia/wrappedstring/src/WrappedStringList.php rename to wikimedia/wrappedstring/src/Wikimedia/WrappedStringList.php index 41ff159..d1957dc 100644 --- a/wikimedia/wrappedstring/src/WrappedStringList.php +++ b/wikimedia/wrappedstring/src/Wikimedia/WrappedStringList.php @@ -24,7 +24,7 @@ * @file */ -namespace WrappedString; +namespace Wikimedia; class WrappedStringList { /** @var string */ @@ -43,7 +43,7 @@ } /** - * @params WrappedString[] $wraps + * @param WrappedString[] $wraps * @return WrappedStringList Combined list */ protected function extend( array $wraps ) { @@ -62,13 +62,14 @@ * @return string[] Compacted list */ protected static function compact( array $lists, $outerSep ) { - $consolidated = array(); + $consolidated = []; $prev = current( $lists ); // Wrap single WrappedString objects in a list for easier merging if ( $prev instanceof WrappedString ) { $prev = new WrappedStringList( $outerSep, [ $prev ] ); } - while ( ( $curr = next( $lists ) ) !== false ) { + while ( next( $lists ) !== false ) { + $curr = current( $lists ); if ( $curr instanceof WrappedString ) { $curr = new WrappedStringList( $outerSep, [ $curr ] ); } diff --git a/wikimedia/wrappedstring/src/WrappedString/WrappedString.php b/wikimedia/wrappedstring/src/WrappedString/WrappedString.php new file mode 100644 index 0000000..5186b1c --- /dev/null +++ b/wikimedia/wrappedstring/src/WrappedString/WrappedString.php @@ -0,0 +1,6 @@ +<?php + +namespace WrappedString; + +class WrappedString extends \Wikimedia\WrappedString { +} diff --git a/wikimedia/wrappedstring/src/WrappedString/WrappedStringList.php b/wikimedia/wrappedstring/src/WrappedString/WrappedStringList.php new file mode 100644 index 0000000..474601d --- /dev/null +++ b/wikimedia/wrappedstring/src/WrappedString/WrappedStringList.php @@ -0,0 +1,6 @@ +<?php + +namespace WrappedString; + +class WrappedStringList extends \Wikimedia\WrappedStringList { +} -- To view, visit https://gerrit.wikimedia.org/r/405068 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib2402f41262549207c8386d74855240ca0d4a54b Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/vendor Gerrit-Branch: master Gerrit-Owner: Reedy <re...@wikimedia.org> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits