Skip to content

Commit febfd4e

Browse files
committed
Make library PHP 7.4+ only
- Use new functionality as far as possible - Improve project configuration
1 parent bb48771 commit febfd4e

File tree

16 files changed

+36
-3171
lines changed

16 files changed

+36
-3171
lines changed

.gitattributes

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/tests export-ignore
22
/examples export-ignore
3+
/docker export-ignore
4+
/vendor-bin export-ignore
5+
/.editorconfig export-ignore
36
/.gitattributes export-ignore
47
/.gitignore export-ignore
5-
/phpunit.xml.dist export-ignore
6-
/phpcs.xml.dist export-ignore
7-
/captainhook.json export-ignore
88
/.travis.yml export-ignore
9-
/ruleset.xml export-ignore
10-
/.editorconfig export-ignore
9+
/captainhook.json export-ignore
1110
/phpstan.neon export-ignore
12-
/phpstan_base.neon export-ignore
1311
/phpstan-baseline.neon export-ignore
12+
/phpunit.xml.dist export-ignore
1413
/psalm.xml export-ignore
1514
/psalm-baseline.xml export-ignore
16-
/vendor-bin export-ignore
15+
/ruleset.xml export-ignore

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
/composer.lock
33
/vendor
44
/vendor-bin/**/vendor
5-
/.phpunit*
5+
/vendor-bin/**/composer.lock
6+
/.phpunit.result.cache
7+
/.phpcs-cache
68
/tests/_output
79
/tests/_reports
810
/build

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ env:
44
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
55
language: php
66
php:
7-
- '7.2'
8-
- '7.3'
97
- '7.4'
108

119
before_script:
1210
- composer self-update
13-
- composer install --prefer-source --no-interaction --dev
11+
- composer install --prefer-source --no-interaction
12+
- composer bin all install
1413
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
1514
- chmod +x ./cc-test-reporter
1615
- ./cc-test-reporter before-build

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Squirrel Strings Integration for Symfony
22
========================================
33

4-
[![Build Status](https://img.shields.io/travis/com/squirrelphp/strings-bundle.svg)](https://travis-ci.com/squirrelphp/strings-bundle) [![Test Coverage](https://api.codeclimate.com/v1/badges/f6e0f7b91f266787ce0c/test_coverage)](https://codeclimate.com/github/squirrelphp/strings-bundle/test_coverage) ![PHPStan](https://img.shields.io/badge/style-level%207-success.svg?style=flat-round&label=phpstan) [![Packagist Version](https://img.shields.io/packagist/v/squirrelphp/strings-bundle.svg?style=flat-round)](https://packagist.org/packages/squirrelphp/strings-bundle) [![PHP Version](https://img.shields.io/packagist/php-v/squirrelphp/strings-bundle.svg)](https://packagist.org/packages/squirrelphp/strings-bundle) [![Software License](https://img.shields.io/badge/license-MIT-success.svg?style=flat-round)](LICENSE)
4+
[![Build Status](https://img.shields.io/travis/com/squirrelphp/strings-bundle.svg)](https://travis-ci.com/squirrelphp/strings-bundle) [![Test Coverage](https://api.codeclimate.com/v1/badges/f6e0f7b91f266787ce0c/test_coverage)](https://codeclimate.com/github/squirrelphp/strings-bundle/test_coverage) ![PHPStan](https://img.shields.io/badge/style-level%208-success.svg?style=flat-round&label=phpstan) [![Packagist Version](https://img.shields.io/packagist/v/squirrelphp/strings-bundle.svg?style=flat-round)](https://packagist.org/packages/squirrelphp/strings-bundle) [![PHP Version](https://img.shields.io/packagist/php-v/squirrelphp/strings-bundle.svg)](https://packagist.org/packages/squirrelphp/strings-bundle) [![Software License](https://img.shields.io/badge/license-MIT-success.svg?style=flat-round)](LICENSE)
55

66
Integration of [squirrelphp/strings](https://github.com/squirrelphp/strings) into Symfony through service tags and bundle configuration.
77

@@ -66,7 +66,7 @@ function (\Squirrel\Strings\StringFilterSelectInterface $selector) {
6666

6767
$string = $selector->getFilter('ReplaceNewlinesWithSpaces')
6868
->filter($string);
69-
69+
7070
// Outputs "hello thanks a lot! bye"
7171
echo $string;
7272
}
@@ -89,7 +89,7 @@ class NewsletterChangeAction
8989
* @StringFilter({"StreamlineInputNoNewlines","RemoveHTMLTags"})
9090
*/
9191
public $firstName = '';
92-
92+
9393
/**
9494
* @StringFilter("RemoveNonAlphanumeric")
9595
*/
@@ -98,7 +98,7 @@ class NewsletterChangeAction
9898
```
9999

100100
You can run one or more string filters and use any of the default list of filters or any of [your own filters which you added](#adding-new-filters). The filters are run as an early PRE_SUBMIT form event.
101-
101+
102102
#### Adding new filters
103103

104104
Create a class, implement `Squirrel\Strings\StringFilterInterface` and tag the service with `squirrel.strings.filter` in a Symfony config file like this:
@@ -142,7 +142,7 @@ services:
142142
- '6789'
143143
tags:
144144
- { name: squirrel.strings.random, generator: MyGenerator }
145-
145+
146146
MyOtherCustomRandomGenerator:
147147
class: Squirrel\Strings\Random\GeneratorUnicode
148148
arguments:

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^7.2",
24-
"symfony/dependency-injection": "^4.0|^5.0",
23+
"php": "^7.4",
24+
"symfony/dependency-injection": "^5.0",
2525
"squirrelphp/strings": "^0.8.2"
2626
},
2727
"require-dev": {
2828
"bamarni/composer-bin-plugin": "^1.3",
29-
"captainhook/plugin-composer": "^4.0|^5.0",
29+
"captainhook/plugin-composer": "^5.0",
3030
"doctrine/annotations": "^1.5",
31-
"symfony/form": "^4.0|^5.0",
32-
"symfony/twig-bundle": "^4.0|^5.0"
31+
"symfony/form": "^5.0",
32+
"symfony/twig-bundle": "^5.0"
3333
},
3434
"suggest": {
3535
"squirrelphp/strings-bundle": "Symfony integration of squirrelphp/strings"
@@ -48,17 +48,17 @@
4848
}
4949
},
5050
"scripts": {
51-
"post-install-cmd": ["@composer bin all install --ansi"],
52-
"post-update-cmd": ["@composer bin all update --ansi"],
5351
"phpstan": "vendor/bin/phpstan analyse",
54-
"phpstan_base": "vendor/bin/phpstan analyse --configuration phpstan_base.neon --error-format baselineNeon > phpstan-baseline.neon",
55-
"psalm": "vendor/bin/psalm --show-info=false",
52+
"phpstan_base": "vendor/bin/phpstan analyse --generate-baseline",
53+
"phpstan_clear": "vendor/bin/phpstan clear-result-cache",
54+
"psalm": "vendor/bin/psalm --show-info=false --diff",
55+
"psalm_full": "vendor/bin/psalm --show-info=false",
5656
"psalm_base": "vendor/bin/psalm --set-baseline=psalm-baseline.xml",
5757
"phpunit": "vendor/bin/phpunit --colors=always",
5858
"phpunit_clover": "vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml",
59-
"phpcs": "vendor/bin/phpcs --standard=ruleset.xml --extensions=php --cache src tests",
60-
"phpcsfix": "vendor/bin/phpcbf --standard=ruleset.xml --extensions=php --cache src tests",
6159
"codecoverage": "vendor/bin/phpunit --coverage-html tests/_reports",
60+
"phpcs": "vendor/bin/phpcs --standard=ruleset.xml --extensions=php --cache=.phpcs-cache --colors src tests",
61+
"phpcsfix": "vendor/bin/phpcbf --standard=ruleset.xml --extensions=php --cache=.phpcs-cache src tests",
6262
"binupdate": "@composer bin all update --ansi",
6363
"bininstall": "@composer bin all install --ansi"
6464
}

phpstan_base.neon

Lines changed: 0 additions & 5 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<phpunit
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.3/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.1/phpunit.xsd"
66
backupGlobals="false"
77
colors="true"
88
bootstrap="vendor/autoload.php"

ruleset.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<?xml version="1.0"?>
22
<ruleset name="IQ">
3-
<description>PSR2 with some additional useful sniffs</description>
3+
<description>PSR12 with some additional useful sniffs</description>
44

5-
<!-- Include the whole PSR-2 standard except for line length -->
6-
<rule ref="PSR2">
5+
<!-- Include the whole PSR-12 standard except for line length -->
6+
<rule ref="PSR12">
77
<exclude name="Generic.Files.LineLength"/>
88
</rule>
99

10-
1110
<config name="installed_paths" value="../../slevomat/coding-standard"/>
1211

1312
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>

src/DependencyInjection/Compiler/RandomStringGeneratorPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
class RandomStringGeneratorPass implements CompilerPassInterface
2020
{
2121
/**
22-
* @var array
22+
* @var array<string, string> $defaultGenerators
2323
*/
24-
private $defaultGenerators = [
24+
private array $defaultGenerators = [
2525
'62Characters' => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
2626
'36Characters' => "abcdefghijklmnopqrstuvwxyz0123456789",
2727
'ReadfriendlyUppercase' => "234579ACDEFGHKMNPQRSTUVWXYZ",

src/DependencyInjection/Compiler/StringFilterPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@
4949
*/
5050
class StringFilterPass implements CompilerPassInterface
5151
{
52-
/**
53-
* @var array
54-
*/
55-
private $defaultFilters = [
52+
private array $defaultFilters = [
5653
CamelCaseToSnakeCaseFilter::class,
5754
DecodeAllHTMLEntitiesFilter::class,
5855
DecodeBasicHTMLEntitiesFilter::class,

0 commit comments

Comments
 (0)