Skip to content

Commit

Permalink
chore: removed deprecations and codestyle update
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxes3 committed Mar 25, 2024
1 parent 4c3a971 commit 0a158f9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ jobs:
steps:
- uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
with:
php-version: '8.1'
php-version: '8.2'
- uses: actions/checkout@v2
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit
- name: Check Code Styles
run: vendor/bin/ecs
- name: Check PHPStan
run: vendor/bin/phpstan analyze src tests --level 5
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ install:
ecs:
vendor/bin/ecs --fix

## run tests
test:
vendor/bin/phpunit

## run phpstan
phpstan:
vendor/bin/phpstan analyze src tests --level 5

7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
"twbs/bootstrap-icons": "^1.0"
},
"require-dev": {
"php": ">=8.2",
"whatwedo/php-coding-standard": "^1.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.10",
"symfony/http-kernel": "^7.0",
"symfony/dependency-injection": "^7.0",
"symfony/config": "^7.0"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 1
paths:
- src
- tests
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

class whatwedoTwigBootstrapIconsExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__) . '/Resources/config'));
$loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config'));
$loader->load('config.php');
}
}
10 changes: 5 additions & 5 deletions src/Twig/BootstrapIconsExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BootstrapIconsExtensions extends AbstractExtension
/**
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('bootstrap_icon', [$this, 'getIcon'], [
Expand All @@ -33,12 +33,12 @@ public function getIcon(string $icon, array $attributes = [])
}

array_walk($attributes, static function (&$val, $key) {
$val = $key . '="' . $val . '" ';
$val = $key.'="'.$val.'" ';
});

return str_replace(
'<svg ',
'<svg ' . implode(' ', $attributes),
'<svg '.implode(' ', $attributes),
preg_replace('/class=".*?"/', '', file_get_contents($iconPath))
);
}
Expand All @@ -50,9 +50,9 @@ protected function getIconsPath(): string
}

foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$installed = require $vendorDir . '/composer/installed.php';
$installed = require $vendorDir.'/composer/installed.php';
if (isset($installed['versions']['twbs/bootstrap-icons'])) {
return static::$iconsPath = $vendorDir . '/twbs/bootstrap-icons';
return static::$iconsPath = $vendorDir.'/twbs/bootstrap-icons';
}
}

Expand Down

0 comments on commit 0a158f9

Please sign in to comment.