Commit Graph

16947 Commits

Author SHA1 Message Date
Ian Jenkins
8d99d7561b [Form][2.3] Fixes empty file-inputs getting treated as extra field. 2014-03-03 13:52:14 +01:00
Fabien Potencier
aed7eab53c [Console] fixed some initializations in the ProgressBar class 2014-03-03 13:22:12 +01:00
Fabien Potencier
554b28d975 feature #10356 [Console] A better progress bar (fabpot)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Console] A better progress bar

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9573, #9574, #10187, #9951, related to #9788
| License       | MIT
| Doc PR        | symfony/symfony-docs#3626

TODO:

 - [x] add some docs

See what this PR allows you to do easily:

![cwzpvk](https://f.cloud.github.com/assets/47313/2302190/30cd80e4-a170-11e3-8d88-80c4e4ca8b23.gif)

## New ProgressBar class

First, this PR deprecates `ProgressHelper` in favor of `ProgressBar`. The main difference is that the new `ProgressBar` class represents a single progress bar, which allows for more than one bar to be displayed at a time:

```php
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;

$output = new ConsoleOutput();

$bar1 = new ProgressBar($output, 10);
$bar2 = new ProgressBar($output, 20);
$bar2->setProgressCharacter('#');
$bar1->start();
print "\n";
$bar2->start();

for ($i = 1; $i <= 20; $i++) {
    // up one line
    $output->write("\033[1A");
    usleep(100000);
    if ($i <= 10) {
        $bar1->advance();
    }
    print "\n";
    $bar2->advance();
}
```

And here is how it looks like when run:

![progress-bars](https://f.cloud.github.com/assets/47313/2300612/4465889a-a0fd-11e3-8bc2-b1d2a0f5dc3d.gif)

## Format Placeholders

This pull request refactors the way placeholders in the progress bar are managed. It is now possible to add new placeholders or replace existing ones:

```php
// set a new placeholder
ProgressBar::setPlaceholderFormatterDefinition('remaining_steps', function (ProgressBar $bar) {
    return $bar->getMaxSteps() - $bar->getStep();
});

// change the behavior of an existing placeholder
ProgressBar::setPlaceholderFormatterDefinition('max', function (ProgressBar $bar) {
    return $bar->getMaxSteps() ?: '~';
});
```

Several new built-in placeholders have also been added:

 * `%remaining%`: Display the remaining time
 * `%estimated%`: Display the estimated time of the whole "task"
 * `%memory%`: Display the memory usage

## Formats

Formats can also be added (or built-in ones modified):

```php
ProgressBar::setFormatDefinition('simple', '%current%');

$bar->setFormat('simple');
// is equivalent to
$bar->setFormat('%current%');
```

Built-in formats are:

 * `quiet`
 * `normal`
 * `verbose`
 * `quiet_nomax`
 * `normal_nomax`
 * `verbose_nomax`

## Format Messages

You can also set arbitrary messages that depends on the progression in the progress bar:

```php
$bar = new ProgressBar($output, 10);
$bar->setFormat("%message% %current%/%max% [%bar%]");

$bar->setMessage('started');
$bar->start();

$bar->setMessage('advancing');
$bar->advance();

$bar->setMessage('finish');
$bar->finish();
```

You are not limited to a single message (`message` being just the default one):

```php
$bar = new ProgressBar($output, 10);
$bar->setFormat("%message% %current%/%max% [%bar%] %end%");

$bar->setMessage('started');
$bar->setMessage('', 'end');
$bar->start();

$bar->setMessage('advancing');
$bar->advance();

$bar->setMessage('finish');
$bar->setMessage('ended...', 'end');
$bar->finish();
```

## Multiline Formats

A progress bar can now span more than one line:

```php
$bar->setFormat("%current%/%max% [%bar%]\n%message%");
```

## Flexible Format Definitions

The hardcoded formatting for some placeholders (like `%percent%` or `%elapsed%`) have been removed in favor of a `sprintf`-like format:

```php
$bar->setFormat("%current%/%max% [%bar%] %percent:3s%");
```

Notice the `%percent:3s%` placeholder. Here, `%3s` is going to be used when rendering the placeholder.

## ANSI colors and Emojis

The new progress bar output can now contain ANSI colors and.or Emojis (see the small video at the top of this PR).

Commits
-------

0d1a58c [Console] made formats even more flexible
8c0022b [Console] fixed progress bar when using ANSI colors and Emojis
38f7a6f [Console] fixed PHP comptability
244d3b8 [Console] added a way to globally add a progress bar format or modify a built-in one
a9d47eb [Console] added a way to add a custom message on a progress bar
7a30e50 [Console] added support for multiline formats in ProgressBar
1aa7b8c [Console] added more default placeholder formatters for the progress bar
2a78a09 [Console] refactored the progress bar to allow placeholder to be extensible
4e76aa3 [Console] added ProgressBar (to replace the stateful ProgressHelper class)
2014-03-03 10:45:47 +01:00
Fabien Potencier
0d1a58c469 [Console] made formats even more flexible 2014-03-03 10:38:06 +01:00
Fabien Potencier
8c0022b769 [Console] fixed progress bar when using ANSI colors and Emojis 2014-03-02 10:16:43 +01:00
Fabien Potencier
52f8dc7c1b Merge branch '2.3' into 2.4
* 2.3:
  changed some PHPUnit assertions to more specific ones
  fixed Kernel::stripComments() normalizing new-lines
  added a BC comment
  Update FileLoader to fix issue #10339
2014-03-01 18:35:04 +01:00
Fabien Potencier
0ccf5bcd7a minor #10358 PHPUnit more specific assertions (fabpot)
This PR was merged into the 2.3 branch.

Discussion
----------

PHPUnit more specific assertions

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

Commits
-------

4927d0c changed some PHPUnit assertions to more specific ones
2014-03-01 18:34:45 +01:00
Fabien Potencier
4927d0c8a3 changed some PHPUnit assertions to more specific ones 2014-03-01 18:25:29 +01:00
Fabien Potencier
38f7a6f817 [Console] fixed PHP comptability 2014-03-01 18:12:37 +01:00
Fabien Potencier
244d3b81be [Console] added a way to globally add a progress bar format or modify a built-in one 2014-03-01 17:52:22 +01:00
Fabien Potencier
a9d47ebbf2 [Console] added a way to add a custom message on a progress bar 2014-03-01 10:21:47 +01:00
Fabien Potencier
7a30e50eee [Console] added support for multiline formats in ProgressBar 2014-03-01 10:21:46 +01:00
Fabien Potencier
1aa7b8c8b9 [Console] added more default placeholder formatters for the progress bar 2014-03-01 10:21:46 +01:00
Fabien Potencier
2a78a09f1b [Console] refactored the progress bar to allow placeholder to be extensible 2014-03-01 10:21:46 +01:00
Fabien Potencier
4e76aa3fbc [Console] added ProgressBar (to replace the stateful ProgressHelper class) 2014-03-01 07:33:14 +01:00
Fabien Potencier
65c9aca2e6 feature #10352 [DataCollector] Improves the readability of the collected arrays in the profiler (fabpot)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[DataCollector] Improves the readability of the collected arrays in the profiler

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

This PR is based on #10155.

Original description:

It simply improves the readability of the collected arrays in the profiler:

__before__:
```
Array(date => Array(year => , month => , day => ), time => Array(hour => ))
```

__after__:
```
[
  date => [
      year => ,
      month => ,
      day =>
  ],
  time => [
      hour =>
  ]
]
```

Commits
-------

dce66c9 removed double-stringification of values in the profiler
1cda2d4 [HttpKernel] tweaked value exporter
3f297ea Improves the readability of the collected arrays in the profiler.
2014-03-01 03:56:57 +01:00
Fabien Potencier
dce66c9d79 removed double-stringification of values in the profiler 2014-03-01 03:55:22 +01:00
Fabien Potencier
eede3303f3 feature #10354 removed as many usage of the request service as possible without breaking BC (fabpot)
This PR was merged into the 2.5-dev branch.

Discussion
----------

removed as many usage of the request service as possible without breaking BC

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

Commits
-------

d638369 removed as many usage of the request service as possible without breaking BC
2014-02-28 16:50:01 +01:00
Fabien Potencier
d638369e2a removed as many usage of the request service as possible without breaking BC 2014-02-28 16:35:07 +01:00
Fabien Potencier
681f14bce1 feature #10353 [Debug] ExceptionHandlerInterface to allow third party exception handlers to handle fatal errors caught by ErrorHandler (FineWolf)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Debug] ExceptionHandlerInterface to allow third party exception handlers to handle fatal errors caught by ErrorHandler

| Q             | A
| ------------- | ---
| Bug fix?      | yes (other project)
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| Related tickets | schmittjoh/JMSDebuggingBundle#68
| License       | MIT
| Doc PR        |

The current `ErrorHandler` is extremely strict on how it selects whether to run an `ExceptionHandler` when an `E_FATAL` occurs.

This modification allows any class that implements `ExceptionHandlerInterface` to handle a `FatalErrorException` created by the `ErrorHandler`.

Commits
-------

15d063b Create ExceptionHandlerInterface to allow third party exception handlers' to handle fatal errors
2014-02-28 16:05:29 +01:00
Andrew Moore
15d063b6f7 Create ExceptionHandlerInterface to allow third party exception handlers' to handle fatal errors 2014-02-28 09:48:11 -05:00
Fabien Potencier
dde2365de8 bug #10284 [2.4][HttpKernel] Fix issue #10209 (stephpy)
This PR was merged into the 2.4 branch.

Discussion
----------

[2.4][HttpKernel] Fix issue #10209

When the profiler has `only_exception` option activated and a subrequest which
throw an exception, the parent profile cannot be found.

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

Fix issue #10209

Commits
-------

b949c49 [2.4][HttpKernel] Fix issue #10209 When the profiler has `only_exception` option activated and a subrequest throw an exception, the parent profile cannot be found.
2014-02-28 15:10:50 +01:00
Fabien Potencier
a4f0f0cc98 bug #10351 [HttpKernel] fix stripComments() normalizing new-lines (sstok)
This PR was merged into the 2.3 branch.

Discussion
----------

[HttpKernel] fix stripComments() normalizing new-lines

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

This makes normalizing new-lines less error-prone
when a string contains multiple new line-lines

Commits
-------

63032c7 fixed Kernel::stripComments() normalizing new-lines
2014-02-28 14:50:48 +01:00
Fabien Potencier
1cda2d43c4 [HttpKernel] tweaked value exporter 2014-02-28 14:42:14 +01:00
Sebastiaan Stok
63032c7c89 fixed Kernel::stripComments() normalizing new-lines
This makes normalizing new-lines less error-prone
when a string contains multiple new line-lines
2014-02-28 13:42:15 +01:00
Quentin Schuler
3f297eaa18 Improves the readability of the collected arrays in the profiler. 2014-02-28 13:12:58 +01:00
Fabien Potencier
e756686bb4 added a BC comment 2014-02-28 09:17:36 +01:00
Fabien Potencier
79999ffd5c bug #10348 Update FileLoader to fix issue #10339 (msumme)
This PR was merged into the 2.3 branch.

Discussion
----------

Update FileLoader to fix issue #10339

This fixes an issue in Symfony\Component\Config\Loader\FileLoader

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

Commits
-------

3988728 Update FileLoader to fix issue #10339
2014-02-28 09:16:24 +01:00
Max Summe
3988728169 Update FileLoader to fix issue #10339
FileLoader now uses resolved FileLoader's (the one that explicitly
supports that resource) FileLocatorInterface instance before falling
back to its own when trying to load resources in import() method.
2014-02-27 21:56:34 -06:00
Fabien Potencier
cb4a9cc2eb Merge branch '2.3' into 2.4
* 2.3:
  bumped Symfony version to 2.3.12
  updated VERSION for 2.3.11
  update CONTRIBUTORS for 2.3.11
  updated CHANGELOG for 2.3.11
  Follow-up to #10312: Fixed minor performance related issues in Yaml\Inline.

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
2014-02-27 18:04:59 +01:00
Fabien Potencier
1c0fcd0252 bumped Symfony version to 2.3.12 2014-02-27 17:33:40 +01:00
Fabien Potencier
aa5b228e87 updated VERSION for 2.3.11 2014-02-27 15:55:30 +01:00
Fabien Potencier
75b94ab601 update CONTRIBUTORS for 2.3.11 2014-02-27 15:55:21 +01:00
Fabien Potencier
812f870ce5 updated CHANGELOG for 2.3.11 2014-02-27 15:55:17 +01:00
Fabien Potencier
186f0855a8 bug #10306 [Serializer] Throw exception when unable to normalize embedded object (gquemener)
This PR was submitted for the 2.1 branch but it was merged into the 2.4 branch instead (closes #10306).

Discussion
----------

[Serializer] Throw exception when unable to normalize embedded object

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

This PR intends to prevent Fatal Error about calling undefined method `normalize()` on object `$serializer` in the `GetSetMethodNormalizer` when injected serializer does not implement the `NormalizerInterface`.

Commits
-------

8a54920 [Serializer] Throw exception when unable to normalize embedded object
2014-02-27 15:27:31 +01:00
Gildas Quéméner
a92aa5e849 Throw exception when unable to normalize embedded object
Added a check to ensure that injected serializer of the
GetSetMethodNormalizer is a normalizer before normalizing object value.
2014-02-27 15:27:25 +01:00
Fabien Potencier
4986f6db46 bug #10338 [ExpressionLanguage] Fixed evaluation of short circuit operators (florianv)
This PR was submitted for the 2.4-dev branch but it was merged into the 2.4 branch instead (closes #10338).

Discussion
----------

[ExpressionLanguage] Fixed evaluation of short circuit operators

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

Commits
-------

fba0a40 [ExpressionLanguage] Fixed evaluation of short circuit operators
2014-02-27 14:31:10 +01:00
florianv
3a46a8e799 Fixed evaluation of short circuit operators 2014-02-27 14:31:09 +01:00
Fabien Potencier
ca60916331 minor #10323 [Yaml] Fixed minor performance related issues in Yaml\Inline. (sun)
This PR was submitted for the 2.3-dev branch but it was merged into the 2.3 branch instead (closes #10323).

Discussion
----------

[Yaml] Fixed minor performance related issues in Yaml\Inline.

Follow-up to #10312

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

Commits
-------

a36fef5 Follow-up to #10312: Fixed minor performance related issues in Yaml\Inline.
2014-02-25 22:36:55 +01:00
sun
108e169353 Follow-up to #10312: Fixed minor performance related issues in Yaml\Inline. 2014-02-25 22:36:55 +01:00
Fabien Potencier
7baeaa2fd7 Merge branch '2.4'
* 2.4:
  [Process] minor fixes
  Improve performance of getNextEmbedBlock by removing unnecessary preg_match and function calls.
  Avoid unnecessary line indentation calculation.
  Optimise Inline::evaluateScalar() for parsing strings.
  fixed CS
  fixed parsing Mongo DSN and added Test for it
  () is also a valid delimiter
  Adding PHP 5.6 to travis-ci tests
  Update BCryptPasswordEncoder.php
  [Validator] Removed PHP <5.3.3 specific code which is not officially supported.
  Fixed wrong redirect url if path contains some query parameters
2014-02-24 17:21:51 +01:00
Fabien Potencier
81e27d2a3e Merge branch '2.3' into 2.4
* 2.3:
  [Process] minor fixes
  Improve performance of getNextEmbedBlock by removing unnecessary preg_match and function calls.
  Avoid unnecessary line indentation calculation.
  Optimise Inline::evaluateScalar() for parsing strings.
  fixed CS
  fixed parsing Mongo DSN and added Test for it
  () is also a valid delimiter
  Adding PHP 5.6 to travis-ci tests
  Update BCryptPasswordEncoder.php
  [Validator] Removed PHP <5.3.3 specific code which is not officially supported.
  Fixed wrong redirect url if path contains some query parameters
2014-02-24 17:20:54 +01:00
Fabien Potencier
30f35c08a1 minor #10305 [Process] minor fixes (aeryaguzov)
This PR was squashed before being merged into the 2.3 branch (closes #10305).

Discussion
----------

[Process] minor fixes

| Q             | A
| ------------- | ---
| Fixed tickets | [n/a]
| License       | MIT

The "same" PR as #10220, but on "2.3" branch

Commits
-------

f03e5dc [Process] minor fixes
2014-02-24 17:20:12 +01:00
Andrey Ryaguzov
f03e5dcd40 [Process] minor fixes 2014-02-24 17:20:12 +01:00
Fabien Potencier
a8209307f8 bug #10308 [Debug] enhance non-PSR-0 compatibility for case mismatch test (nicolas-grekas)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Debug] enhance non-PSR-0 compatibility for case mismatch test

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

Fix compatibility with non-PSR-0/4 loading schemes.
See https://github.com/symfony/symfony/pull/10201#issuecomment-35567573

Commits
-------

120e197 [Debug] enhance non-PSR-0 compatibility for case mismatch test
2014-02-24 17:18:53 +01:00
Fabien Potencier
eed7a864d8 minor #10317 [YAML] Improve performance of getNextEmbedBlock (alexpott)
This PR was merged into the 2.3 branch.

Discussion
----------

[YAML] Improve performance of getNextEmbedBlock

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

By removing unnecessary preg_match and function calls - isCurrentLineEmpty() contains a call to isCurrentLineBlank() - therefore this function is called twice every time this condition is hit. The preg_match appears to legacy handling of blank lines.

This improves the performance of the Drupal 8 installer.
![image](https://f.cloud.github.com/assets/769634/2241426/69effb0c-9cd1-11e3-9145-e4fabd2ec870.png)

Commits
-------

995a033 Improve performance of getNextEmbedBlock by removing unnecessary preg_match and function calls.
2014-02-24 17:11:10 +01:00
Fabien Potencier
ca4736b4a1 [Console] fixed missing abstract keyword 2014-02-24 17:03:53 +01:00
Fabien Potencier
537f1fafbf minor #10315 Fix typo in method name (fixe)
This PR was merged into the 2.5-dev branch.

Discussion
----------

Fix typo in method name

Commits
-------

01858d3 Fixed typo in method name
2014-02-24 17:03:19 +01:00
Fabien Potencier
9c582d9bea minor #10320 Fix typo in UPGRADE-3.0.md (hice3000)
This PR was merged into the 2.5-dev branch.

Discussion
----------

Fix typo in UPGRADE-3.0.md

Commits
-------

53c8189 Fix typo in UPGRADE-3.0.md
2014-02-24 17:02:25 +01:00
Malte N
53c81898e7 Fix typo in UPGRADE-3.0.md 2014-02-24 16:17:08 +01:00