Skip to content

Commit 6a305f3

Browse files
authored
Merge pull request #2 from ready2order/php8
Added support for PHP 8
2 parents 98b0375 + aac0a13 commit 6a305f3

95 files changed

Lines changed: 3023 additions & 3712 deletions

File tree

Some content is hidden

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

.php_cs

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
11
<?php
22

3-
$finder = Symfony\CS\Finder\DefaultFinder::create();
3+
$finder = PhpCsFixer\Finder::create();
44
$finder->in([
55
__DIR__ . '/src',
66
__DIR__ . '/tests/integration',
77
__DIR__ . '/tests/unit'
88
]);
99

10-
$config = Symfony\CS\Config\Config::create();
11-
$config->setUsingCache(true);
12-
$config->setUsingLinter(false);
13-
$config->finder($finder);
14-
$config->level(Symfony\CS\FixerInterface::PSR2_LEVEL);
15-
$config->fixers([
16-
//symfony
17-
'double_arrow_multiline_whitespaces',
18-
'duplicate_semicolon',
19-
'empty_return',
20-
'extra_empty_lines',
21-
'include',
22-
'join_function',
23-
'multiline_array_trailing_comma',
24-
'namespace_no_leading_whitespace',
25-
'new_with_braces',
26-
'no_blank_lines_after_class_opening',
27-
'object_operator',
28-
'operators_spaces',
29-
'phpdoc_indent',
30-
'phpdoc_params',
31-
'remove_leading_slash_use',
32-
'remove_lines_between_uses',
33-
'return',
34-
'single_array_no_trailing_comma',
35-
'spaces_before_semicolon',
36-
'spaces_cast',
37-
'standardize_not_equal',
38-
'ternary_spaces',
39-
'unused_use',
40-
'whitespacy_lines',
41-
42-
//contrib
43-
'align_double_arrow',
44-
'align_equals',
45-
'concat_with_spaces',
46-
'multiline_spaces_before_semicolon',
47-
'ordered_use',
48-
'short_array_syntax',
49-
]);
10+
$config = PhpCsFixer\Config::create()
11+
->setUsingCache(true)
12+
->setRiskyAllowed(true)
13+
->setFinder($finder)
14+
->setRules([
15+
'@PSR1' => true,
16+
'@PSR2' => true,
17+
'@Symfony' => true,
18+
'@Symfony:risky' => true,
19+
'@PhpCsFixer' => true,
20+
'align_multiline_comment' => true,
21+
'array_syntax' => ['syntax' => 'short'],
22+
'declare_strict_types' => false,
23+
'return_assignment' => false,
24+
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
25+
'dir_constant' => true,
26+
'elseif' => false,
27+
'ereg_to_preg' => true,
28+
'is_null' => true,
29+
'list_syntax' => ['syntax' => 'short'],
30+
'mb_str_functions' => true,
31+
'phpdoc_order' => true,
32+
'concat_space' => ['spacing' => 'one'],
33+
'yoda_style' => [
34+
'equal' => false,
35+
'identical' => false,
36+
'less_and_greater' => false,
37+
],
38+
'fully_qualified_strict_types' => true,
39+
'global_namespace_import' => [
40+
'import_classes' => true,
41+
],
42+
'phpdoc_to_comment' => false,
43+
'method_argument_space' => ['on_multiline' => 'ignore'],
44+
'php_unit_ordered_covers' => false,
45+
'no_superfluous_elseif' => false,
46+
]
47+
);
5048

5149
return $config;

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@
6969
},
7070

7171
"require": {
72-
"php": "~5.6|~7.0",
72+
"php": "^7.4|^8.0",
7373
"guzzlehttp/guzzle": "^6.1",
7474
"composer-runtime-api": "^2.0"
7575
},
7676

7777
"conflict": {
78-
"browscap/browscap-php": "<3,>=4",
78+
"browscap/browscap-php": "^5.0",
7979
"donatj/phpuseragentparser": "<0.5,>=1",
8080
"jenssegers/agent": "<2.3,>=3",
8181
"mobiledetect/mobiledetectlib": "<2.7.5,>=3",
@@ -104,10 +104,9 @@
104104
},
105105

106106
"require-dev": {
107-
"phpunit/phpunit": "^5.6.8",
108-
"friendsofphp/php-cs-fixer": "^1.11",
109-
110-
"browscap/browscap-php": "^3.0",
107+
"phpunit/phpunit": "^9.5",
108+
"friendsofphp/php-cs-fixer": "^2.17.3",
109+
"browscap/browscap-php": "^4.0",
111110
"donatj/phpuseragentparser": "^0.5.0",
112111
"endorphin-studio/browser-detector": "^3.0",
113112
"handsetdetection/php-apikit": "^4.1.10",

phpunit.xml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
stopOnFailure="false"
99
processIsolation="false"
1010
backupGlobals="false"
11-
syntaxCheck="true"
12-
>
11+
>
1312
<testsuites>
1413
<testsuite name="UnitTests">
1514
<directory suffix="Test.php">tests/unit</directory>
@@ -20,14 +19,6 @@
2019
</testsuite>
2120
</testsuites>
2221

23-
<filter>
24-
<whitelist>
25-
<directory suffix=".php">src</directory>
26-
</whitelist>
27-
</filter>
2822

29-
<logging>
30-
<log type="coverage-html" target="./build" charset="UTF-8" highlight="false" lowUpperBound="35" highLowerBound="70"/>
31-
</logging>
3223

3324
</phpunit>

src/Exception/ExceptionInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
2+
23
namespace UserAgentParser\Exception;
34

45
/**
5-
* Interface that in userland you can try/catch/finall all Exceptions from this package together
6+
* Interface that in userland you can try/catch/finall all Exceptions from this package together.
67
*
78
* @author Martin Keckeis <martin.keckeis1@gmail.com>
89
* @license MIT

src/Exception/InvalidArgumentException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
2+
23
namespace UserAgentParser\Exception;
34

45
/**
5-
* Thrown if an invalid argument is provided
6+
* Thrown if an invalid argument is provided.
67
*
78
* @author Martin Keckeis <martin.keckeis1@gmail.com>
89
* @license MIT
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?php
2+
23
namespace UserAgentParser\Exception;
34

5+
use Exception;
6+
47
/**
5-
* This is thrown if a composer package is not loaded
8+
* This is thrown if a composer package is not loaded.
69
*
710
* @author Martin Keckeis <martin.keckeis1@gmail.com>
811
* @license MIT
912
*/
10-
class InvalidCredentialsException extends \Exception implements ExceptionInterface
13+
class InvalidCredentialsException extends Exception implements ExceptionInterface
1114
{
1215
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?php
2+
23
namespace UserAgentParser\Exception;
34

5+
use Exception;
6+
47
/**
5-
* Limitation reached
8+
* Limitation reached.
69
*
710
* @author Martin Keckeis <martin.keckeis1@gmail.com>
811
* @license MIT
912
*/
10-
class LimitationExceededException extends \Exception implements ExceptionInterface
13+
class LimitationExceededException extends Exception implements ExceptionInterface
1114
{
1215
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?php
2+
23
namespace UserAgentParser\Exception;
34

5+
use Exception;
6+
47
/**
58
* This is thrown by the Provider if not result is found.
69
*
710
* @author Martin Keckeis <martin.keckeis1@gmail.com>
811
* @license MIT
912
*/
10-
class NoResultFoundException extends \Exception implements ExceptionInterface
13+
class NoResultFoundException extends Exception implements ExceptionInterface
1114
{
1215
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?php
2+
23
namespace UserAgentParser\Exception;
34

5+
use Exception;
6+
47
/**
5-
* This is thrown if a composer package is not loaded
8+
* This is thrown if a composer package is not loaded.
69
*
710
* @author Martin Keckeis <martin.keckeis1@gmail.com>
811
* @license MIT
912
*/
10-
class PackageNotLoadedException extends \Exception implements ExceptionInterface
13+
class PackageNotLoadedException extends Exception implements ExceptionInterface
1114
{
1215
}

src/Exception/RequestException.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?php
2+
23
namespace UserAgentParser\Exception;
34

5+
use Exception;
6+
47
/**
5-
* A HTTP request failed
8+
* A HTTP request failed.
69
*
710
* @author Martin Keckeis <martin.keckeis1@gmail.com>
811
* @license MIT
912
*/
10-
class RequestException extends \Exception implements ExceptionInterface
13+
class RequestException extends Exception implements ExceptionInterface
1114
{
1215
}

0 commit comments

Comments
 (0)