diff --git a/composer.json b/composer.json index 4ebf62da2..8644aea6d 100644 --- a/composer.json +++ b/composer.json @@ -95,6 +95,7 @@ "phpunit/phpunit": "^11.0", "rector/rector": "^0.15.0", "staabm/phpstan-dba": "^0.2", + "staabm/phpstan-todo-by": "^0.1.27", "symfony/browser-kit": "^7", "symfony/css-selector": "^7", "symfony/debug-bundle": "^7", diff --git a/composer.lock b/composer.lock index 735d0ced4..b69e9b00f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2f77af14c84e64bde35af981e4521de0", + "content-hash": "076c30c969f9a6a47d10daabdac1d472", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -11364,6 +11364,73 @@ } ], "packages-dev": [ + { + "name": "beberlei/assert", + "version": "v3.3.2", + "source": { + "type": "git", + "url": "https://github.com/beberlei/assert.git", + "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655", + "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "*", + "phpstan/phpstan": "*", + "phpunit/phpunit": ">=6.0.0", + "yoast/phpunit-polyfills": "^0.1.0" + }, + "suggest": { + "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" + }, + "type": "library", + "autoload": { + "files": [ + "lib/Assert/functions.php" + ], + "psr-4": { + "Assert\\": "lib/Assert" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de", + "role": "Lead Developer" + }, + { + "name": "Richard Quadling", + "email": "rquadling@gmail.com", + "role": "Collaborator" + } + ], + "description": "Thin assertion library for input validation in business models.", + "keywords": [ + "assert", + "assertion", + "validation" + ], + "support": { + "issues": "https://github.com/beberlei/assert/issues", + "source": "https://github.com/beberlei/assert/tree/v3.3.2" + }, + "time": "2021-12-16T21:41:27+00:00" + }, { "name": "doctrine/data-fixtures", "version": "1.7.0", @@ -11652,6 +11719,67 @@ }, "time": "2024-03-05T20:51:40+00:00" }, + { + "name": "nikolaposa/version", + "version": "4.2.0", + "source": { + "type": "git", + "url": "https://github.com/nikolaposa/version.git", + "reference": "003fefa14f47cd44917546285e39d196af062a95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikolaposa/version/zipball/003fefa14f47cd44917546285e39d196af062a95", + "reference": "003fefa14f47cd44917546285e39d196af062a95", + "shasum": "" + }, + "require": { + "beberlei/assert": "^3.2", + "php": "^8.1" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.44", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-beberlei-assert": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^10.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Version\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nikola Poša", + "email": "posa.nikola@gmail.com", + "homepage": "https://www.nikolaposa.in.rs" + } + ], + "description": "Value Object that represents a SemVer-compliant version number.", + "homepage": "https://github.com/nikolaposa/version", + "keywords": [ + "semantic", + "semver", + "version", + "versioning" + ], + "support": { + "issues": "https://github.com/nikolaposa/version/issues", + "source": "https://github.com/nikolaposa/version/tree/4.2.0" + }, + "time": "2023-12-29T22:07:54+00:00" + }, { "name": "phar-io/manifest", "version": "2.0.4", @@ -13551,6 +13679,72 @@ }, "time": "2023-10-12T07:23:58+00:00" }, + { + "name": "staabm/phpstan-todo-by", + "version": "0.1.27", + "source": { + "type": "git", + "url": "https://github.com/staabm/phpstan-todo-by.git", + "reference": "aef25bd71ce63de28acb1c82289cb5bff172fcff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/phpstan-todo-by/zipball/aef25bd71ce63de28acb1c82289cb5bff172fcff", + "reference": "aef25bd71ce63de28acb1c82289cb5bff172fcff", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "composer/semver": "^3.4", + "ext-curl": "*", + "ext-json": "*", + "nikolaposa/version": "^4.1", + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^1.10" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.41", + "nikic/php-parser": "^4.0", + "phpunit/phpunit": "^9 || ^10.5", + "redaxo/php-cs-fixer-config": "^1.0" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "staabm\\PHPStanTodoBy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "keywords": [ + "PHPStan", + "comments", + "dev", + "expiration", + "phpstan-extension", + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/phpstan-todo-by/issues", + "source": "https://github.com/staabm/phpstan-todo-by/tree/0.1.27" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-05-24T17:49:10+00:00" + }, { "name": "symfony/browser-kit", "version": "v7.0.3", diff --git a/phpstan.neon b/phpstan.neon index e2bb08f92..d83807c38 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -8,6 +8,7 @@ includes: - vendor/phpstan/phpstan-symfony/rules.neon - vendor/phpstan/phpstan-webmozart-assert/extension.neon - vendor/staabm/phpstan-dba/config/dba.neon + - vendor/staabm/phpstan-todo-by/extension.neon - vendor/phpstan/phpstan-deprecation-rules/rules.neon parameters: diff --git a/src/Entity/Package.php b/src/Entity/Package.php index f4328b8b0..75d7db32e 100644 --- a/src/Entity/Package.php +++ b/src/Entity/Package.php @@ -481,6 +481,8 @@ public function setRepository(string $repoUrl): void $repoUrl = Preg::replace('{^git://github.com/}i', 'https://github.com/', $repoUrl); $repoUrl = Preg::replace('{^(https://github.com/.*?)\.git$}i', '$1', $repoUrl); $repoUrl = Preg::replace('{^(https://github.com/.*?)/$}i', '$1', $repoUrl); + // support urls like https://github.com/foo/bar/tree/main/baz or other sub-URLs in a repo + $repoUrl = Preg::replace('{^(https://github.com/[^/]+/[^/]+).+$}i', '$1', $repoUrl); $repoUrl = Preg::replace('{^git@gitlab.com:}i', 'https://gitlab.com/', $repoUrl); $repoUrl = Preg::replace('{^https?://(?:www\.)?gitlab\.com/(.*?)\.git$}i', 'https://gitlab.com/$1', $repoUrl); diff --git a/src/Package/Updater.php b/src/Package/Updater.php index 04f54f4b7..5a5837dd1 100644 --- a/src/Package/Updater.php +++ b/src/Package/Updater.php @@ -748,6 +748,7 @@ private function prepareReadme(string $readme, ?string $host = null, ?string $ow } $config = $config + // TODO symfony/html-sanitizer:7.2 ->defaultAction(HtmlSanitizerAction::Block) ->blockElement('div') ->blockElement('article') ->blockElement('g-emoji')