diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c9d0a2f..9e4c2ee 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,10 +6,3 @@ updates: interval: monthly open-pull-requests-limit: 10 versioning-strategy: increase - ignore: - - dependency-name: symfony/polyfill-php80 - versions: - - 1.22.0 - - dependency-name: phpunit/phpunit - versions: - - 8.5.14 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 171ca1e..63bf993 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [7.2, 7.3, 7.4, 8.0] + php: [7.3, 7.4, 8.0] experimental: [false] include: - php: 8.0 @@ -37,7 +37,7 @@ jobs: - name: Static analysis if: matrix.analysis - run: vendor/bin/phpstan analyse src + run: vendor/bin/phpstan - name: Tests run: vendor/bin/phpunit --coverage-clover clover.xml @@ -47,5 +47,5 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - composer require php-coveralls/php-coveralls -n + composer require php-coveralls/php-coveralls -n -W vendor/bin/php-coveralls --coverage_clover=clover.xml -v diff --git a/README.md b/README.md index 3afbb9d..3c2a5f0 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ $ composer require slim/psr7 ``` This will install the `slim/psr7` component and all required dependencies. -PHP 7.2 or newer is required. +PHP 7.3 or newer is required. ## Tests diff --git a/composer.json b/composer.json index f94ecef..816775f 100644 --- a/composer.json +++ b/composer.json @@ -28,11 +28,11 @@ } ], "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3 || ^8.0", "fig/http-message-util": "^1.1.5", "psr/http-factory": "^1.0", "psr/http-message": "^1.0", - "ralouphie/getallheaders": "^3", + "ralouphie/getallheaders": "^3.0", "symfony/polyfill-php80": "^1.23" }, "require-dev": { @@ -40,10 +40,11 @@ "adriansuter/php-autoload-override": "^1.2", "http-interop/http-factory-tests": "^0.9.0", "php-http/psr7-integration-tests": "dev-master", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^8.5 || ^9.5", - "squizlabs/php_codesniffer": "^3.6", - "weirdan/prophecy-shim": "^1.0 || ^2.0.2" + "phpspec/prophecy": "^1.14", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/phpstan": "^0.12.99", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6" }, "provide": { "psr/http-message-implementation": "1.0", @@ -67,7 +68,7 @@ ], "phpunit": "phpunit", "phpcs": "phpcs", - "phpstan": "phpstan analyse src --memory-limit=-1" + "phpstan": "phpstan --memory-limit=-1" }, "config": { "sort-packages": true diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4ae0e40..ccac1b2 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,3 +1,5 @@ parameters: level: max checkMissingIterableValueType: false + paths: + - src diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f3bfd90..a65dc57 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,38 +1,23 @@ - - ./tests/ + tests - - - src/ - - - - - - + + + src + + + + + diff --git a/tests/Assets/PhpFactoryFunctionOverrides.php b/tests/Assets/PhpFactoryFunctionOverrides.php deleted file mode 100644 index 1bef58d..0000000 --- a/tests/Assets/PhpFactoryFunctionOverrides.php +++ /dev/null @@ -1,45 +0,0 @@ - $string, - 'replace' => $replace, - 'status_code' => $statusCode, - ] - ); -} - -/** - * Remove a previously emmited header from the HeaderStack. - * - * @param string|null $name - */ -function header_remove($name = null) -{ - HeaderStack::remove($name); -} - -/** - * @param string $filename - * - * @return bool - */ -function is_uploaded_file(string $filename): bool -{ - if (isset($GLOBALS['is_uploaded_file_return'])) { - return $GLOBALS['is_uploaded_file_return']; - } - - return \is_uploaded_file($filename); -} - -/** - * Return the level of the output buffering shifted by the value of the global - * variable $GLOBALS['ob_get_level_shift'] if it exists. Otherwise the function - * override calls the default php built-in function. - * - * @return int - */ -function ob_get_level(): int -{ - if (isset($GLOBALS['ob_get_level_shift'])) { - return \ob_get_level() + $GLOBALS['ob_get_level_shift']; - } - - return \ob_get_level(); -} - -/** - * @param string $source - * @param string $destination - * @param resource|null $context - * - * @return bool - */ -function copy(string $source, string $destination, $context = null): bool -{ - if (isset($GLOBALS['copy_return'])) { - return $GLOBALS['copy_return']; - } - - if ($context === null) { - return \copy($source, $destination); - } - return \copy($source, $destination, $context); -} - -/** - * @param string $oldName - * @param string $newName - * @param resource|null $context - * - * @return bool - */ -function rename(string $oldName, string $newName, $context = null): bool -{ - if (isset($GLOBALS['rename_return'])) { - return $GLOBALS['rename_return']; - } - - if ($context === null) { - return \rename($oldName, $newName); - } - return \rename($oldName, $newName, $context = null); -} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 88d5fb4..dbe4a90 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -18,9 +18,6 @@ $classLoader = require __DIR__ . '/../vendor/autoload.php'; -//require __DIR__ . '/Assets/PhpFunctionOverrides.php'; -//require __DIR__ . '/Assets/PhpFactoryFunctionOverrides.php'; - Override::apply($classLoader, [ Headers::class => [ 'getallheaders' => function () {