Skip to content

Commit 4135517

Browse files
committed
update to latest dependencies
1 parent c40d3a9 commit 4135517

7 files changed

Lines changed: 71 additions & 54 deletions

File tree

.github/workflows/php.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
php-versions: [ '8.2', '8.3' ]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php-versions }}
27+
28+
- run: composer validate --strict -n
29+
- run: composer install --prefer-dist --no-progress --no-suggest
30+
- run: composer check

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/composer.lock
22
/composer.phar
33
/vendor/
4-
.phpunit.result.cache
4+
/.phpunit.cache

composer.json

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525
}
2626
],
2727
"require": {
28-
"php": "^7.4|^8.0",
28+
"php": "^8.1",
2929

30-
"twig/twig": "^2.11|^3.0"
30+
"twig/twig": "^3.8"
3131
},
3232
"require-dev": {
33-
"doctrine/coding-standard": "^9.0",
33+
"doctrine/coding-standard": "^12.0",
3434
"roave/security-advisories": "dev-master",
35-
"squizlabs/php_codesniffer": "^3.4",
36-
"phpstan/phpstan": "^1.4",
37-
"phpstan/phpstan-deprecation-rules": "^1.0",
38-
"phpstan/phpstan-phpunit": "^1.0",
39-
"phpstan/phpstan-strict-rules": "^1.1",
40-
"maglnet/composer-require-checker": "^2.0|^3.8|^4.0",
41-
"phpunit/phpunit": "^9.5"
35+
"squizlabs/php_codesniffer": "^3.7",
36+
"phpstan/phpstan": "^1.10",
37+
"phpstan/phpstan-deprecation-rules": "^1.1",
38+
"phpstan/phpstan-phpunit": "^1.3",
39+
"phpstan/phpstan-strict-rules": "^1.5",
40+
"maglnet/composer-require-checker": "^4.7",
41+
"phpunit/phpunit": "^10.5"
4242
},
4343
"autoload": {
4444
"psr-4": {
@@ -53,21 +53,26 @@
5353
"scripts": {
5454
"check": [
5555
"@crc",
56-
"@cs-fix",
5756
"@cs-check",
58-
"@phpstan"
57+
"@phpstan",
58+
"@phpunit"
5959
],
6060
"phpstan": "./vendor/bin/phpstan analyse ./src",
6161
"crc": "./vendor/bin/composer-require-checker --config-file=./composer-require-checker.json",
62-
"phpunit": "./vendor/bin/phpunit",
62+
"phpunit": "./vendor/bin/phpunit --colors=always",
6363
"cs-fix": "./vendor/bin/phpcbf",
6464
"cs-check": "./vendor/bin/phpcs -s"
6565
},
6666
"extra": {
6767
"branch-alias": {
68-
"dev-master": "1.1-dev"
68+
"dev-master": "2.0-dev"
6969
}
7070
},
7171
"minimum-stability": "dev",
72-
"prefer-stable": true
72+
"prefer-stable": true,
73+
"config": {
74+
"allow-plugins": {
75+
"dealerdirect/phpcodesniffer-composer-installer": true
76+
}
77+
}
7378
}

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ includes:
22
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
33
- vendor/phpstan/phpstan-strict-rules/rules.neon
44
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
5-
#- vendor/phpstan/phpstan-phpunit/extension.neon
5+
- vendor/phpstan/phpstan-phpunit/extension.neon
66
- vendor/phpstan/phpstan-phpunit/rules.neon
77

88
parameters:

phpunit.xml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.4/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
executionOrder="depends,defects"
6-
forceCoversAnnotation="true"
7-
beStrictAboutCoversAnnotation="true"
8-
beStrictAboutOutputDuringTests="true"
9-
beStrictAboutTodoAnnotatedTests="true"
10-
verbose="true">
11-
<testsuites>
12-
<testsuite name="default">
13-
<directory suffix="Test.php">tests</directory>
14-
</testsuite>
15-
</testsuites>
16-
17-
<filter>
18-
<whitelist processUncoveredFilesFromWhitelist="true">
19-
<directory suffix=".php">src</directory>
20-
</whitelist>
21-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" requireCoverageMetadata="true" beStrictAboutCoverageMetadata="true">
3+
<coverage/>
4+
<testsuites>
5+
<testsuite name="default">
6+
<directory suffix="Test.php">tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
<source>
10+
<include>
11+
<directory suffix=".php">src</directory>
12+
</include>
13+
</source>
2214
</phpunit>

src/Twig/Loader/StringLoader.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414

1515
class StringLoader implements LoaderInterface
1616
{
17-
/**
18-
* @phpstan-param string $name
19-
*/
20-
public function getSourceContext($name): Source
17+
public function getSourceContext(string $name): Source
2118
{
2219
if (! $this->exists($name)) {
2320
throw new LoaderError(sprintf('Template "%s" is not defined.', $name));
@@ -26,10 +23,7 @@ public function getSourceContext($name): Source
2623
return new Source($name, $name);
2724
}
2825

29-
/**
30-
* @phpstan-param string $name
31-
*/
32-
public function getCacheKey($name): string
26+
public function getCacheKey(string $name): string
3327
{
3428
if (! $this->exists($name)) {
3529
throw new LoaderError(sprintf('Template "%s" is not defined.', $name));
@@ -38,11 +32,7 @@ public function getCacheKey($name): string
3832
return md5($name);
3933
}
4034

41-
/**
42-
* @phpstan-param string $name
43-
* @phpstan-param int $time
44-
*/
45-
public function isFresh($name, $time): bool
35+
public function isFresh(string $name, int $time): bool
4636
{
4737
if (! $this->exists($name)) {
4838
throw new LoaderError(sprintf('Template "%s" is not defined.', $name));
@@ -51,10 +41,8 @@ public function isFresh($name, $time): bool
5141
return true;
5242
}
5343

54-
/**
55-
* @phpstan-param string $name
56-
*/
57-
public function exists($name): bool
44+
/** @phpstan-param string $name */
45+
public function exists(string $name): bool
5846
{
5947
return (bool) preg_match('/\s/', $name);
6048
}

tests/Twig/Loader/StringLoaderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
namespace Shapecode\Tests\Twig\Loader;
66

7+
use PHPUnit\Framework\Attributes\CoversClass;
78
use PHPUnit\Framework\TestCase;
89
use Shapecode\Twig\Loader\StringLoader;
910
use Twig\Error\LoaderError;
1011

1112
use function time;
1213

14+
#[CoversClass(StringLoader::class)]
1315
class StringLoaderTest extends TestCase
1416
{
1517
public function testGetSourceContextWhenTemplateDoesNotExist(): void

0 commit comments

Comments
 (0)