Skip to content

Commit

Permalink
Merge branch 'master' into optional-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
garak authored Jun 5, 2018
2 parents b365197 + 5991f94 commit 2814343
Show file tree
Hide file tree
Showing 154 changed files with 1,486 additions and 1,094 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.travis.yml export-ignore
Expand Down
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/BC_Break.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: 💥 BC Break
about: Have you encountered an issue during upgrade? 💣
---

### BC Break Report

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| BC Break | yes
| Version | x.y.z

#### Summary

<!-- Provide a summary describing the problem you are experiencing. -->

#### Previous behavior

<!-- What was the previous (working) behavior? -->

#### Current behavior

<!-- What is the current (broken) behavior? -->

#### How to reproduce

<!--
Provide steps to reproduce the BC break.
If possible, also add a code snippet with relevant configuration, mappings, etc.
Adding a failing Unit or Functional Test would help us a lot - you can submit it in a Pull Request separately, referencing this bug report.
-->

33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: 🐞 Bug Report
about: Something is broken? 🔨
---

### Bug Report

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| BC Break | yes/no
| Version | x.y.z

#### Summary

<!-- Provide a summary desciribing the problem you are experiencing. -->

#### Current behavior

<!-- What is the current (buggy) behavior? -->

#### How to reproduce

<!--
Provide steps to reproduce the bug.
If possible, also add a code snippet with relevant configuration, mappings, etc.
Adding a failing Unit or Functional Test would help us a lot - you can submit one in a Pull Request separately, referencing this bug report.
-->

#### Expected behavior

<!-- What was the expected (correct) behavior? -->
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_Request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: 🎉 Feature Request
about: You have a neat idea that should be implemented? 🎩
---

### Feature Request

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| New Feature | yes
| RFC | yes/no
| BC Break | yes/no

#### Summary

<!-- Provide a summary of the feature you would like to see implemented. -->

19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/Support_Question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: ❓ Support Question
about: Have a problem that you can't figure out? 🤔
---

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | -----
| Version | x.y.z

<!--
Before asking question here, please try asking on StackOverflow first.
Keep in mind that GitHub is primarily an issue tracker.
-->

### Support Question

<!-- Describe the issue you are facing here. -->
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/Failing_Test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: 🐞 Failing Test
about: You found a bug and have a failing Unit or Functional test? 🔨
---

### Failing Test

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| BC Break | yes/no
| Version | x.y.z


#### Summary

<!-- Provide a summary of the failing scenario. -->
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/Improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: ⚙ Improvement
about: You have some improvement to make VichUploaderBundle better? 🎁
---

### Improvement

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| New Feature | yes
| RFC | yes/no
| BC Break | yes/no

#### Summary

<!-- Provide a summary of the improvement you are submitting. -->

23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/New_Feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: 🎉 New Feature
about: You have implemented some neat idea that you want to make part of VichUploaderBundle? 🎩
---

<!--
Thank you for submitting new feature!
-->

### New Feature

<!-- Fill in the relevant information below to help triage your issue. -->

| Q | A
|------------ | ------
| New Feature | yes
| RFC | yes/no
| BC Break | yes/no

#### Summary

<!-- Provide a summary of the feature you have implemented. -->

5 changes: 5 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ $finder = PhpCsFixer\Finder::create()
;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => true,
'declare_strict_types' => false,
])
->setFinder($finder)
;
23 changes: 10 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- 7.0
- 7.1
- 7.2
- nightly

sudo: false
Expand All @@ -12,34 +12,31 @@ cache:
- $HOME/.composer/cache

env:
- SYMFONY_VERSION="~2.8.0"
- SYMFONY_VERSION="~3.4.0"
- COMPOSER_FLAGS="--prefer-dist"

matrix:
include:
- php: 7.1
env: VALIDATE_DOCS=true
- php: 7.0
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.1
env: SYMFONY_VERSION="~3.2.0"
- php: 7.1
env: SYMFONY_VERSION="~3.3.0"
- php: 7.1
env: SYMFONY_VERSION="~2.8.0" WITH_LIIP_IMAGINE=true
- php: 7.1
env: SYMFONY_VERSION="~3.3.0" WITH_LIIP_IMAGINE=true
env: SYMFONY_VERSION="~3.4.0" WITH_LIIP_IMAGINE=true
- php: 7.2
env: SYMFONY_VERSION="~4.0.0" WITH_LIIP_IMAGINE=true
allow_failures:
- php: nightly

before_install:
- if [ -z "$(pecl list | grep -w mongodb)" ]; then pecl install mongodb-1.3.4; fi
- echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- composer self-update
- phpenv config-rm xdebug.ini || true
- composer config platform.ext-mongo 1.6.14
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony:${SYMFONY_VERSION}; fi
- if [ "$WITH_LIIP_IMAGINE" = true ] ; then composer require --no-update liip/imagine-bundle:^1.7; fi;
- if [ "$WITH_LIIP_IMAGINE" = true ] ; then composer require --no-update liip/imagine-bundle:"^1.7|^2.0@dev"; fi;
- if [ "$VALIDATE_DOCS" = true ]; then composer require --dev --no-update kphoen/rusty dev-master; fi

install: php -d memory_limit=-1 $(phpenv which composer) update $COMPOSER_FLAGS --no-suggest --prefer-dist
install: php -d memory_limit=-1 $(phpenv which composer) update $COMPOSER_FLAGS --no-suggest

script:
- if [ "$VALIDATE_DOCS" != true ]; then ./vendor/bin/phpunit; fi
Expand Down
2 changes: 1 addition & 1 deletion Adapter/ODM/MongoDB/MongoDBAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getObjectFromArgs($event)
/**
* {@inheritdoc}
*/
public function recomputeChangeSet($event)
public function recomputeChangeSet($event): void
{
$object = $this->getObjectFromArgs($event);

Expand Down
2 changes: 1 addition & 1 deletion Adapter/ORM/DoctrineORMAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getObjectFromArgs($event)
/**
* {@inheritdoc}
*/
public function recomputeChangeSet($event)
public function recomputeChangeSet($event): void
{
$object = $this->getObjectFromArgs($event);

Expand Down
2 changes: 1 addition & 1 deletion Adapter/PHPCR/PHPCRAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function getObjectFromArgs($event)
/**
* {@inheritdoc}
*/
public function recomputeChangeSet($event)
public function recomputeChangeSet($event): void
{
$object = $this->getObjectFromArgs($event);

Expand Down
2 changes: 1 addition & 1 deletion Adapter/Propel/PropelORMAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getObjectFromArgs($event)
/**
* {@inheritdoc}
*/
public function recomputeChangeSet($event)
public function recomputeChangeSet($event): void
{
}
}
26 changes: 19 additions & 7 deletions Command/MappingDebugClassCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@

namespace Vich\UploaderBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Vich\UploaderBundle\Metadata\MetadataReader;

class MappingDebugClassCommand extends ContainerAwareCommand
class MappingDebugClassCommand extends Command
{
protected function configure()
protected static $defaultName = 'vich:mapping:debug-class';

private $metadataReader;

public function __construct(MetadataReader $metadataReader)
{
parent::__construct();
$this->metadataReader = $metadataReader;
}

protected function configure(): void
{
$this
->setName('vich:mapping:debug-class')
Expand All @@ -18,22 +29,23 @@ protected function configure()
;
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$metadataReader = $this->getContainer()->get('vich_uploader.metadata_reader');
$fqcn = $input->getArgument('fqcn');

if (!$metadataReader->isUploadable($fqcn)) {
if (!$this->metadataReader->isUploadable($fqcn)) {
$output->writeln(sprintf('<error>"%s" is not uploadable.</error>', $fqcn));

return 1;
}

$uploadableFields = $metadataReader->getUploadableFields($fqcn);
$uploadableFields = $this->metadataReader->getUploadableFields($fqcn);

$output->writeln(sprintf('Introspecting class <info>%s</info>:', $fqcn));
foreach ($uploadableFields as $data) {
$output->writeln(sprintf('Found field "<comment>%s</comment>", storing file name in <comment>"%s</comment>" and using mapping "<comment>%s</comment>"', $data['propertyName'], $data['fileNameProperty'], $data['mapping']));
}

return 0;
}
}
23 changes: 16 additions & 7 deletions Command/MappingDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@

namespace Vich\UploaderBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Vich\UploaderBundle\Exception\MappingNotFoundException;

class MappingDebugCommand extends ContainerAwareCommand
class MappingDebugCommand extends Command
{
protected function configure()
protected static $defaultName = 'vich:mapping:debug';

private $mappings;

public function __construct(array $mappings)
{
parent::__construct();
$this->mappings = $mappings;
}

protected function configure(): void
{
$this
->setName('vich:mapping:debug')
Expand All @@ -19,18 +29,17 @@ protected function configure()
;
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): void
{
$mappings = $this->getContainer()->getParameter('vich_uploader.mappings');
$mapping = $input->getArgument('mapping');

if (!isset($mappings[$mapping])) {
if (!isset($this->mappings[$mapping])) {
throw new MappingNotFoundException(sprintf('Mapping "%s" does not exist.', $mapping));
}

$output->writeln(sprintf('Debug information for mapping <info>%s</info>', $mapping));

foreach ($mappings[$mapping] as $key => $value) {
foreach ($this->mappings[$mapping] as $key => $value) {
$output->writeln(sprintf('<comment>%s</comment>: %s', $key, var_export($value, true)));
}
}
Expand Down
Loading

0 comments on commit 2814343

Please sign in to comment.