Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set COMPOSER_ROOT_VERSION environment variable
uses: ergebnis/composer-root-version-action@0.2.0
with:
branch: master

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
env:
Expand All @@ -37,8 +42,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Allow cyclic dependency between block-bundle and admin-bundle
run: sed --in-place "s/\"dev-master\":/\"dev-${GITHUB_SHA}\":/" composer.json
- name: Set COMPOSER_ROOT_VERSION environment variable
uses: ergebnis/composer-root-version-action@0.2.0
with:
branch: master

- name: Psalm
uses: docker://vimeo/psalm-github-actions
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ jobs:
if: matrix.variant != 'normal'
run: composer require ${{ matrix.variant }} --no-update

- name: Allow cyclic dependency between block-bundle and admin-bundle
run: sed --in-place "s/\"dev-master\":/\"dev-${GITHUB_SHA}\":/" composer.json
- name: Set COMPOSER_ROOT_VERSION environment variable
uses: ergebnis/composer-root-version-action@0.2.0
with:
branch: master

- name: Install Composer dependencies (lowest)
if: matrix.dependencies == 'lowest'
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@
"knplabs/knp-menu": "^3.1",
"knplabs/knp-menu-bundle": "^3.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"psalm/plugin-symfony": "^1.4",
"sonata-project/admin-bundle": "^3.28",
"symfony/debug": "^4.4",
"symfony/phpunit-bridge": "^5.1.1",
"symfony/stopwatch": "^4.4 || ^5.1"
"symfony/phpunit-bridge": "^5.1.4",
"symfony/stopwatch": "^4.4 || ^5.1",
"vimeo/psalm": "^3.13.1"
},
"suggest": {
"knplabs/knp-menu-bundle": "In order to use MenuBlockService."
Expand Down
15 changes: 15 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
parameters:
level: 0

paths:
- src

bootstrapFiles:
- vendor/autoload.php

excludes_analyse:
- src/Annotation/Block.php
- src/Meta/Metadata.php
- src/Meta/MetadataInterface.php
- src/Test/AbstractBlockServiceTestCase.php
- src/Test/BlockServiceTestCase.php
62 changes: 62 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.17.2@9e526d9cb569fe4631e6a737bbb7948d05596e3f">
<file src="src/Annotation/Block.php">
<UndefinedClass occurrences="1">
<code>MetadataProcessorInterface</code>
</UndefinedClass>
</file>
<file src="src/Block/BlockRenderer.php">
<ParamNameMismatch occurrences="1">
<code>$blockContext</code>
</ParamNameMismatch>
</file>
<file src="src/Block/BlockServiceManager.php">
<ParamNameMismatch occurrences="1">
<code>$context</code>
</ParamNameMismatch>
</file>
<file src="src/Block/Service/AbstractAdminBlockService.php">
<ParamNameMismatch occurrences="1">
<code>$formMapper</code>
</ParamNameMismatch>
</file>
<file src="src/Block/Service/ContainerBlockService.php">
<ParamNameMismatch occurrences="1">
<code>$formMapper</code>
</ParamNameMismatch>
</file>
<file src="src/Block/Service/RssBlockService.php">
<ParamNameMismatch occurrences="1">
<code>$formMapper</code>
</ParamNameMismatch>
</file>
<file src="src/Block/Service/TemplateBlockService.php">
<ParamNameMismatch occurrences="1">
<code>$formMapper</code>
</ParamNameMismatch>
</file>
<file src="src/Block/Service/TextBlockService.php">
<ParamNameMismatch occurrences="1">
<code>$formMapper</code>
</ParamNameMismatch>
</file>
<file src="src/Exception/Renderer/MonkeyThrowRenderer.php">
<ParamNameMismatch occurrences="1">
<code>$banana</code>
</ParamNameMismatch>
</file>
<file src="src/Meta/MetadataInterface.php">
<UndefinedClass occurrences="1">
<code>CoreMetadataInterface</code>
</UndefinedClass>
<UnrecognizedStatement occurrences="1"/>
</file>
<file src="src/Resources/stubs/symfony2.php">
<UnrecognizedStatement occurrences="1"/>
</file>
<file src="src/Test/BlockServiceTestCase.php">
<DuplicateClass occurrences="1">
<code>BlockServiceTestCase</code>
</DuplicateClass>
</file>
</files>
9 changes: 9 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" errorLevel="7" resolveFromConfigFile="true" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml">
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
</psalm>
7 changes: 5 additions & 2 deletions tests/Block/Service/CustomBlockServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@

use Sonata\BlockBundle\Block\Service\AbstractBlockService;
use Sonata\BlockBundle\Test\BlockServiceTestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

/**
* @author Javier Spagnoletti <phansys@gmail.com>
*/
final class CustomBlockServiceTest extends BlockServiceTestCase
{
use ExpectDeprecationTrait;

/**
* NEXT_MAJOR: Remove this test.
*
* @group legacy
*
* @expectedDeprecation Passing string as argument 1 to Sonata\BlockBundle\Block\Service\AbstractBlockService@anonymous::__construct() is deprecated since sonata-project/block-bundle 3.16 and will throw a \TypeError as of 4.0. You must pass an instance of Twig\Environment instead.
*/
public function testArgumentDeprecation()
{
$this->expectDeprecation('Passing string as argument 1 to Sonata\BlockBundle\Block\Service\AbstractBlockService@anonymous::__construct() is deprecated since sonata-project/block-bundle 3.16 and will throw a \TypeError as of 4.0. You must pass an instance of Twig\Environment instead.');

new class('block') extends AbstractBlockService {
};
}
Expand Down