Skip to content

Commit

Permalink
Rework process handling with symfony/process 5.0 (#23)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
icanhazstring authored May 17, 2020
1 parent 45eff4a commit dc54570
Show file tree
Hide file tree
Showing 41 changed files with 149 additions and 146 deletions.
16 changes: 4 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,27 @@ language: php
sudo: false

php:
- 7.1
- 7.2
- 7.3

env:
- PHPCS_FLAGS="--standard=PSR12"
- 7.4

matrix:
fast_finish: true
include:
- php: 7.1
env:
- COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
- PHPCS_FLAGS="--standard=PSR2"
- php: 7.2
env:
- PHPUNIT_FLAGS="--coverage-clover build/logs/clover.xml"
- PHPCS_FLAGS="--standard=PSR12"

before_install:
- travis_retry composer self-update
- sudo apt-get install aspell
- sudo apt-get install aspell aspell-en

install:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction
- travis_retry composer install --no-interaction

script:
- mkdir -p build/logs
- vendor/bin/phpcs ${PHPCS_FLAGS} src/ tests/
- vendor/bin/phpcs --standard=PSR12 src/ tests/
- vendor/bin/phpunit ${PHPUNIT_FLAGS}

after_script:
Expand Down
75 changes: 25 additions & 50 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
# Changelog

## Unreleased

### Deleted
## 2.1 - 2020-05-06
### Fixed
- Fixed issue with removed and deprecated methods for `symfony/process:^4.0`

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

## 2.0.4 - 2020-04-30
### Added
- 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))

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

## 2.0
## 2.0.2 - 2019-01-25
### Fixed
- backward support for `php:^7.1 and `symfony/process: ^3.4`

## 2.0.1 - 2019-01-18
### Fixed
- Fixed support for hunspell paths on windows OS

## 2.0 - 2019-01-17
### Added
- Add custom dictionary support for aspell

### Changed
- Raise PHP requirement to 7.2

### Removed
- Dropped `@deprecated` interfaces

## 1.7.2 - 2017-04-30

### Fixed

- HtmlFilter: `<script>` content should be filtered out.
- HtmlFilter: only for "keywords" and "description" meta tags "content" attr should be treated as
string.

## 1.7.1 - 2017-04-29

### Fixed

- HtmlFilter: meta tags with http-equiv should be filtered out.


## 1.7 - 2017-03-22

### Fixed

- #6: Failed to execute "hunspell -i UTF-8 -a": Can't open affix or dictionary files for dictionary
named "default".
- FileSource throws SourceException when using "php://stdin".

### Changed

- HtmlSource should throw SourceException on invalid HTML.


## 1.6 - 2017-03-12

### Added

- Aspell — aspell backend.
- Ispell — ispell backend.
- IconvSource — converts text encoding using iconv.
Expand All @@ -58,84 +64,53 @@
- Own exceptions.

### Changed

- Hunspell class derived from new Ispell class.
- All sources now implement EncodingAwareSource.
- HtmlSource and XliffSource derived from MetaSource.


## 1.5.1 - 2017-03-11

### Fixed

- HtmlSource: only for "keywords" and "description" meta tags "content" attr should be treated as
user visible text.


## 1.5 - 2017-03-11

### Added

- HtmlSource.


## 1.4.1 - 2016-08-02

### Fixed

- #2: Word suggestions with space splits up


## 1.4 - 2016-04-19

### Deleted

- Dropped PHP 5.4 support.

### Added

- PHP 7 support.
- Symfony 3.x support.


## 1.3.1 - 2015-05-13

### Changed

- Fixed HTML entities filtering in HtmlFilter


## 1.3 - 2015-05-13

### Added

- HtmlFilter added.


## 1.2 - 2015-05-12

### Added

- New feature: Filters.
- FileSource.
- XliffSource for XLIFF translation files.

### Changed

- Forced UTF-8 input encoding for Hunspell.


## 1.1 - 2015-05-08

### Fixed

- Fixed invalid shell arguments escaping.

### Added

- LanguageMapper now supports manual setting of preferred mappings.


## 1.0 - 2015-05-08

Initial release.
Initial release.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
}
],
"require": {
"php": "~7.1",
"symfony/process": "^3.4 || ^4.0 || ^5.0",
"php": "^7.1",
"symfony/process": "^4.4 || ^5.0",
"ext-iconv": "*",
"ext-dom": "*",
"ext-libxml": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"php-coveralls/php-coveralls": "^2.0",
"squizlabs/php_codesniffer": "^3.2"
"php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 4 additions & 2 deletions src/Aspell/Aspell.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* PHP Speller.
Expand All @@ -9,6 +8,8 @@
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Mekras\Speller\Aspell;

use Mekras\Speller\Dictionary;
Expand Down Expand Up @@ -64,7 +65,7 @@ public function __construct(string $binaryPath = 'aspell')
public function getSupportedLanguages(): array
{
if (null === $this->supportedLanguages) {
$process = $this->createProcess('dump dicts');
$process = $this->createProcess(['dump', 'dicts']);
$process->run();
if (!$process->isSuccessful()) {
throw new ExternalProgramFailedException(
Expand Down Expand Up @@ -100,6 +101,7 @@ public function getSupportedLanguages(): array
public function setPersonalDictionary(Dictionary $dictionary): void
{
$this->personalDictionary = $dictionary;
$this->resetProcess();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Dictionary.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* PHP Speller.
Expand All @@ -9,6 +8,8 @@
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Mekras\Speller;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Exception/EnvironmentException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* PHP Speller.
Expand All @@ -9,6 +8,8 @@
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Mekras\Speller\Exception;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Exception/ExternalProgramFailedException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* PHP Speller.
Expand All @@ -9,6 +8,8 @@
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Mekras\Speller\Exception;

/**
Expand Down
7 changes: 5 additions & 2 deletions src/Exception/PhpSpellerException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* PHP Speller.
Expand All @@ -9,14 +8,18 @@
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Mekras\Speller\Exception;

use Throwable;

/**
* Common interface for all Speller exceptions.
*
* @since 1.6
*/
interface PhpSpellerException
interface PhpSpellerException extends Throwable
{
/**
* @return string
Expand Down
3 changes: 2 additions & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* PHP Speller.
Expand All @@ -9,6 +8,8 @@
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Mekras\Speller\Exception;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Exception/SourceException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* PHP Speller.
Expand All @@ -9,6 +8,8 @@
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Mekras\Speller\Exception;

/**
Expand Down
Loading

0 comments on commit dc54570

Please sign in to comment.