Skip to content

Commit

Permalink
Minimal PHP version is 7.4 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Jun 6, 2022
1 parent f790a34 commit c9b12b7
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 68 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
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
14 changes: 7 additions & 7 deletions composer.json
Expand Up @@ -17,17 +17,17 @@
],

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

"jbzoo/utils" : "^4.5.0",
"jbzoo/path" : "^3.2.0",
"jbzoo/less" : "^4.2.0",
"jbzoo/data" : "^4.3.0"
"jbzoo/utils" : "^4.5|^5.0",
"jbzoo/path" : "^4.0",
"jbzoo/less" : "^5.0",
"jbzoo/data" : "^4.3|^5.0"
},

"require-dev" : {
"jbzoo/toolbox-dev" : "^3.2.0",
"symfony/filesystem" : "^5.2.3"
"jbzoo/toolbox-dev" : "^3.2|^4.0.1",
"symfony/filesystem" : ">=5.2.3"
},

"autoload" : {
Expand Down
28 changes: 15 additions & 13 deletions phpunit.xml.dist
Expand Up @@ -11,7 +11,8 @@
@copyright Copyright (C) JBZoo.com, All rights reserved.
@link https://github.com/JBZoo/Assets
-->
<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="PHPUnit">
<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>
8 changes: 4 additions & 4 deletions src/Asset/AbstractAsset.php
Expand Up @@ -41,7 +41,7 @@ abstract class AbstractAsset
/**
* @var string
*/
protected $alias;
protected string $alias;

/**
* @var string|array
Expand All @@ -51,17 +51,17 @@ abstract class AbstractAsset
/**
* @var array
*/
protected $dependencies = [];
protected array $dependencies = [];

/**
* @var array
*/
protected $options = [];
protected array $options = [];

/**
* @var Manager
*/
protected $eManager;
protected Manager $eManager;

/**
* Asset constructor
Expand Down
2 changes: 1 addition & 1 deletion src/Asset/CssCode.php
Expand Up @@ -28,7 +28,7 @@ final class CssCode extends AbstractAsset
/**
* @var string
*/
protected $type = AbstractAsset::TYPE_CSS_CODE;
protected string $type = AbstractAsset::TYPE_CSS_CODE;

/**
* @inheritDoc
Expand Down
2 changes: 1 addition & 1 deletion src/Asset/JsCode.php
Expand Up @@ -28,7 +28,7 @@ class JsCode extends AbstractFile
/**
* @var string
*/
protected $type = AbstractAsset::TYPE_JS_CODE;
protected string $type = AbstractAsset::TYPE_JS_CODE;

/**
* @inheritDoc
Expand Down
2 changes: 1 addition & 1 deletion src/Asset/JsxCode.php
Expand Up @@ -26,5 +26,5 @@ final class JsxCode extends JsCode
/**
* @var string
*/
protected $type = AbstractAsset::TYPE_JSX_CODE;
protected string $type = AbstractAsset::TYPE_JSX_CODE;
}
2 changes: 1 addition & 1 deletion src/Collection.php
Expand Up @@ -32,7 +32,7 @@ final class Collection implements Countable
*
* @var AbstractAsset[]
*/
protected $assets = [];
protected array $assets = [];

/**
* Collection constructor.
Expand Down
4 changes: 2 additions & 2 deletions src/Factory.php
Expand Up @@ -30,7 +30,7 @@ final class Factory
/**
* @var array
*/
protected $customTypes = [
protected array $customTypes = [
AbstractAsset::TYPE_CSS_CODE => 'CssCode',
AbstractAsset::TYPE_CSS_FILE => 'CssFile',
AbstractAsset::TYPE_JS_CODE => 'JsCode',
Expand All @@ -45,7 +45,7 @@ final class Factory
/**
* @var Manager
*/
protected $eManager;
protected Manager $eManager;

/**
* Factory constructor.
Expand Down
16 changes: 8 additions & 8 deletions src/Manager.php
Expand Up @@ -31,32 +31,32 @@ final class Manager
/**
* @var Factory
*/
protected $factory;
protected Factory $factory;

/**
* @var Collection
*/
protected $collection;
protected Collection $collection;

/**
* @var array
*/
protected $queued = [];
protected array $queued = [];

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

/**
* @var Data
*/
protected $params;
protected Data $params;

/**
* @var array
*/
protected $default = [
protected array $default = [
'debug' => false,
'strict_mode' => false,
'less' => [],
Expand All @@ -68,7 +68,7 @@ final class Manager
* @param Path $path
* @param array $params
*/
public function __construct(Path $path, $params = [])
public function __construct(Path $path, array $params = [])
{
$this->params = new Data(\array_merge($this->default, $params));

Expand Down Expand Up @@ -241,7 +241,7 @@ public function build(): array
* @return AbstractAsset[]
* @throws Exception
*/
protected function resolveDependencies(?AbstractAsset $asset, &$resolved = [], &$unresolved = []): array
protected function resolveDependencies(?AbstractAsset $asset, array &$resolved = [], array &$unresolved = []): array
{
if (!$asset) {
return $resolved;
Expand Down
1 change: 0 additions & 1 deletion tests/AssetsCodestyleTest.php
Expand Up @@ -23,5 +23,4 @@
*/
class AssetsCodestyleTest extends AbstractCodestyleTest
{

}
1 change: 0 additions & 1 deletion tests/AssetsComposerTest.php
Expand Up @@ -24,5 +24,4 @@
*/
class AssetsComposerTest extends AbstractComposerTest
{

}
2 changes: 1 addition & 1 deletion tests/AssetsCopyrightsTest.php
Expand Up @@ -23,6 +23,6 @@
*/
class AssetsCopyrightsTest extends AbstractCopyrightTest
{
protected $packageName = "Assets";
protected $packageName = "Assets";
protected $isPhpStrictType = true;
}
9 changes: 1 addition & 8 deletions tests/AssetsReadmeTest.php
Expand Up @@ -24,12 +24,5 @@
*/
class AssetsReadmeTest extends AbstractReadmeTest
{
protected $packageName = 'Assets';

protected function setUp(): void
{
parent::setUp();
$this->params['strict_types'] = true;
$this->params['travis'] = false;
}
protected string $packageName = 'Assets';
}
4 changes: 2 additions & 2 deletions tests/CssFileTest.php
Expand Up @@ -53,7 +53,7 @@ public function testCreateAssetVirtalPathCSS()
isClass('JBZoo\Assets\Asset\CssFile', $asset);

$result = $asset->load();
isTrue($result[1]);
isTrue((bool)$result[1]);
isSamePath($this->path->get($vpath), $result[1]);
}

Expand All @@ -65,6 +65,6 @@ public function testCreateUndefinedFile()
isClass('JBZoo\Assets\Asset\CssFile', $asset);

$result = $asset->load();
isFalse($result[1]);
isFalse((bool)$result[1]);
}
}
4 changes: 2 additions & 2 deletions tests/FactoryTest.php
Expand Up @@ -33,7 +33,7 @@ public function testDefaultParams()
$params = $this->manager->getParams();

isClass('JBZoo\Data\Data', $params);
isFalse($params->get('debug'));
isFalse((bool)$params->get('debug'));
isSame([], $params->get('less'));

isSame([
Expand All @@ -51,7 +51,7 @@ public function testReloadParams()
]);

$params = $manager->getParams();
isTrue($params->get('debug'));
isTrue((bool)$params->get('debug'));
isSame(123456, $params->get('some_option'));
}

Expand Down
4 changes: 2 additions & 2 deletions tests/JsFileTest.php
Expand Up @@ -53,7 +53,7 @@ public function testCreateAssetVirtalPathJS()
isClass('JBZoo\Assets\Asset\JsFile', $asset);

$result = $asset->load();
isTrue($result[1]);
isTrue((bool)$result[1]);
isSamePath($this->path->get($vpath), $result[1]);
}

Expand All @@ -65,7 +65,7 @@ public function testCreateUndefinedFile()
isClass('JBZoo\Assets\Asset\JsFile', $asset);

$result = $asset->load();
isFalse($result[1]);
isFalse((bool)$result[1]);
}

public function testCreateUndefinedFileStrictMode()
Expand Down
2 changes: 1 addition & 1 deletion tests/LessFileTest.php
Expand Up @@ -50,6 +50,6 @@ public function testLessTryToFindUndefinedFile()

$result = $asset->load();
isSame(AbstractAsset::TYPE_CSS_FILE, $result[0]);
isFalse($result[1]);
isFalse((bool)$result[1]);
}
}
14 changes: 7 additions & 7 deletions tests/PHPUnitAssets.php
Expand Up @@ -33,37 +33,37 @@ abstract class PHPUnitAssets extends PHPUnit
/**
* @var Manager
*/
protected $manager;
protected Manager $manager;

/**
* @var Factory
*/
protected $factory;
protected Factory $factory;

/**
* @var Collection
*/
protected $collection;
protected Collection $collection;

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

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

/**
* @var string
*/
protected $fixtPath;
protected string $fixtPath;

/**
* @var string
*/
protected $cachePath;
protected string $cachePath;

/**
* Setup test data
Expand Down

0 comments on commit c9b12b7

Please sign in to comment.