Skip to content

Commit dc54570

Browse files
Rework process handling with symfony/process 5.0 (#23)
* Rework process handling with symfony/process 5.0 Also drop support for php7.1 and symfony/process below 4.0 * Cleanup code by standards * Install english dictionary for functions tests
1 parent 45eff4a commit dc54570

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+149
-146
lines changed

.travis.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,27 @@ language: php
33
sudo: false
44

55
php:
6-
- 7.1
76
- 7.2
87
- 7.3
9-
10-
env:
11-
- PHPCS_FLAGS="--standard=PSR12"
8+
- 7.4
129

1310
matrix:
1411
fast_finish: true
1512
include:
16-
- php: 7.1
17-
env:
18-
- COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
19-
- PHPCS_FLAGS="--standard=PSR2"
2013
- php: 7.2
2114
env:
2215
- PHPUNIT_FLAGS="--coverage-clover build/logs/clover.xml"
23-
- PHPCS_FLAGS="--standard=PSR12"
2416

2517
before_install:
2618
- travis_retry composer self-update
27-
- sudo apt-get install aspell
19+
- sudo apt-get install aspell aspell-en
2820

2921
install:
30-
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction
22+
- travis_retry composer install --no-interaction
3123

3224
script:
3325
- mkdir -p build/logs
34-
- vendor/bin/phpcs ${PHPCS_FLAGS} src/ tests/
26+
- vendor/bin/phpcs --standard=PSR12 src/ tests/
3527
- vendor/bin/phpunit ${PHPUNIT_FLAGS}
3628

3729
after_script:

CHANGELOG.md

Lines changed: 25 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,60 @@
11
# Changelog
22

3-
## Unreleased
4-
5-
### Deleted
3+
## 2.1 - 2020-05-06
4+
### Fixed
5+
- Fixed issue with removed and deprecated methods for `symfony/process:^4.0`
66

7-
- Dropped PHP 5.4 support.
8-
- Dropped Symfony 2 support.
7+
### Changed
8+
- Add requirement for `php:^7.2`
9+
- Changed minimum requirement for `symfony/process` to `^4.4`
910

11+
## 2.0.4 - 2020-04-30
1012
### Added
13+
- Added support for `symfony/process:^5.0` to work with laravel 7 (thanks [@](https://github.com/ibarrajo) [#21](https://github.com/mekras/php-speller/pull/21))
1114

12-
- PHP 7 support.
15+
## 2.0.3 - 2020-04-28
16+
### Fixed
17+
- Resolve an issue with malformed html input (thanks to [@rouliane](https://github.com/rouliane) [#20](https://github.com/mekras/php-speller/pull/20))
1318

14-
## 2.0
19+
## 2.0.2 - 2019-01-25
20+
### Fixed
21+
- backward support for `php:^7.1 and `symfony/process: ^3.4`
22+
23+
## 2.0.1 - 2019-01-18
24+
### Fixed
25+
- Fixed support for hunspell paths on windows OS
1526

27+
## 2.0 - 2019-01-17
28+
### Added
1629
- Add custom dictionary support for aspell
30+
31+
### Changed
1732
- Raise PHP requirement to 7.2
33+
34+
### Removed
1835
- Dropped `@deprecated` interfaces
1936

2037
## 1.7.2 - 2017-04-30
21-
2238
### Fixed
23-
2439
- HtmlFilter: `<script>` content should be filtered out.
2540
- HtmlFilter: only for "keywords" and "description" meta tags "content" attr should be treated as
2641
string.
2742

2843
## 1.7.1 - 2017-04-29
29-
3044
### Fixed
31-
3245
- HtmlFilter: meta tags with http-equiv should be filtered out.
3346

34-
3547
## 1.7 - 2017-03-22
36-
3748
### Fixed
38-
3949
- #6: Failed to execute "hunspell -i UTF-8 -a": Can't open affix or dictionary files for dictionary
4050
named "default".
4151
- FileSource throws SourceException when using "php://stdin".
4252

4353
### Changed
44-
4554
- HtmlSource should throw SourceException on invalid HTML.
4655

47-
4856
## 1.6 - 2017-03-12
49-
5057
### Added
51-
5258
- Aspell — aspell backend.
5359
- Ispell — ispell backend.
5460
- IconvSource — converts text encoding using iconv.
@@ -58,84 +64,53 @@
5864
- Own exceptions.
5965

6066
### Changed
61-
6267
- Hunspell class derived from new Ispell class.
6368
- All sources now implement EncodingAwareSource.
6469
- HtmlSource and XliffSource derived from MetaSource.
6570

66-
6771
## 1.5.1 - 2017-03-11
68-
6972
### Fixed
70-
7173
- HtmlSource: only for "keywords" and "description" meta tags "content" attr should be treated as
7274
user visible text.
7375

74-
7576
## 1.5 - 2017-03-11
76-
7777
### Added
78-
7978
- HtmlSource.
8079

81-
8280
## 1.4.1 - 2016-08-02
83-
8481
### Fixed
85-
8682
- #2: Word suggestions with space splits up
8783

88-
8984
## 1.4 - 2016-04-19
90-
9185
### Deleted
92-
9386
- Dropped PHP 5.4 support.
9487

9588
### Added
96-
9789
- PHP 7 support.
9890
- Symfony 3.x support.
9991

100-
10192
## 1.3.1 - 2015-05-13
102-
10393
### Changed
104-
10594
- Fixed HTML entities filtering in HtmlFilter
10695

107-
10896
## 1.3 - 2015-05-13
109-
11097
### Added
111-
11298
- HtmlFilter added.
11399

114-
115100
## 1.2 - 2015-05-12
116-
117101
### Added
118-
119102
- New feature: Filters.
120103
- FileSource.
121104
- XliffSource for XLIFF translation files.
122105

123106
### Changed
124-
125107
- Forced UTF-8 input encoding for Hunspell.
126108

127-
128109
## 1.1 - 2015-05-08
129-
130110
### Fixed
131-
132111
- Fixed invalid shell arguments escaping.
133-
134112
### Added
135-
136113
- LanguageMapper now supports manual setting of preferred mappings.
137114

138-
139115
## 1.0 - 2015-05-08
140-
141-
Initial release.
116+
Initial release.

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
}
2121
],
2222
"require": {
23-
"php": "~7.1",
24-
"symfony/process": "^3.4 || ^4.0 || ^5.0",
23+
"php": "^7.1",
24+
"symfony/process": "^4.4 || ^5.0",
2525
"ext-iconv": "*",
2626
"ext-dom": "*",
2727
"ext-libxml": "*"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "^7.5",
31-
"php-coveralls/php-coveralls": "^2.0",
32-
"squizlabs/php_codesniffer": "^3.2"
30+
"php-coveralls/php-coveralls": "^2.2",
31+
"phpunit/phpunit": "^8.5",
32+
"squizlabs/php_codesniffer": "^3.5"
3333
},
3434
"autoload": {
3535
"psr-4": {

src/Aspell/Aspell.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
/**
54
* PHP Speller.
@@ -9,6 +8,8 @@
98
* @license http://opensource.org/licenses/MIT MIT
109
*/
1110

11+
declare(strict_types=1);
12+
1213
namespace Mekras\Speller\Aspell;
1314

1415
use Mekras\Speller\Dictionary;
@@ -64,7 +65,7 @@ public function __construct(string $binaryPath = 'aspell')
6465
public function getSupportedLanguages(): array
6566
{
6667
if (null === $this->supportedLanguages) {
67-
$process = $this->createProcess('dump dicts');
68+
$process = $this->createProcess(['dump', 'dicts']);
6869
$process->run();
6970
if (!$process->isSuccessful()) {
7071
throw new ExternalProgramFailedException(
@@ -100,6 +101,7 @@ public function getSupportedLanguages(): array
100101
public function setPersonalDictionary(Dictionary $dictionary): void
101102
{
102103
$this->personalDictionary = $dictionary;
104+
$this->resetProcess();
103105
}
104106

105107
/**

src/Dictionary.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
/**
54
* PHP Speller.
@@ -9,6 +8,8 @@
98
* @license http://opensource.org/licenses/MIT MIT
109
*/
1110

11+
declare(strict_types=1);
12+
1213
namespace Mekras\Speller;
1314

1415
/**

src/Exception/EnvironmentException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
/**
54
* PHP Speller.
@@ -9,6 +8,8 @@
98
* @license http://opensource.org/licenses/MIT MIT
109
*/
1110

11+
declare(strict_types=1);
12+
1213
namespace Mekras\Speller\Exception;
1314

1415
/**

src/Exception/ExternalProgramFailedException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
/**
54
* PHP Speller.
@@ -9,6 +8,8 @@
98
* @license http://opensource.org/licenses/MIT MIT
109
*/
1110

11+
declare(strict_types=1);
12+
1213
namespace Mekras\Speller\Exception;
1314

1415
/**

src/Exception/PhpSpellerException.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
/**
54
* PHP Speller.
@@ -9,14 +8,18 @@
98
* @license http://opensource.org/licenses/MIT MIT
109
*/
1110

11+
declare(strict_types=1);
12+
1213
namespace Mekras\Speller\Exception;
1314

15+
use Throwable;
16+
1417
/**
1518
* Common interface for all Speller exceptions.
1619
*
1720
* @since 1.6
1821
*/
19-
interface PhpSpellerException
22+
interface PhpSpellerException extends Throwable
2023
{
2124
/**
2225
* @return string

src/Exception/RuntimeException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
/**
54
* PHP Speller.
@@ -9,6 +8,8 @@
98
* @license http://opensource.org/licenses/MIT MIT
109
*/
1110

11+
declare(strict_types=1);
12+
1213
namespace Mekras\Speller\Exception;
1314

1415
/**

src/Exception/SourceException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
/**
54
* PHP Speller.
@@ -9,6 +8,8 @@
98
* @license http://opensource.org/licenses/MIT MIT
109
*/
1110

11+
declare(strict_types=1);
12+
1213
namespace Mekras\Speller\Exception;
1314

1415
/**

0 commit comments

Comments
 (0)