Skip to content

Commit

Permalink
Add new ContainerAwareInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Apr 5, 2024
1 parent 334cbc6 commit 98588f9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,27 @@ jobs:
- php-version: '7.2'
dependency-versions: 'lowest'
tools: 'composer:v1'
php-cs-fixer: false

- php-version: '7.4'
dependency-versions: 'highest'
tools: 'composer:v2'
php-cs-fixer: false

- php-version: '8.0'
dependency-versions: 'highest'
tools: 'composer:v2'
php-cs-fixer: false

- php-version: '8.1'
dependency-versions: 'highest'
tools: 'composer:v2'
php-cs-fixer: true

- php-version: '8.2'
dependency-versions: 'highest'
tools: 'composer:v2'
php-cs-fixer: false

- php-version: '8.3'
dependency-versions: 'highest'
minimum-stability: 'dev'
tools: 'composer:v2'
php-cs-fixer: false

steps:
- name: Checkout project
Expand All @@ -66,15 +60,33 @@ jobs:
with:
dependency-versions: ${{matrix.dependency-versions}}

- name: Execute test cases
run: vendor/bin/simple-phpunit

lint:
name: 'PHP Lint'
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: 'composer:v2'

- name: Install composer dependencies
uses: ramsey/composer-install@v1
with:
dependency-versions: 'highest'

- name: Run php-cs-fixer
if: ${{ matrix.php-cs-fixer }}
run: |
composer global require friendsofphp/php-cs-fixer --prefer-dist --no-interaction
GLOBAL_BIN_DIR=$(composer global config bin-dir --absolute --quiet)
$GLOBAL_BIN_DIR/php-cs-fixer fix --dry-run --diff
- name: Lint code
run: composer validate --strict

- name: Execute test cases
run: vendor/bin/simple-phpunit
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog for MassiveBuildBundle
================================

* [0.6.0 (2023-04-05)](https://github.com/massiveart/MassiveBuildBundle/releases/tag/0.6.0)
* Introduce own `ContainerAwareInterface` to keep compatibility with Symfony 7.

* [0.5.5 (2023-03-15)](https://github.com/massiveart/MassiveBuildBundle/releases/tag/0.5.5)

* [0.5.4 (2022-04-21)](https://github.com/massiveart/MassiveBuildBundle/releases/tag/0.5.4)

* 0.5.3 (2020-11-11)
* ENHANCEMENT #20 Fix autoloader for composer 2

Expand Down
7 changes: 5 additions & 2 deletions Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Massive\Bundle\BuildBundle\Build\BuilderInterface;
use Massive\Bundle\BuildBundle\Build\BuildRegistry;
use Massive\Bundle\BuildBundle\Console\MassiveOutputFormatter;
use Massive\Bundle\BuildBundle\ContainerAwareInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Helper\Table;
Expand All @@ -23,7 +24,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface as SymfonyContainerAwareInterface
use Symfony\Component\DependencyInjection\ContainerInterface;

class BuildCommand extends Command
Expand Down Expand Up @@ -178,7 +179,9 @@ protected function runBuilders($builders)
foreach ($builders as $builder) {
$this->output->getFormatter()->setIndentLevel(0);

if ($builder instanceof ContainerAwareInterface) {
if ($builder instanceof SymfonyContainerAwareInterface
&& $builder instanceof ContainerAwareInterface
) {
$builder->setContainer($this->container);
}

Expand Down
17 changes: 17 additions & 0 deletions ContainerAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Massive\Bundle\BuildBundle;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface as SymfonyContainerAwareInterface;

if (\class_exists(SymfonyContainerAwareInterface::class)) {
\class_alias(ContainerAwareInterface::class, SymfonyContainerAwareInterface::class);
} else {
interface ContainerAwareInterface {
/**
* @return void
*/
public function setContainer(?ContainerInterface $container = null);
}
}

0 comments on commit 98588f9

Please sign in to comment.