Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Commit

Permalink
Merge 422de66 into 8625f59
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Aug 18, 2019
2 parents 8625f59 + 422de66 commit bf6f8b6
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
@@ -0,0 +1,4 @@
github: core23
open_collective: core23
ko_fi: core23
custom: https://donate.core23.de
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug.md
@@ -0,0 +1,48 @@
---
name: 🐞 Bug Report
about: Something is broken? 🔨
---

<!--
Before you open an issue, make sure this one does not already exist.
-->

<!--
If you are reporting a bug, please try to fill in the following.
Otherwise remove it.
-->

### Environment

#### Packages

```
$ composer show --latest
# Put the result here.
```

#### PHP version

```
$ php -v
# Put the result here.
```

## Subject

<!--
Give here as many details as possible.
Next sections are for ERRORS only.
-->

## Steps to reproduce

## Expected results

## Actual results

<!--
If it's an error message or piece of code, use code block tags,
and make sure you provide the whole stack trace(s),
not just the first error message you can see.
-->
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature.md
@@ -0,0 +1,8 @@
---
name: 🚀 Feature Request
about: I have a suggestion (and may want to implement it)!
---

## Feature Request

<!-- Provide a summary of the feature. -->
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/Question.md
@@ -0,0 +1,8 @@
---
name: ❓ Support Question
about: I have a general question 💬!
---

## Question


12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,12 @@
<!-- THE PR TEMPLATE IS NOT AN OPTION. DO NOT DELETE IT, MAKE SURE YOU READ AND EDIT IT! -->

<!--
Specify which issues will be fixed/closed.
Remove it if this is not related.
-->

Closes #{put_issue_number_here}

## Subject

<!-- Describe your Pull Request content here -->
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -47,8 +47,11 @@ matrix:
- stage: test
php: 7.3
env: SYMFONY_VERSION=4.2.*
- php: nightly
env: COMPOSER_FLAGS="--ignore-platform-reqs"
allow_failures:
- php: nightly
env: COMPOSER_FLAGS="--ignore-platform-reqs"
- php: 7.3
env: TARGET=checkdeps

Expand Down
8 changes: 4 additions & 4 deletions README.md
@@ -1,7 +1,5 @@
CommonMarkFormatterBundle
=========================


[![Latest Stable Version](https://poser.pugx.org/core23/commonmark-formatter-bundle/v/stable)](https://packagist.org/packages/core23/commonmark-formatter-bundle)
[![Latest Unstable Version](https://poser.pugx.org/core23/commonmark-formatter-bundle/v/unstable)](https://packagist.org/packages/core23/commonmark-formatter-bundle)
[![License](https://poser.pugx.org/core23/commonmark-formatter-bundle/license)](https://packagist.org/packages/core23/commonmark-formatter-bundle)
Expand All @@ -15,7 +13,7 @@ CommonMarkFormatterBundle
[![Code Climate](https://codeclimate.com/github/core23/CommonMarkFormatterBundle/badges/gpa.svg)](https://codeclimate.com/github/core23/CommonMarkFormatterBundle)
[![Coverage Status](https://coveralls.io/repos/core23/CommonMarkFormatterBundle/badge.svg)](https://coveralls.io/r/core23/CommonMarkFormatterBundle)

This bundle provides a commonmark formatter for the [Sonata FormatterBundle].
This bundle provides a [commonmark] formatter for the [Sonata FormatterBundle].

## Installation

Expand Down Expand Up @@ -49,12 +47,14 @@ sonata_formatter:

## Add markdown extensions

If you want to use some [Github-Flavored Markdown extensions](https://github.com/thephpleague/commonmark-extras), you just need to register them inside the `config/services.yaml` file of your project:
If you want to use some [Github-Flavored Markdown extensions], you need download the extension and register it inside the `config/services.yaml` file of your project:

```yaml
services:
League\CommonMark\Extras\CommonMarkExtrasExtension:
tags: [ 'core23_commonmark.extension' ]
```

[commonmark]: https://github.com/thephpleague/commonmark
[Sonata FormatterBundle]: https://github.com/sonata-project/SonataFormatterBundle
[Github-Flavored Markdown extensions]: https://github.com/thephpleague/commonmark-extras
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -37,7 +37,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "0.x-dev"
}
},
"autoload": {
Expand Down
4 changes: 0 additions & 4 deletions phpstan.neon.dist
Expand Up @@ -9,7 +9,3 @@ parameters:
- vendor-bin/test/vendor/autoload.php

ignoreErrors:
# PHPUnit
-
message: '#Property .*::\$.* has no typehint specified.#'
path: tests/
5 changes: 3 additions & 2 deletions src/Core23CommonMarkFormatterBundle.php
Expand Up @@ -14,16 +14,17 @@
use Core23\CommonMarkFormatterBundle\DependencyInjection\Compiler\ExtensionCompilerPass;
use Core23\CommonMarkFormatterBundle\DependencyInjection\Core23CommonMarkFormatterExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;

final class Core23CommonMarkFormatterBundle extends Bundle
{
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new ExtensionCompilerPass());
}

public function getContainerExtension()
public function getContainerExtension(): ?ExtensionInterface
{
if (null === $this->extension) {
$this->extension = new Core23CommonMarkFormatterExtension();
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Compiler/ExtensionCompilerPass.php
Expand Up @@ -15,7 +15,7 @@

final class ExtensionCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('core23_commonmark.environment')) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Formatter/CommonMarkFormatter.php
Expand Up @@ -18,7 +18,7 @@ final class CommonMarkFormatter extends BaseFormatter
/**
* @var ConverterInterface
*/
protected $converter;
private $converter;

public function __construct(ConverterInterface $converter)
{
Expand Down
@@ -0,0 +1,40 @@
<?php

/*
* (c) Christian Gripp <mail@core23.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Core23\CommonMarkFormatterBundle\Tests\DependencyInjection;

use Core23\CommonMarkFormatterBundle\DependencyInjection\Core23CommonMarkFormatterExtension;
use Core23\CommonMarkFormatterBundle\Formatter\CommonMarkFormatter;
use League\CommonMark\Converter;
use League\CommonMark\DocParser;
use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;

class Core23CommonMarkFormatterExtensionTest extends AbstractExtensionTestCase
{
public function testLoadDefault(): void
{
$this->load();

$this->assertContainerBuilderHasService('core23_commonmark.formatter', CommonMarkFormatter::class);

$this->assertContainerBuilderHasService('core23_commonmark.environment', Environment::class);
$this->assertContainerBuilderHasService('core23_commonmark.doc_parser', DocParser::class);
$this->assertContainerBuilderHasService('core23_commonmark.html_render', HtmlRenderer::class);
$this->assertContainerBuilderHasService('core23_commonmark.converter', Converter::class);
}

protected function getContainerExtensions(): array
{
return [
new Core23CommonMarkFormatterExtension(),
];
}
}

0 comments on commit bf6f8b6

Please sign in to comment.