Commit Graph

26538 Commits

Author SHA1 Message Date
Nicolas Grekas
ff1f5f80d2 [HttpFoundation] Fix UPSERT for PgSql >= 9.5 2016-06-15 12:17:39 +02:00
Fabien Potencier
b4b1fef7a3 feature #18220 Don't send default cache header for 301 redirects (e-moe)
This PR was merged into the 3.2-dev branch.

Discussion
----------

Don't send default cache header for 301 redirects

| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #17139
| License       | MIT
| Doc PR        | see comments from https://github.com/symfony/symfony/issues/17139

Commits
-------

cf253a9 17139: do not send default cache header for 301 redirects
2016-06-15 10:34:31 +02:00
Robin Chalas
54d3d63cf1 Centralize input stream in base Input class
Add StreamableInputInterface

Removed commented code

Prevent BC by looking for QuestionHelper::

Logic fixes

Check for that  implements StreamableInputInterface

Rollback E_USER_DEPRECATED notice in getInputStream

Remove legacy tests to avoid KO because of deprecations

Add missing use

Keep old tests marked as legacy

Undeprecate getInputStream, CS Fixes

Move legacy tests in separated class

Revert separated legacy test class

Keep legacy createInputInterfaceMock()

Depreciate QuestionHelper::getInputStream()
2016-06-15 10:18:17 +02:00
Fabien Potencier
b3dbc5678c minor #18830 [Form] fixed EntityType test with query_builder option as null (HeahDude)
This PR was merged into the 2.8 branch.

Discussion
----------

[Form] fixed EntityType test with query_builder option as null

| Q             | A
| ------------- | ---
| Branch?       | 2.8+
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | symfony/symfony-docs#6599

ref https://github.com/symfony/symfony/pull/13990#issuecomment-220788142.

Commits
-------

ad8e989 [Form] fixed EntityType test with query_builder option
2016-06-15 09:41:10 +02:00
Fabien Potencier
910eff0450 bug #18548 [Form] minor fixes in DateTime transformers (HeahDude)
This PR was submitted for the 2.3 branch but it was merged into the 2.7 branch instead (closes #18548).

Discussion
----------

[Form] minor fixes in DateTime transformers

| Q             | A
| ------------- | ---
| Branch?       | 2.3+
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Commits
-------

b91008f [Form] fixed DateTime transformers
2016-06-15 09:21:32 +02:00
Jules Pietri
b91008fb57 [Form] fixed DateTime transformers 2016-06-15 09:21:32 +02:00
Fabien Potencier
d7e466ac23 bug #18732 [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't (nykopol)
This PR was squashed before being merged into the 2.7 branch (closes #18732).

Discussion
----------

[PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18694
| License       | MIT
| Doc PR        |

When you try do define a manyToMany association but you don't give an array or \Traversable, the raised exception say that some methods are missing while they don't. This PR check if the adder and setter methods exists and if so, give a exception that pointing on the real problem.

Commits
-------

c46519b [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't
2016-06-15 09:08:06 +02:00
Johan DESMYTER
c46519b40b [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't 2016-06-15 09:08:04 +02:00
Fabien Potencier
343c0da7fb bumped Symfony version to 3.1.2 2016-06-15 08:20:59 +02:00
Fabien Potencier
6e1b149727 Merge pull request #19055 from fabpot/release-3.1.1
released v3.1.1
2016-06-15 07:59:11 +02:00
Fabien Potencier
75209e27b8 updated VERSION for 3.1.1 2016-06-15 07:59:04 +02:00
Fabien Potencier
0d5db658a4 updated CHANGELOG for 3.1.1 2016-06-15 07:58:54 +02:00
Fabien Potencier
f400f01ecc feature #17662 [Translation][transChoice] allows escaping the pipe character. (aitboudad)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Translation][transChoice] allows escaping the pipe character.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #15195
| Tests pass?   | yes
| License       | MIT

Commits
-------

a35a93b [Translation][transChoice] allows escaping the pipe character.
2016-06-14 22:35:45 +02:00
Abdellatif Ait boudad
a35a93bf49 [Translation][transChoice] allows escaping the pipe character. 2016-06-14 15:15:22 +00:00
Christian Flothmann
b5c209558a add a triggered errors assertion helper 2016-06-14 14:58:34 +02:00
Nicolas Grekas
5280d5dc9c bug #19049 [DependencyInjection] fix the sorting by priority (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[DependencyInjection] fix the sorting by priority

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18482
| License       | MIT
| Doc PR        |

Commits
-------

6f72657 [DependencyInjection] fix the sorting by priority
2016-06-14 13:29:55 +02:00
Nicolas Grekas
7581f71b34 Merge branch '3.1'
* 3.1: (30 commits)
  Fix merge
  [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5
  [Console] fixed PHPDoc
  [Cache] Fix double fetch in ProxyAdapter
  [travis] HHVM 3.12 LTS
  Fix feature detection for IE
  [Form] Fixed collapsed choice attributes
  [Console] added explanation of messages usage in a progress bar
  force enabling the external XML entity loaders
  [Yaml] properly count skipped comment lines
  [WebProfilerBundle] Fix invalid CSS style
  Added progressive jpeg to mime types guesser
  [Yaml] Fix wrong line number when comments are inserted in the middle of a block.
  Fixed singular of committee
  Fixed singular of committee
  Do not inject web debug toolbar on attachments
  Fixed issue with legacy client initialization
  [FrameworkBundle] Remove unused variable
  bumped Symfony version to 3.0.8
  updated VERSION for 3.0.7
  ...
2016-06-14 13:18:32 +02:00
Nicolas Grekas
de03922804 Merge branch '3.0' into 3.1
* 3.0: (25 commits)
  Fix merge
  [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5
  [Console] fixed PHPDoc
  [travis] HHVM 3.12 LTS
  Fix feature detection for IE
  [Form] Fixed collapsed choice attributes
  [Console] added explanation of messages usage in a progress bar
  force enabling the external XML entity loaders
  [Yaml] properly count skipped comment lines
  [WebProfilerBundle] Fix invalid CSS style
  Added progressive jpeg to mime types guesser
  [Yaml] Fix wrong line number when comments are inserted in the middle of a block.
  Fixed singular of committee
  Do not inject web debug toolbar on attachments
  bumped Symfony version to 3.0.8
  updated VERSION for 3.0.7
  updated CHANGELOG for 3.0.7
  bumped Symfony version to 2.8.8
  updated VERSION for 2.8.7
  updated CHANGELOG for 2.8.7
  ...

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/PropertyAccess/StringUtil.php
	src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php
	src/Symfony/Component/Yaml/Parser.php
	src/Symfony/Component/Yaml/Tests/ParserTest.php
2016-06-14 13:18:07 +02:00
Nicolas Grekas
a7ed68b38f Merge branch '2.8' into 3.0
* 2.8: (22 commits)
  Fix merge
  [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5
  [Console] fixed PHPDoc
  [travis] HHVM 3.12 LTS
  Fix feature detection for IE
  [Form] Fixed collapsed choice attributes
  [Console] added explanation of messages usage in a progress bar
  force enabling the external XML entity loaders
  [Yaml] properly count skipped comment lines
  [WebProfilerBundle] Fix invalid CSS style
  Added progressive jpeg to mime types guesser
  [Yaml] Fix wrong line number when comments are inserted in the middle of a block.
  Fixed singular of committee
  Do not inject web debug toolbar on attachments
  bumped Symfony version to 2.8.8
  updated VERSION for 2.8.7
  updated CHANGELOG for 2.8.7
  bumped Symfony version to 2.7.15
  updated VERSION for 2.7.14
  update CONTRIBUTORS for 2.7.14
  ...

Conflicts:
	CHANGELOG-2.7.md
	CHANGELOG-3.0.md
	src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
	src/Symfony/Component/HttpKernel/Kernel.php
2016-06-14 13:04:19 +02:00
Nicolas Grekas
625513da7b Fix merge 2016-06-14 13:01:05 +02:00
Nicolas Grekas
7fa2eab99f Merge branch '2.7' into 2.8
* 2.7:
  [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5
  [Console] fixed PHPDoc
  [travis] HHVM 3.12 LTS
  Fix feature detection for IE
  [Form] Fixed collapsed choice attributes
  [Console] added explanation of messages usage in a progress bar
  force enabling the external XML entity loaders
  [Yaml] properly count skipped comment lines

Conflicts:
	src/Symfony/Component/Translation/Loader/XliffFileLoader.php
2016-06-14 12:47:22 +02:00
Christian Flothmann
6f72657554 [DependencyInjection] fix the sorting by priority 2016-06-14 12:15:55 +02:00
Fabien Potencier
347cd8712e bug #19048 [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

9569c74 [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5
2016-06-14 11:41:37 +02:00
Nicolas Grekas
9569c7453c [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 2016-06-14 11:40:21 +02:00
Fabien Potencier
a80fa4104c bug #19042 [Cache] Fix double fetch in ProxyAdapter (nicolas-grekas)
This PR was merged into the 3.1 branch.

Discussion
----------

[Cache] Fix double fetch in ProxyAdapter

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

040f53d [Cache] Fix double fetch in ProxyAdapter
2016-06-14 11:24:32 +02:00
Fabien Potencier
2077729d2c minor #19046 [Console] fixed PHPDoc (atailouloute)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #19046).

Discussion
----------

[Console] fixed PHPDoc

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

37fac3e [Console] fixed PHPDoc
2016-06-14 10:22:25 +02:00
Ahmed Tailouloute
37fac3e44f [Console] fixed PHPDoc 2016-06-14 10:22:25 +02:00
Fabien Potencier
5c91f6e671 feature #18322 [DomCrawler] Attach label to form fields (carlosV2)
This PR was squashed before being merged into the 3.2-dev branch (closes #18322).

Discussion
----------

[DomCrawler] Attach label to form fields

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

While building a software to extract information from a webpage, I need to fill a form with hints on the fields labels.

Example:

```html
<form>
   ...
   <label for="my_field">Input the result of 3 + 4:</label>
   <input type="text" id="my_field" name="my_field" />
   ...
</form>
```

 I thought it would be handy to have the field labels attached to each field.
So given the previous form you could now do:

```php
$form->get('my_field')->getLabel()->textContent;
```

Commits
-------

82ef55b [DomCrawler] Attach label to form fields
2016-06-14 08:40:06 +02:00
Carlos Ortega Huetos
82ef55b976 [DomCrawler] Attach label to form fields 2016-06-14 08:39:48 +02:00
Fabien Potencier
f8dc4593a3 feature #18482 Created a trait to sort tagged services (iltar)
This PR was squashed before being merged into the 3.2-dev branch (closes #18482).

Discussion
----------

Created a trait to sort tagged services

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

When writing the `ControllerArgumentValueResolverPass`, I needed a sorting on `priority`. I ended up copying a method from another class. I noticed this was done more often and 99% of the code was the same. I've moved the most common notation into the trait and "used" the trait in the priority aware passes. This increases horizontal re-use and means people can also use this in their bundles.

The cases that were slightly different, are still working completely. I had to fix some tests because they returned an invalid value from the mocked find method.

Commits
-------

778a70b Created a trait to sort tagged services
2016-06-14 08:28:41 +02:00
Iltar van der Berg
778a70ba98 Created a trait to sort tagged services 2016-06-14 08:28:39 +02:00
Nicolas Grekas
040f53d3e6 [Cache] Fix double fetch in ProxyAdapter 2016-06-14 07:54:16 +02:00
Fabien Potencier
31678c9118 feature #15458 [Filesystem] Add feature to create hardlinks for files (andrerom)
This PR was submitted for the 2.8 branch but it was merged into the 3.2-dev branch instead (closes #15458).

Discussion
----------

[Filesystem] Add feature to create hardlinks for files

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Todo:
- [x] Tests
- [ ] Doc
- [x] Getting someone to test on Windows as exception might differ from symlink functionality

## Why
Symlinks are good for directories, but for files hardlinks are sometime a better match when needing to represent same file in several locations.

One use case for this feature is for multi tagging of Http Cache when running against FileSystem. Multi tagging is used in FoSHttpCache and supported when running Varnish, but not with Symfony HTTPCache, yet.. With hardlinks combined with meta information containing tags within the file, lookup and reverse lookup is thus easily possible.

## What
Introduces method `hardlink()` with similar behavior as `symlink`, difference being:
- Allowing several targets to be provided to match use case in 'why'
- Like `symlink` removes existing target if not the same, but uses `fileinode` to compare target & source

Commits
-------

8475002 [Filesystem] Add feature to create hardlinks for files
2016-06-13 22:18:54 +02:00
André R
8475002dfb [Filesystem] Add feature to create hardlinks for files 2016-06-13 22:18:45 +02:00
Fabien Potencier
f15b630980 minor #19044 [travis] HHVM 3.12 LTS (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[travis] HHVM 3.12 LTS

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | I guess yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

6da9959 [travis] HHVM 3.12 LTS
2016-06-13 18:29:41 +02:00
Nicolas Grekas
6da99593a1 [travis] HHVM 3.12 LTS 2016-06-13 17:31:05 +02:00
Fabien Potencier
030abb25dc feature #18940 [Console] Add path argument to dump a specific option in debug:config (chalasr)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Console] Add path argument to dump a specific option in debug:config

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

This adds the ability to dump a specific bundle config option from the `debug:config` command.

For instance `debug:config StofDoctrineExtensionsBundle uploadable` gives:

![](http://image.prntscr.com/image/b78953dbe34c4efd817bb6f831ddd0ba.png)

I hesitated to just look for a `.` in the `name` argument rather than adding a `path` argument that doesn't include the bundle alias (that is took from the first argument of the command), let me know what you think about that.

Commits
-------

05ae01b [Console] Add path argument to dump a specific option in debug:config
2016-06-13 14:37:07 +02:00
Fabien Potencier
ee6888701f feature #19013 [ExpressionLanguage] Added a way to dump the AST (lyrixx)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[ExpressionLanguage] Added a way to dump the AST

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Because it's convenient and it makes easier to inline results of sub/smaller part of the main expression.

Commits
-------

87af6e5 [ExpressionLanguage] Added a way to dump AST
2016-06-13 14:07:18 +02:00
Fabien Potencier
1dcc86dfc1 feature #18332 [Form] added CallbackChoiceLoader and refactored ChoiceType's children (HeahDude)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Form] added `CallbackChoiceLoader` and refactored ChoiceType's children

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | todo

Todo
====
- [ ] Address a doc PR
- [x] Update CHANGELOG

Changes
=======
 - 39e937f added `CallbackChoiceLoader` to lazy load choices with a simple callable.

 - 995dc56 refactored `CountryType`, `CurrencyType`, `LanguageType`, `LocaleType` and `TimezoneType` for better performance by implementing `ChoiceLoaderInterface` for lazy loading.

Usage
=====
```php
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;

$builder->add('constants', ChoiceType::class, array(
    'choice_loader' => new CallbackChoiceLoader(function() {
            return StaticClass::getConstants();
    },
));
```

Commits
-------

8a4e164 [Form] implemented ChoiceLoaderInterface in children of ChoiceType
afd7bf8 [Form] added `CallbackChoiceLoader`
2016-06-13 13:59:19 +02:00
Christophe Coevoet
7438617400 bug #19038 Fix feature detection for IE (Alsciende)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #19038).

Discussion
----------

Fix feature detection for IE

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

operator `!` has higher precedence (4) than operator `in` (8). Parentheses are mandatory here to have a chance at passing the test.

Commits
-------

b35658b Fix feature detection for IE
2016-06-13 13:03:02 +02:00
Cédric Bertolini
b35658b1ff Fix feature detection for IE
operator `!` has higher precedence (4) than operator `in` (8). Parentheses are mandatory here.
2016-06-13 13:03:01 +02:00
Jules Pietri
8a4e164286 [Form] implemented ChoiceLoaderInterface in children of ChoiceType 2016-06-13 12:03:28 +02:00
Jules Pietri
afd7bf8d56 [Form] added CallbackChoiceLoader 2016-06-13 12:02:06 +02:00
Grégoire Pineau
87af6e5ae3 [ExpressionLanguage] Added a way to dump AST 2016-06-13 11:15:31 +02:00
Fabien Potencier
ad1ffc5e95 minor #19035 [Console] added explanation of messages usage in a progress bar (fabpot)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] added explanation of messages usage in a progress bar

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19031
| License       | MIT
| Doc PR        | symfony/symfony-docs#6544

The intent of progress bar messages is currently wrongly documented. This PR updates the phpdoc to hopefully better describe the usage of such messages.

So, basically, messages are a way to add dynamic information in the progress bar; information that cannot be computed by the progress bar (like for all other placeholders).

Commits
-------

d92f3ea [Console] added explanation of messages usage in a progress bar
2016-06-13 08:28:47 +02:00
Fabien Potencier
3f192dccdc bug #18915 [DependencyInjection] force enabling the external XML entity loaders (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[DependencyInjection] force enabling the external XML entity loaders

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18876, #18908
| License       | MIT
| Doc PR        |

Commits
-------

12b5509 force enabling the external XML entity loaders
2016-06-13 08:25:24 +02:00
Fabien Potencier
11f303994c bug #19020 [Form] Fixed collapsed choice attributes (HeahDude)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fixed collapsed choice attributes

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19016
| License       | MIT
| Doc PR        | ~

Commits
-------

445dcc8 [Form] Fixed collapsed choice attributes
2016-06-13 07:29:09 +02:00
Jules Pietri
445dcc8ae2 [Form] Fixed collapsed choice attributes 2016-06-13 01:34:04 +02:00
Fabien Potencier
d92f3ea29e [Console] added explanation of messages usage in a progress bar 2016-06-12 09:56:51 +02:00
Fabien Potencier
e7077605bb feature #18869 [Routing] Throw exception when PHP start tag is missing (WouterJ)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Routing] Throw exception when PHP start tag is missing

| Q             | A
| ------------- | ---
| Branch?       | master (?)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony-docs/issues/6116 (and many more)
| License       | MIT
| Doc PR        | -

The Problem
---

In the documentation, we never use the PHP start tag. However, in the first tutorials, people simply copy/past the code examples, save the file and expect things to work. They seem to often forget to add the PHP start tag.

Without start tag, the annotation file loader simply skips the file without providing any reason why. As a big framework is quite overwhelming, simple things like this are completely forgotten.

The Fix
---

If a `*.php` file only consists of `T_INLINE_HTML`, it means there is no `<?php` start tag. In this case, instead of skipping the file, an exception is throwed with a possible fix.

BC Break?
---

As the file loader is only executed for `*.php` files, I think the BC break is minimal, but it is possible that people have applications with `*.php` files *without* a start tag. If this file lives in a routing loaded directory (e.g. when doing `@AppBundle/Controller`), it would now result in an exception.

I think this BC break is minimal and can be ignored. If you don't agree, we can add a little str match to check if `class ... {` exists. If that's the case, I think it's safe to say that it was meant to be a PHP file.

Bug or Feature?
---

I don't know if this is considered a bug or a feature, so I submitted it as a feature.

Commits
-------

1e765c8 Throw exception when PHP start tag is missing
2016-06-12 09:33:47 +02:00