Skip to content

Commit fba68d9

Browse files
author
Anton Shevchuk
committed
Update to new major versions
1 parent 58e13c6 commit fba68d9

File tree

9 files changed

+49
-32
lines changed

9 files changed

+49
-32
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
language: php
22
php:
3-
- 7.1
4-
- 7.2
53
- 7.3
4+
- 7.4
65
- master
76
matrix:
87
allow_failures:
@@ -13,7 +12,7 @@ install:
1312
- composer install
1413
script:
1514
# Code style
16-
- php vendor/bin/phpcs ./src --standard=PSR1,PSR2 --encoding=utf-8
15+
- php vendor/bin/phpcs ./src --standard=PSR12 --encoding=utf-8
1716
# PHPUnit tests
1817
- php vendor/bin/phpunit --configuration ./phpunit.xml.dist
1918
notifications:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Composer Installer for Bluz
22
## Achievements
33

4-
[![PHP >= 7.1+](https://img.shields.io/packagist/php-v/bluzphp/composer-plugin.svg?style=flat)](https://php.net/)
4+
[![PHP >= 7.3+](https://img.shields.io/packagist/php-v/bluzphp/composer-plugin.svg?style=flat)](https://php.net/)
55

66
[![Latest Stable Version](https://img.shields.io/packagist/v/bluzphp/composer-plugin.svg?label=version&style=flat)](https://packagist.org/packages/bluzphp/composer-plugin)
77

@@ -19,7 +19,7 @@
1919

2020
## Requirements
2121

22-
* PHP: 7.1 (or later)
22+
* PHP: 7.3 (or later)
2323

2424
## Available modules
2525

@@ -59,7 +59,7 @@ php ./vendor/bin/bluzman module:remove options
5959

6060
## License
6161

62-
The project is developed by [NIX Solutions][1] PHP team and distributed under [MIT LICENSE][2]
62+
The project is developed by [NIX][1] PHP team and distributed under [MIT LICENSE][2]
6363

6464
[1]: http://nixsolutions.com
6565
[2]: https://raw.github.com/bluzphp/composer-plugin/master/LICENSE.md

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
"homepage": "https://github.com/bluzphp/composer-plugin",
77
"license": "MIT",
88
"require": {
9-
"php": ">=7.1",
10-
"composer-plugin-api": "~1.0",
11-
"symfony/filesystem": "~3.0",
12-
"symfony/finder": "~3.0"
9+
"php": ">=7.3",
10+
"composer-plugin-api": "^2.0",
11+
"symfony/filesystem": "~5.3",
12+
"symfony/finder": "~5.3"
1313
},
1414
"require-dev": {
15-
"composer/composer": "~1.8",
16-
"composer/installers": "~1.6",
17-
"squizlabs/php_codesniffer": "~3.4",
18-
"phpunit/phpunit": "~7.0"
15+
"composer/composer": "^2.0",
16+
"composer/installers": "~1.11",
17+
"phpunit/phpunit": "~9.5",
18+
"squizlabs/php_codesniffer": "~3.6"
1919
},
2020
"autoload": {
2121
"psr-4": {

src/Installers/Installer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Bluz composer installer
45
*
@@ -40,7 +41,7 @@ public function getInstallPath(PackageInterface $package): string
4041
*
4142
* {@inheritDoc}
4243
*/
43-
public function supports($packageType)
44+
public function supports($packageType): bool
4445
{
4546
return $packageType === 'bluz-module';
4647
}

src/Installers/Plugin.php

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Bluz composer plugin
45
*
@@ -155,7 +156,7 @@ public function copyProjectExtraFiles(Event $event): void
155156
public function copyModuleFiles(PackageEvent $event): void
156157
{
157158
$package = $this->extractPackage($event);
158-
$this->packagePath = $this->vendorPath .DS. $package->getName();
159+
$this->packagePath = $this->vendorPath . DS . $package->getName();
159160
if ($package->getType() === 'bluz-module' && file_exists($this->packagePath)) {
160161
if ($package->getExtra() && isset($package->getExtra()['copy-files'])) {
161162
$this->copyExtras($package->getExtra()['copy-files']);
@@ -173,7 +174,7 @@ public function copyModuleFiles(PackageEvent $event): void
173174
public function removeModuleFiles(PackageEvent $event): void
174175
{
175176
$package = $this->extractPackage($event);
176-
$this->packagePath = $this->vendorPath .DS. $package->getName();
177+
$this->packagePath = $this->vendorPath . DS . $package->getName();
177178
if ($package->getType() === 'bluz-module' && file_exists($this->packagePath)) {
178179
if ($package->getExtra() && isset($package->getExtra()['copy-files'])) {
179180
$this->removeExtras($package->getExtra()['copy-files']);
@@ -222,12 +223,12 @@ protected function copyModule(): void
222223
/**
223224
* copyExtras
224225
*
225-
* @param array $files
226+
* @param array $files
226227
*
227228
* @return void
228229
* @throws \InvalidArgumentException
229230
*/
230-
protected function copyExtras($files): void
231+
protected function copyExtras(array $files): void
231232
{
232233
foreach ($files as $source => $target) {
233234
$this->copy(
@@ -246,7 +247,7 @@ protected function copyExtras($files): void
246247
* @return void
247248
* @throws \InvalidArgumentException
248249
*/
249-
protected function copy($source, $target): void
250+
protected function copy(string $source, string $target): void
250251
{
251252
// skip, if not exists
252253
if (!file_exists($source)) {
@@ -288,7 +289,7 @@ protected function copy($source, $target): void
288289
}
289290

290291
if (is_dir($source)) {
291-
$finder = new Finder;
292+
$finder = new Finder();
292293
$finder->files()->in($source);
293294

294295
foreach ($finder as $file) {
@@ -341,11 +342,11 @@ protected function removeModule(): void
341342
/**
342343
* removeExtras
343344
*
344-
* @param array $files
345+
* @param array $files
345346
*
346347
* @return void
347348
*/
348-
protected function removeExtras($files): void
349+
protected function removeExtras(array $files): void
349350
{
350351
foreach ($files as $source => $target) {
351352
$this->installer->getIo()->write(
@@ -367,13 +368,15 @@ protected function remove($directory): void
367368
if (!is_dir($sourcePath)) {
368369
return;
369370
}
370-
foreach ($iterator = new \RecursiveIteratorIterator(
371-
new \RecursiveDirectoryIterator(
372-
$sourcePath,
373-
\RecursiveDirectoryIterator::SKIP_DOTS
374-
),
375-
\RecursiveIteratorIterator::CHILD_FIRST
376-
) as $item) {
371+
foreach (
372+
$iterator = new \RecursiveIteratorIterator(
373+
new \RecursiveDirectoryIterator(
374+
$sourcePath,
375+
\RecursiveDirectoryIterator::SKIP_DOTS
376+
),
377+
\RecursiveIteratorIterator::CHILD_FIRST
378+
) as $item
379+
) {
377380
// path to copied file
378381
$current = PATH_ROOT . DS . $directory . DS . $iterator->getSubPathName();
379382

@@ -422,4 +425,14 @@ protected function remove($directory): void
422425
}
423426
}
424427
}
428+
429+
public function deactivate(Composer $composer, IOInterface $io)
430+
{
431+
// TODO: Implement deactivate() method.
432+
}
433+
434+
public function uninstall(Composer $composer, IOInterface $io)
435+
{
436+
// TODO: Implement uninstall() method.
437+
}
425438
}

tests/_bootstrap.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
// This is global bootstrap for autoloading
34
// Environment
45
define('DEBUG', true);
@@ -12,4 +13,4 @@
1213

1314
// init autoloader
1415
$loader = require PATH_ROOT . '/vendor/autoload.php';
15-
$loader->addPsr4('Bluz\\Tests\\', __DIR__ .'/src');
16+
$loader->addPsr4('Bluz\\Tests\\', __DIR__ . '/src');

tests/src/Installers/InstallerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright Bluz PHP Team
45
* @link https://github.com/bluzphp/framework

tests/src/Installers/PluginTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright Bluz PHP Team
45
* @link https://github.com/bluzphp/framework

tests/src/TestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright Bluz PHP Team
45
* @link https://github.com/bluzphp/framework
@@ -41,7 +42,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
4142
*/
4243
private $installer;
4344

44-
public function setUp()
45+
public function setUp(): void
4546
{
4647
$this->io = $this->createMock('Composer\IO\NullIO');
4748
$this->config = new Config();

0 commit comments

Comments
 (0)