Skip to content

Commit 31ccd48

Browse files
committed
Use rector to update code quality. Limit install for PHP >8.1 <8.4
1 parent b5f4e07 commit 31ccd48

3 files changed

Lines changed: 24 additions & 9 deletions

File tree

Observer/RegisterModuleForHyvaConfig.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,21 @@
1010

1111
class RegisterModuleForHyvaConfig implements ObserverInterface
1212
{
13-
private $componentRegistrar;
14-
15-
public function __construct(ComponentRegistrar $componentRegistrar)
13+
public function __construct(private readonly ComponentRegistrar $componentRegistrar)
1614
{
17-
$this->componentRegistrar = $componentRegistrar;
1815
}
1916

2017
public function execute(Observer $event)
2118
{
2219
$config = $event->getData('config');
2320
$extensions = $config->hasData('extensions') ? $config->getData('extensions') : [];
2421

25-
$moduleName = implode('_', array_slice(explode('\\', __CLASS__), 0, 2));
22+
$moduleName = implode('_', array_slice(explode('\\', self::class), 0, 2));
2623

2724
$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName);
2825

2926
// Only use the path relative to the Magento base dir
30-
$extensions[] = ['src' => substr($path, strlen(BP) + 1)];
27+
$extensions[] = ['src' => substr((string) $path, strlen(BP) + 1)];
3128

3229
$config->setData('extensions', $extensions);
3330
}

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"name": "proxi-blue/hyva-qtyinput",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "Enhance QTY input to honour min/max and increment values",
55
"type": "magento2-module",
66
"require": {
7-
"magento/framework": "*"
7+
"magento/framework": "*",
8+
"php": ">=8.2 <8.4"
89
},
910
"license": [
1011
"MIT"
1112
],
1213
"authors": [
1314
{
1415
"name": "Lucas van Staden",
15-
"email": "sales@proxiblue.com.au"
16+
"email": "lucas@proxiblue.com.au"
1617
}
1718
],
1819
"autoload": {

rector.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
6+
use Rector\Config\RectorConfig;
7+
use Rector\Set\ValueObject\LevelSetList;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->paths([
11+
__DIR__ . '/',
12+
]);
13+
14+
$rectorConfig->sets([
15+
LevelSetList::UP_TO_PHP_83
16+
]);
17+
};

0 commit comments

Comments
 (0)