Skip to content

Commit

Permalink
Minimal PHP version is 7.4 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Jun 6, 2022
1 parent 0df087c commit 0f84f93
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 58 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
strategy:
matrix:
php-version: [ 7.2, 7.3, 7.4, 8.0 ]
php-version: [ 7.4, 8.0, 8.1 ]
composer_flags: [ "--prefer-lowest", "" ]
steps:
- name: Checkout code
Expand All @@ -59,7 +59,7 @@ jobs:
- name: Uploading coverage to coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make report-coveralls --no-print-directory
run: make report-coveralls --no-print-directory || true

- name: Upload Artifacts
uses: actions/upload-artifact@v2
Expand All @@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 7.2, 7.3, 7.4, 8.0 ]
php-version: [ 7.4, 8.0, 8.1 ]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -84,8 +84,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ast
tools: composer
extensions: ast

- name: Build the Project
run: make update --no-print-directory
Expand All @@ -105,7 +105,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 7.2, 7.3, 7.4, 8.0 ]
php-version: [ 7.4, 8.0, 8.1 ]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
37 changes: 20 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name" : "jbzoo/path",
"type" : "library",
"description" : "PHP virtual path library",
"license" : "MIT",
"keywords" : ["url", "jbzoo", "path", "realpath", "filesystem", "virtual path"],
"authors" : [
"name" : "jbzoo/path",
"type" : "library",
"description" : "PHP virtual path library",
"license" : "MIT",
"keywords" : ["url", "jbzoo", "path", "realpath", "filesystem", "virtual path"],
"authors" : [
{
"name" : "Denis Smetannikov",
"email" : "admin@jbzoo.com",
Expand All @@ -16,32 +16,35 @@
}
],

"require" : {
"php" : ">=7.2",
"require" : {
"php" : ">=7.4",

"jbzoo/utils" : "^4.5.0",
"jbzoo/data" : "^4.3.0"
"jbzoo/utils" : "^4.5|^5.0",
"jbzoo/data" : "^4.3|^5.0"
},

"require-dev" : {
"jbzoo/toolbox-dev" : "^3.1.0"
"require-dev" : {
"jbzoo/toolbox-dev" : "^4.0.1"
},

"autoload" : {
"autoload" : {
"psr-4" : {
"JBZoo\\Path\\" : "src"
}
},

"autoload-dev" : {
"autoload-dev" : {
"classmap" : ["tests"]
},

"config" : {
"optimize-autoloader" : true
"config" : {
"optimize-autoloader" : true,
"allow-plugins" : {
"composer/package-versions-deprecated" : true
}
},

"extra" : {
"extra" : {
"branch-alias" : {
"dev-master" : "3.0.x-dev"
}
Expand Down
28 changes: 15 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
@copyright Copyright (C) JBZoo.com, All rights reserved.
@link https://github.com/JBZoo/Path
-->
<phpunit bootstrap="tests/autoload.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
Expand All @@ -23,25 +24,26 @@
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="build/coverage_xml/main.xml"/>
<php outputFile="build/coverage_cov/main.cov"/>
<text outputFile="php://stdout" showUncoveredFiles="false" showOnlySummary="true"/>
</report>
</coverage>

<testsuites>
<testsuite name="All">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-html" target="build/coverage_html" lowUpperBound="75" highLowerBound="95"/>
<log type="coverage-clover" target="build/coverage_xml/main.xml"/>
<log type="coverage-php" target="build/coverage_cov/main.cov"/>
<log type="junit" target="build/coverage_junit/main.xml"/>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false" showOnlySummary="true"/>
<junit outputFile="build/coverage_junit/main.xml"/>
</logging>

</phpunit>
12 changes: 5 additions & 7 deletions src/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ final class Path
*
* @var bool
*/
protected $isReal = true;
protected bool $isReal = true;

/**
* Holds paths list.
*
* @var array
*/
protected $paths = [];
protected array $paths = [];

/**
* Root directory
*
* @var string|null
*/
protected $root;
protected ?string $root;

/**
* Path constructor.
Expand Down Expand Up @@ -534,10 +534,8 @@ protected function resolvePaths(string $alias): array
$result[] = $this->getCurrentPath((string)$path);
}

$result = \array_filter($result); // remove empty
$result = \array_values($result); // reset keys

return $result;
// remove empty && reset keys
return \array_values(\array_filter($result));
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/PathComposerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@
*/
class PathComposerTest extends AbstractComposerTest
{

}
5 changes: 1 addition & 4 deletions tests/PathCopyrightTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
*/
class PathCopyrightTest extends AbstractCopyrightTest
{
/**
* @var string
*/
protected $packageName = 'Path';
protected $packageName = 'Path';
protected $isPhpStrictType = true;
}
9 changes: 1 addition & 8 deletions tests/PathReadmeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,5 @@
*/
class PathReadmeTest extends AbstractReadmeTest
{
protected $packageName = 'Path';

protected function setUp(): void
{
parent::setUp();
$this->params['strict_types'] = true;
$this->params['travis'] = false;
}
protected string $packageName = 'Path';
}
6 changes: 3 additions & 3 deletions tests/PathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ class PathTest extends PHPUnit
/**
* @var string
*/
private $root = '';
private string $root = '';

/**
* @var Filesystem
*/
private $fs;
private Filesystem $fs;

/**
* @var Path
*/
private $path;
private Path $path;

protected function setUp(): void
{
Expand Down

0 comments on commit 0f84f93

Please sign in to comment.