Skip to content

Commit

Permalink
Merge pull request #3 from designcise/3.6x
Browse files Browse the repository at this point in the history
PHP 8.1 update
  • Loading branch information
designcise authored Jan 2, 2022
2 parents 6adee70 + 2dac4e7 commit 9b75c52
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 27 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist: bionic

cache:
apt: true
directories:
Expand All @@ -6,7 +8,7 @@ cache:
language: php

php:
- 8.0.0
- 8.1.0

env:
- XDEBUG_MODE=coverage
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# License

### Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
### Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Install using composer:
$ composer require designcise/bitframe-fastroute
```

Please note that this package requires PHP 8.0 or newer.
Please note that this package requires PHP 8.1.0 or newer.

## Usage Example

Expand Down Expand Up @@ -56,10 +56,6 @@ To run the tests you can use the following commands:
* File issues at https://github.com/designcise/bitframe-fastroute/issues
* Issue patches to https://github.com/designcise/bitframe-fastroute/pulls

## Documentation

Complete documentation for v3 will be available soon.

## License

Please see [License File](LICENSE.md) for licensing information.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
}
],
"require": {
"php": ">=8.0",
"php": ">=8.1",
"psr/http-message": "^1.0",
"psr/http-server-middleware": "~1.0",
"designcise/bitframe": "^3.5"
"designcise/bitframe": "^3.6"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand Down
2 changes: 1 addition & 1 deletion src/ControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/BadRouteException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/MethodNotAllowedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/RouteNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down
16 changes: 8 additions & 8 deletions src/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand All @@ -19,7 +19,7 @@
};

use function strlen;
use function strpos;
use function str_contains;
use function trim;
use function rtrim;
use function is_string;
Expand Down Expand Up @@ -68,7 +68,7 @@ class RouteCollection
* @param string $routePath
* @param mixed $handler
*/
public function add(array $methods, string $routePath, $handler): void
public function add(array $methods, string $routePath, mixed $handler): void
{
$routePathTokens = $this->parsePath($routePath);

Expand All @@ -89,7 +89,7 @@ public function add(array $methods, string $routePath, $handler): void
*
* @param string $route Route string to parse
*
* @return mixed[][] Array of route data arrays
* @return array[] Array of route data arrays
*/
public function parsePath(string $route): array
{
Expand Down Expand Up @@ -197,7 +197,7 @@ public function getAllowedMethods(string $uri): array
*
* @throws BadRouteException
*/
private function addStaticRoute(string $method, string $path, $handler): void
private function addStaticRoute(string $method, string $path, mixed $handler): void
{
if (isset($this->staticRoutes[$method][$path])) {
throw new BadRouteException(sprintf(
Expand Down Expand Up @@ -233,7 +233,7 @@ private function addStaticRoute(string $method, string $path, $handler): void
*
* @throws BadRouteException
*/
private function addVariableRoute(string $method, array $pathData, $handler): void
private function addVariableRoute(string $method, array $pathData, mixed $handler): void
{
[$regex, $vars] = self::buildRegexForRoute($pathData);

Expand All @@ -256,9 +256,9 @@ private function addVariableRoute(string $method, array $pathData, $handler): vo
private static function regexHasCapturingGroups(string $regex): bool
{
// needs to have at least a ( to contain a capturing group
return strpos($regex, '(') !== false
return str_contains($regex, '(')
// semi-accurate detection for capturing groups
&& (bool) preg_match(
&& preg_match(
'~
(?:
\(\?\(
Expand Down
4 changes: 2 additions & 2 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down Expand Up @@ -68,7 +68,7 @@ public function process(

try {
$routeAsMiddleware = $this->getDecoratedMiddleware($route[0]);
} catch (TypeError $e) {
} catch (TypeError) {
throw new RuntimeException('Route controller is invalid or does not exist');
}

Expand Down
2 changes: 1 addition & 1 deletion test/ControllerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/RouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* BitFrame Framework (https://www.bitframephp.com)
*
* @author Daniyal Hamid
* @copyright Copyright (c) 2017-2021 Daniyal Hamid (https://designcise.com)
* @copyright Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
* @license https://bitframephp.com/about/license MIT License
*/

Expand Down

0 comments on commit 9b75c52

Please sign in to comment.