Skip to content

Commit 26175b1

Browse files
authored
Merge pull request #493 from barbushin/develop
- Dropped PHP 5.6 support, as it went end-of-life (EOL) on the 31st of December, 2018: https://www.php.net/eol.php - Dropped PHP 7.0 support, as it went end-of-life (EOL) on the 10th of January, 2019: https://www.php.net/eol.php - Dropped PHP 7.1 support, as it went end-of-life (EOL) on the 1st of December, 2019: https://www.php.net/eol.php - #403, #447, #479: Improved MIME decoding - #485: Fixed ENCBASE64 decoding - Fixed all Travis CI issues - Updated psalm baseline - Satisfied php-cs-fixer - Added phpcpd to detect duplicated code - Added phpmnd to detect magic numbers - PHPUnit: Added and improved / updated test cases - PR #485: Added some test cases for base64 decoding - Fully replaced `Mailbox::convertStringEncoding()` with `Mailbox::decodeMimeStr()` - Improved `composer.json` - Updated README with PHP version overview - Updated requirements in README - Updated badges in README - Removed not yet working OAuth code - This and all upcoming releases contain a Travis CI LIVE mailbox test
2 parents 1df5b8b + 2fe1496 commit 26175b1

24 files changed

+644
-1519
lines changed

.php_cs.dist

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@ return PhpCsFixer\Config::create()
1010
'ordered_imports' => true,
1111
'phpdoc_to_comment' => false,
1212
'no_superfluous_phpdoc_tags' => true,
13+
'declare_strict_types' => true,
14+
'void_return' => true,
1315
'ordered_class_elements' => true,
1416
'global_namespace_import' => [
1517
'import_classes' => true,
1618
'import_constants' => true,
1719
'import_functions' => false,
1820
],
1921
'native_function_invocation' => true,
22+
'php_unit_test_case_static_method_calls' => [
23+
'call_type' => 'this',
24+
],
25+
'php_unit_method_casing' => true,
26+
'php_unit_dedicate_assert' => [
27+
'target' => 'newest',
28+
],
2029
])
2130
->setRiskyAllowed(true)
2231
->setFinder(

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ env:
55
language: php
66

77
php:
8-
- 5.6
9-
- 7.0
10-
- 7.1
8+
- 7.2.0
119
- 7.2
1210
- 7.3
1311

@@ -17,10 +15,10 @@ env:
1715
matrix:
1816
fast_finish: true
1917
include:
20-
- php: 5.6
18+
- php: 7.2.0
2119
dist: xenial
2220
env:
23-
- lint="php-cs-fixer"
21+
- lint="yes"
2422
- phpunitflags="do not run"
2523
- php: 7.4
2624
dist: bionic
@@ -45,15 +43,15 @@ before_script:
4543
- if [[ "$coverage" = "yes" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
4644
- if [[ "$coverage" = "yes" ]]; then chmod +x ./cc-test-reporter; fi
4745
- if [[ "$coverage" = "yes" ]]; then ./cc-test-reporter before-build; fi
48-
- if [[ "$analysis" = "yes" ]]; then composer require --dev paragonie/hidden-string; fi
49-
- if [[ "$analysis" = "yes" ]]; then composer require --dev --update-with-dependencies "phpunit/phpunit:<9" vimeo/psalm psalm/plugin-phpunit maglnet/composer-require-checker:^2.0; fi
5046

5147
script:
5248
- if [[ "$lint" != "no" ]]; then vendor/bin/parallel-lint .php_cs.dist src tests examples; fi
5349
- if [[ "$phpunitflags" != "do not run" ]]; then vendor/bin/phpunit $phpunitflags; fi
5450
- if [[ "$analysis" = "yes" ]]; then vendor/bin/composer-require-checker check ./composer.json; fi
51+
- if [[ "$analysis" = "yes" ]]; then vendor/bin/phpmnd ./ --exclude=./.github/ --exclude=./examples/ --exclude=./vendor/ --exclude=./psalm/cache/ --non-zero-exit-on-violation --hint; fi
5552
- if [[ "$analysis" = "yes" ]]; then vendor/bin/psalm --show-info=false --shepherd --diff --diff-methods; fi
56-
- if [[ "$lint" = "php-cs-fixer" ]]; then vendor/bin/php-cs-fixer fix --allow-risky=yes --no-interaction --dry-run --diff-format=udiff -v; fi
53+
- if [[ "$lint" = "yes" ]]; then vendor/bin/php-cs-fixer fix --allow-risky=yes --no-interaction --dry-run --diff-format=udiff -v; fi
54+
- if [[ "$lint" = "yes" ]]; then vendor/bin/phpcpd src tests; fi
5755

5856
after_script:
5957
- if [[ "$coverage" = "yes" ]]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -t clover; fi

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
55
[![Packagist](https://img.shields.io/packagist/dt/php-imap/php-imap.svg?style=flat-square)](https://packagist.org/packages/php-imap/php-imap)
66
[![Build Status](https://travis-ci.org/barbushin/php-imap.svg?branch=master)](https://travis-ci.org/barbushin/php-imap)
7-
[![Supported PHP Version](https://img.shields.io/packagist/php-v/php-imap/php-imap/3.0.8.svg)](README.md)
7+
[![Supported PHP Version](https://img.shields.io/packagist/php-v/php-imap/php-imap.svg)](README.md)
88
[![Maintainability](https://api.codeclimate.com/v1/badges/02f72a4fd695cb7e2976/maintainability)](https://codeclimate.com/github/barbushin/php-imap/maintainability)
9-
[![Coverage](https://api.codeclimate.com/v1/badges/02f72a4fd695cb7e2976/test_coverage)](https://codeclimate.com/github/barbushin/php-imap/test_coverage)
9+
[![Test Coverage](https://api.codeclimate.com/v1/badges/02f72a4fd695cb7e2976/test_coverage)](https://codeclimate.com/github/barbushin/php-imap/test_coverage)
1010
[![Type Coverage](https://shepherd.dev/github/barbushin/php-imap/coverage.svg)](https://shepherd.dev/github/barbushin/php-imap)
1111

1212
Initially released in December 2012, the PHP IMAP Mailbox is a powerful and open source library to connect to a mailbox by POP3, IMAP and NNTP using the PHP IMAP extension. This library allows you to fetch emails from your email server. Extend the functionality or create powerful web applications to handle your incoming emails.
@@ -22,10 +22,19 @@ Initially released in December 2012, the PHP IMAP Mailbox is a powerful and open
2222

2323
### Requirements
2424

25-
* PHP 5.6, 7.0, 7.1, 7.2, 7.3 or 7.4
25+
| PHP Version | php-imap Version |
26+
| ------------- | ------------- |
27+
| 5.6 | 3.x |
28+
| 7.0 | 3.x |
29+
| 7.1 | 3.x |
30+
| 7.2 | 3.x, 4.x |
31+
| 7.3 | 3.x, 4.x |
32+
| 7.4 | >3.0.33, 4.x |
33+
34+
* PHP `fileinfo` extension must be present; so make sure this line is active in your php.ini: `extension=php_fileinfo.dll`
35+
* PHP `iconv` extension must be present; so make sure this line is active in your php.ini: `extension=php_iconv.dll`
2636
* PHP `imap` extension must be present; so make sure this line is active in your php.ini: `extension=php_imap.dll`
2737
* PHP `mbstring` extension must be present; so make sure this line is active in your php.ini: `extension=php_mbstring.dll`
28-
* PHP `iconv` extension must be present, if `mbstring` is not available; so make sure this line is active in your php.ini: `extension=php_iconv.dll`
2938

3039
### Installation by Composer
3140

@@ -41,9 +50,15 @@ Install the latest available and may unstable source code from `develop`, which
4150

4251
$ composer require php-imap/php-imap:dev-develop
4352

44-
### PHPUnit Tests
53+
### Run Tests
4554

46-
Before you can run the PHPUnit tests you may need to run `composer install` to install all (development) dependencies.
55+
Before you can run the any tests you may need to run `composer install` to install all (development) dependencies.
56+
57+
#### Run all tests
58+
59+
You can run all available tests by running the following command (inside of the installed `php-imap` directory): `composer run tests`
60+
61+
#### Run only PHPUnit tests
4762

4863
You can run all PHPUnit tests by running the following command (inside of the installed `php-imap` directory): `php vendor/bin/phpunit --testdox`
4964

composer.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"sort-packages": true
2424
},
2525
"require": {
26-
"php": ">=5.6",
26+
"php": "^7.2",
2727
"ext-fileinfo": "*",
2828
"ext-iconv": "*",
2929
"ext-imap": "*",
@@ -32,16 +32,24 @@
3232
"require-dev": {
3333
"friendsofphp/php-cs-fixer": "^2.16",
3434
"jakub-onderka/php-parallel-lint": "^1.0",
35-
"paragonie/random_compat": "^1",
36-
"phpunit/phpunit": "^5.7"
35+
"maglnet/composer-require-checker": "^2.0",
36+
"paragonie/hidden-string": "^1.0",
37+
"phpunit/phpunit": "^8.5",
38+
"povils/phpmnd": "^2.2",
39+
"psalm/plugin-phpunit": "^0.10.0",
40+
"roave/security-advisories": "dev-master",
41+
"sebastian/phpcpd": "^4.1",
42+
"vimeo/psalm": "^3.11"
3743
},
3844
"scripts": {
3945
"tests": [
4046
"parallel-lint .php_cs.dist src tests examples",
41-
"phpunit",
47+
"phpcpd src tests",
48+
"phpunit --testdox",
4249
"composer-require-checker check ./composer.json",
43-
"psalm --show-info=false",
44-
"php-cs-fixer fix --allow-risky=yes --no-interaction --dry-run --diff-format=udiff -v"
50+
"phpmnd ./ --exclude=./.github/ --exclude=./examples/ --exclude=./vendor/ --non-zero-exit-on-violation --hint",
51+
"php-cs-fixer fix --allow-risky=yes --no-interaction --dry-run --diff-format=udiff -v",
52+
"psalm --show-info=false"
4553
]
4654
},
4755
"suggest": {

examples/get_and_parse_all_emails_with_matching_subject.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
*
66
* @author Sebastian Krätzig <[email protected]>
77
*/
8+
declare(strict_types=1);
9+
810
require_once __DIR__.'/../vendor/autoload.php';
11+
912
use PhpImap\Exceptions\ConnectionException;
1013
use PhpImap\Mailbox;
1114

examples/get_and_parse_all_emails_without_saving_attachments.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
*
66
* @author Sebastian Krätzig <[email protected]>
77
*/
8+
declare(strict_types=1);
9+
810
require_once __DIR__.'/../vendor/autoload.php';
11+
912
use PhpImap\Exceptions\ConnectionException;
1013
use PhpImap\Mailbox;
1114

examples/get_and_parse_unseen_emails.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
*
66
* @author Sebastian Krätzig <[email protected]>
77
*/
8+
declare(strict_types=1);
9+
810
require_once __DIR__.'/../vendor/autoload.php';
11+
912
use PhpImap\Exceptions\ConnectionException;
1013
use PhpImap\Mailbox;
1114

examples/get_and_parse_unseen_emails_save_attachments_one_by_one.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
*
66
* @author Sebastian Krätzig <[email protected]>
77
*/
8+
declare(strict_types=1);
9+
810
require_once __DIR__.'/../vendor/autoload.php';
11+
912
use PhpImap\Exceptions\ConnectionException;
1013
use PhpImap\Mailbox;
1114

0 commit comments

Comments
 (0)