Skip to content

Commit 8ead19d

Browse files
committed
cq
1 parent 66df5b5 commit 8ead19d

7 files changed

Lines changed: 101 additions & 8 deletions

File tree

composer-require-checker.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"symbol-whitelist": [
3+
"null",
4+
"true",
5+
"false",
6+
"static",
7+
"self",
8+
"parent",
9+
"array",
10+
"string",
11+
"int",
12+
"float",
13+
"bool",
14+
"iterable",
15+
"callable",
16+
"void",
17+
"object"
18+
]
19+
}

composer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,35 @@
2929

3030
"twig/twig": "~2.11|~3.0"
3131
},
32+
"require-dev": {
33+
"doctrine/coding-standard": "^6.0",
34+
"roave/security-advisories": "dev-master",
35+
"squizlabs/php_codesniffer": "^3.4",
36+
"phpstan/phpstan": "^0.11.16",
37+
"phpstan/phpstan-deprecation-rules": "^0.11.2",
38+
"phpstan/phpstan-phpunit": "^0.11.2",
39+
"phpstan/phpstan-strict-rules": "^0.11.1",
40+
"maglnet/composer-require-checker": "^2.0",
41+
"phpunit/phpunit": "^8.4"
42+
},
3243
"autoload": {
3344
"psr-4": {
3445
"Shapecode\\": "src/"
3546
}
3647
},
48+
"scripts": {
49+
"check": [
50+
"@crc",
51+
"@cs-fix",
52+
"@cs-check",
53+
"@phpstan"
54+
],
55+
"phpstan": "./vendor/bin/phpstan analyse ./src",
56+
"crc": "./vendor/bin/composer-require-checker --config-file=./composer-require-checker.json",
57+
"phpunit": "./vendor/bin/phpunit",
58+
"cs-fix": "./vendor/bin/phpcbf",
59+
"cs-check": "./vendor/bin/phpcs -s"
60+
},
3761
"extra": {
3862
"branch-alias": {
3963
"dev-master": "1.0-dev"

phpcs.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
3+
4+
<arg name="basepath" value="."/>
5+
<arg name="colors"/>
6+
<arg name="extensions" value="php"/>
7+
<arg name="tab-width" value="4"/>
8+
9+
<file>src/</file>
10+
<file>tests/</file>
11+
12+
<rule ref="./vendor/doctrine/coding-standard/lib/Doctrine/ruleset.xml">
13+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
14+
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat"/>
15+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
16+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
17+
<exclude name="Generic.Files.LineLength.TooLong"/>
18+
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
19+
</rule>
20+
</ruleset>

phpstan.neon.dist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
includes:
2+
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
3+
- vendor/phpstan/phpstan-strict-rules/rules.neon
4+
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
5+
#- vendor/phpstan/phpstan-phpunit/extension.neon
6+
- vendor/phpstan/phpstan-phpunit/rules.neon
7+
8+
parameters:
9+
level: max
10+
paths:
11+
- src
12+
- test

phpunit.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?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>
22+
</phpunit>

src/Twig/Loader/StringLoader.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Shapecode\Twig\Loader;
46

57
use Twig\Loader\LoaderInterface;
68
use Twig\Source;
9+
use function preg_match;
710

8-
/**
9-
* Class StringLoader
10-
*
11-
* @package Shapecode\Bundle\TwigStringLoaderBundle\Twig\Loader
12-
* @author Nikita Loges
13-
*/
1411
class StringLoader implements LoaderInterface
1512
{
16-
1713
/**
1814
* @inheritDoc
1915
*/
@@ -43,6 +39,6 @@ public function isFresh($name, $time)
4339
*/
4440
public function exists($name)
4541
{
46-
return preg_match('/\s/', $name);
42+
return (bool) preg_match('/\s/', $name);
4743
}
4844
}

tests/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)