Skip to content

Commit

Permalink
Update dependencies (#181)
Browse files Browse the repository at this point in the history
- Allow installation of PHPUnit 10.1 with migrated configuration and removed deprecations
- Require newer coding standard and fix errors
  • Loading branch information
spaze authored Apr 23, 2023
2 parents d598c89 + 8a69d67 commit 743401a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
coverage: "pcov"
php-version: "${{ matrix.php-version }}"

- name: PHP info
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/composer.lock
/vendor
/tests/tmp
/.phpunit.result.cache
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"require-dev": {
"nette/neon": "^3.2",
"nikic/php-parser": "^4.13",
"phpunit/phpunit": "^7.0 || ^9.4.2",
"phpunit/phpunit": "^8.5 || ^10.1",
"php-parallel-lint/php-parallel-lint": "^1.2",
"php-parallel-lint/php-console-highlighter": "^1.0",
"spaze/coding-standard": "^1.3"
"spaze/coding-standard": "^1.6"
},
"autoload": {
"psr-4": {"Spaze\\PHPStan\\Rules\\Disallowed\\": "src"}
Expand Down
14 changes: 8 additions & 6 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="tests/bootstrap.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
backupStaticProperties="false"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
cacheDirectory="tests/tmp/phpunit.cache"
>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<html outputDirectory="tests/tmp/report" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
<testsuites>
<testsuite name="main">
<directory>tests</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Params/DisallowedCallParamValueSpecific.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function matches(Type $type): bool
if (!$type->isConstantScalarValue()->yes()) {
throw new UnsupportedParamTypeException();
}
return [$this->getValue()] === $type->getConstantScalarValues();
return $type->getConstantScalarValues() === [$this->getValue()];
}

}
2 changes: 1 addition & 1 deletion src/Usages/NamespaceUsages.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NamespaceUsages implements Rule
*/
public function __construct(DisallowedNamespaceRuleErrors $disallowedNamespaceHelper, DisallowedNamespaceFactory $disallowNamespaceFactory, array $forbiddenNamespaces)
{
$this->disallowedHelper = $disallowedNamespaceHelper;
$this->disallowedHelper = $disallowedNamespaceHelper;
$this->disallowedNamespace = $disallowNamespaceFactory->createFromConfig($forbiddenNamespaces);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/DisallowedSuperglobalFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testNonSuperglobalInConfig(string $superglobal, ?string $excepti
}


public function superglobalsProvider(): Generator
public static function superglobalsProvider(): Generator
{
yield ['$GLOBALS', null];
yield ['$_SERVER', null];
Expand Down
2 changes: 1 addition & 1 deletion tests/IsAllowedFileHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testMatches(string $allowedPath, string $file, string $fileWithR
}


public function pathProvider(): Generator
public static function pathProvider(): Generator
{
yield [
'src',
Expand Down
2 changes: 1 addition & 1 deletion tests/src/configs/looseCalls.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
htmlspecialchars('foo', ENT_QUOTES);
htmlspecialchars('foo', 3);
htmlspecialchars('foo', ENT_QUOTES | ENT_HTML5);
htmlspecialchars('foo', 51); // ENT_QUOTES | ENT_HTML5
htmlspecialchars('foo', 51); // ENT_QUOTES | ENT_HTML5
htmlspecialchars('foo', ENT_XHTML);
htmlspecialchars('foo', 4);

0 comments on commit 743401a

Please sign in to comment.