Skip to content

Commit

Permalink
version 2 (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
garak committed Sep 3, 2022
1 parent 6b42864 commit e9c240f
Show file tree
Hide file tree
Showing 146 changed files with 761 additions and 2,032 deletions.
67 changes: 30 additions & 37 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
- run: composer require --no-update liip/imagine-bundle:"^1.7 || ^2.0"
- name: Update project dependencies
uses: ramsey/composer-install@v1
- name: PHPStan
uses: docker://oskarstark/phpstan-ga
env:
CHECK_PLATFORM_REQUIREMENTS: false
REQUIRE_DEV: true
with:
args: analyse
php-version: 8.1
- run: |
composer require --no-update liip/imagine-bundle:"^2.8" phpstan/extension-installer phpstan/phpstan-phpunit
composer config --no-plugins allow-plugins.phpstan/extension-installer true
composer install --ignore-platform-reqs
vendor/bin/phpstan
cs-fixer:
runs-on: ubuntu-20.04
name: PHP-CS-Fixer
Expand All @@ -34,43 +29,42 @@ jobs:
uses: actions/checkout@v2
- name: Fix CS
uses: docker://oskarstark/php-cs-fixer-ga
validate-markdown:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Validate
uses: avto-dev/markdown-lint@v1
with:
config: './.github/workflows/config/config.json'
args: './docs ./CONTRIBUTING.md ./README.md ./UPDATE.md'
tests:
runs-on: ubuntu-20.04
strategy:
matrix:
php:
- '7.4'
- '8.0'
- '8.1'
dependencies: [highest]
symfony: ['*']
validate_docs: [false]
with_imagine: [false]
with_oneupbundle: [true]
max_deprecations: [0]
include:
- extra: ', validate docs with lowest deps on PHP 7.4'
php: '7.4' # PHP 8 not yet supported by rusty
symfony: '*'
validate_docs: true
- extra:
php: '8.1'
symfony: '5.4.*'
dependencies: lowest
with_imagine: false
with_oneupbundle: false
- php: '8.0'
symfony: '5.4.*'
dependencies: highest
with_imagine: false
with_oneupbundle: true
- php: '8.0'
symfony: '6.0.*'
dependencies: highest
with_imagine: false
with_oneupbundle: true
max_deprecations: 5
- php: '8.1'
symfony: '6.0.*'
symfony: '6.1.*'
dependencies: highest
with_imagine: false
with_oneupbundle: true
name: PHP ${{ matrix.php }} with Symfony ${{ matrix.symfony }} tests with ${{ matrix.dependencies }} dependencies${{ matrix.extra }}
max_deprecations: 0
name: PHP ${{ matrix.php }} with Symfony ${{ matrix.symfony }} tests with ${{ matrix.dependencies }} dependencies
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -86,19 +80,18 @@ jobs:
extensions: mongodb-stable, pdo_sqlite
- run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-interaction --no-progress symfony/flex:^1.11
composer global require --no-interaction --no-progress symfony/flex:^2.2
composer config extra.symfony.require ${{ matrix.symfony }}
if: matrix.symfony != '*'
- run: composer require --no-update liip/imagine-bundle:"^1.7 || ^2.0"
- run: composer require --no-update liip/imagine-bundle:"^2.0"
if: matrix.with_imagine
- run: composer require --no-update oneup/flysystem-bundle:"^4.0.1"
if: matrix.with_oneupbundle
- run: composer require --dev --no-update kphoen/rusty:"dev-update-php-parser"
if: matrix.validate_docs
- name: Update project dependencies
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
- run: vendor/bin/phpunit
- run: vendor/bin/rusty check --no-execute ./docs
if: matrix.validate_docs
- name: Run tests
run: vendor/bin/phpunit
env:
SYMFONY_DEPRECATIONS_HELPER: max[self]=${{matrix.max_deprecations}}
6 changes: 6 additions & 0 deletions .github/workflows/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"default": true,
"header-style": { "style": "atx" },
"line-length": { "line_length": 115, "code_block_line_length": 150 },
"no-trailing-punctuation": { "punctuation": ".,;:" }
}
5 changes: 3 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'@PHP80Migration:risky' => true,
'@PHP81Migration' => true,
'@PHPUnit84Migration:risky' => true,
'declare_strict_types' => false,
'native_function_invocation' => ['include' => ['@all']],
'fopen_flags' => ['b_mode' => true],
Expand Down
20 changes: 8 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Contributing
============
# Contributing

First of all, **thank you** for contributing, **you are awesome**!

Expand Down Expand Up @@ -31,9 +30,9 @@ Thank you!

## Running the test suite

Tests suite uses Docker environments in order to be idempotent to OS's. More than this
Tests suite uses Docker environments in order to be idempotent to OS's. More than this
PHP version is written inside the Dockerfile; this assures to test the bundle with
the same resources. No need to have PHP or Mongo installed.
the same resources. No need to have PHP or Mongo installed.

You only need Docker set it up.

Expand All @@ -52,17 +51,14 @@ make test TEST="Tests/Util/FilenameUtilsTest.php"

will allow testing single Test Classes.

There are three environments available: PHP 7.4, 8.0, and 8.1.
Default environment is *PHP 8.1*. If you want to execute it against
other PHP version, please use environment variables as this:
There is only one environment available: PHP 8.1.
Default environment is *PHP 8.1*. If you want to execute it against
other (future) PHP version, please use environment variables as this:

```bash
make tests #PHP 8.1 env
TARGET=80 make tests #PHP 8.0 env
TARGET=74 make tests #PHP 7.4 env
TARGET=82 make tests #PHP 8.2 env

make test TEST="tests/Util/FilenameUtilsTest.php" #PHP 8.1 env
TARGET=74 make test TEST="tests/Util/FilenameUtilsTest.php" #PHP 7.4 env
TARGET=80 make test TEST="tests/Util/FilenameUtilsTest.php" #PHP 8.0 env
TARGET=82 make test TEST="tests/Util/FilenameUtilsTest.php" #PHP 8.2 env
```

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
VichUploaderBundle
==================
# VichUploaderBundle

[![Build Status](https://github.com/dustin10/VichUploaderBundle/workflows/build/badge.svg)](https://github.com/dustin10/VichUploaderBundle/actions) [![Total Downloads](https://poser.pugx.org/vich/uploader-bundle/downloads.png)](https://packagist.org/packages/vich/uploader-bundle) [![Latest Unstable Version](https://poser.pugx.org/vich/uploader-bundle/v/unstable.png)](https://packagist.org/packages/vich/uploader-bundle) [![Latest stable Version](https://poser.pugx.org/vich/uploader-bundle/v/stable.png)](https://packagist.org/packages/vich/uploader-bundle)
[![Build Status](https://github.com/dustin10/VichUploaderBundle/workflows/build/badge.svg)](https://github.com/dustin10/VichUploaderBundle/actions)
[![Total Downloads](https://poser.pugx.org/vich/uploader-bundle/downloads.png)](https://packagist.org/packages/vich/uploader-bundle)
[![Latest Unstable Version](https://poser.pugx.org/vich/uploader-bundle/v/unstable.png)](https://packagist.org/packages/vich/uploader-bundle)
[![Latest stable Version](https://poser.pugx.org/vich/uploader-bundle/v/stable.png)](https://packagist.org/packages/vich/uploader-bundle)

The VichUploaderBundle is a Symfony bundle that attempts to ease file
uploads that are attached to ORM entities, MongoDB ODM documents, or PHPCR ODM
Expand Down
151 changes: 11 additions & 140 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,140 +1,11 @@
Upgrading from v1.17.0 to v1.18.0
=================================

- the "symfony/form" package is now a suggestion. Make sure to explicitly require this package if you use Symfony forms.

Upgrading from v1.14.0 to 1.15.0
================================

- translation has been refactored to use standard domain. If you added translations in "VichUploaderBundle" domain, you can move it to "messages" domain.
Also, label were change to avoid possible conflicts: from "Download" to "vich_uploader.link.download", and from "form.label.delete" to
"vich_uploader.form_label.delete_confirm".

Upgrading from v1.12.0 to 1.13.0
================================

- not using a namer is deprecated. You should always configure a namer.
- DownloadHandler doesn't convert names of files anymore. You should not relay on it for your files, but convert names at upload time (using a namer, see previous point).
- namer use symfony/string instead of behat/transliterator. This should not cause any visibile effect.
- support for templating component was removed. You should use Twig.
- Flysystem now is supported also via league/flysystem-bundle


Upgrading from v1.11.0 to 1.12.0
================================

- Propel support has been dropped. It was likely not working since a while.
If you need to use this bundle with Propel, you need to use a previous bundle version.
- Default configuration directory changed from `Resources/config/vich_uploader` to `config/vich_uploader`.
Old path is still supported, but deprecated.

Upgrading from v1.8.0 to 1.11.0
===============================

- minor **BC-BREAK**: methods `resolvePath` and `resolveUri` in `StorageInterface` now accepts `null` in second argument.
This will affect you only if you implementd a custom storage, without extending base `AbstractStorage` class.

Upgrading from v1.6.0 to 1.8.0
==============================

- we enforced, via type-hinting, as many parameters and return values as we can.
This is _formally_ a BC break, but likely you don't need to change anything in
your code. Anyway, if you implemented an interface or extended a bundle class
with your custom class, you need to check to be consistent with such type hinting.

Upgrading from v1.0.0 to 1.6.0
==============================

- the transliteration is now using `behat\transliterator` instead of a custom one. Some minor
differences are that dash is not preserved anymore and names are lowercased.
- the form option `download_link` now is deprecated, use `download_uri` instead.
- **BC-BREAK** in order to fixing [#704](https://github.com/dustin10/VichUploaderBundle/issues/704) for xml and yaml
mapping you should prepend relative from bundle sub-namespace to each mapping file.
For example for `Entity\Product` mapping file would be renamed from `Product.xml` to `Entity.Product.xml`,
for `Document\Article`: `Article.yml` -> `Document.Article.yml`.


Upgrading from v0.14.0 to v1.0.0
================================

No BC breaks.

Upgrading from v0.13.0 to v0.14.0
=================================

No BC breaks.

Upgrading from v0.12.0 to v0.13.0
=================================

- the `resolvePath` and `resolveUri` Storage methods now take a field name
instead of a mapping name. The same goes for the UploaderExtension and
UploaderHelper `asset` method.
This reverts the broken behavior introduced in v0.10.0.
- the `mapping` option for form types is removed as the mapping to use is
inferred from the field's name.

Upgrading from v0.11.0 to v0.12.0
=================================

- the `storage` configuration paramater changed. It accepts the name of the
storage engine to use (file_system, gaufrette or flysystem).
- the `gaufrette` and `flysystem` configuration parameters were deleted.

Upgrading from v0.10.0 to v0.11.0
=================================

- Symfony versions prior to 2.3 are not supported anymore.

Upgrading from v0.9.0 to v0.10.0
================================

- `inject_on_load` config param defaults to false. Set it to
true if you want to keep your old behavior.

- the `NamerInterface` and `DirectoryNamerInterface` were modified.

- the `resolvePath` and `resolveUri` Storage methods now take a mapping name
instead of a field name. The same goes for the UploaderExtension and
UploaderHelper `asset` method.

Upgrading from v0.5.0 to 0.6.0
==============================

- `getUriPrefix` default value is now /uploads

- `delete_on_update` config param added. It defaults to true.

Upgrading from v0.4.0 to v0.5.0
===============================

- gaufrette and KnpGaufretteBundle are now soft dependencies

- `storage` configuration entry added.

- `web_dir_name` configuration entry deprecated.

- `mapping`:`upload_dir` configuration entry renamed to `mapping`:`upload_destination`

- `mapping`:`uri_prefix` configuration entry added

- The old `vich_uploader.uploader` service has been split into two new
services for a more modular, separation of concerns approach. The new services are
`vich_uploader.storage.gaufrette` and `vich_uploader.file_injector`. The storage
service is responsible for saving and removing files as well as resolving their path.
The injector service is responsible for injecting `File` instances back into the
object upon retrieval from the datastore.


Upgrading from v0.2.0 to v0.3.0
===============================

- Annotations have changed namespace from `Vich\UploaderBundle\Annotation` to
`Vich\UploaderBundle\Mapping\Annotation`. You will need to update your `use`
statement for the annotations used in your entity or document classes.

- The `mappings` configuration entry prototype has had a new option added to it.
The `inject_on_load` config option specifies whether or not the uploadable fields
should have an instnace of `Symfony\Component\HttpFoundation\File\File` created
and injected into the property upon retrieval from the datastore. THis option has a
default value of `true`.
# Upgrading from v1 to v2.0.0

* every class marked as `@final` is now final
* all properties are now fully type-hinted
* all methods arguments are now fully type-hinted
* all methods have now return types
* all constructors now use property promotion
* all deprecated features were removed
* the new default type for mapping is "attribute". You can still use annotations, but you need an explicit definition.
* the service "vich_uploader.current_date_time_helper" has been removed. The `DateTimeHelper` interface has been
removed as well.
Loading

0 comments on commit e9c240f

Please sign in to comment.