Skip to content

Added support to constants, capital letters enclosed in % signs. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

margussipria
Copy link

I found mention of this here: http://www.symfony-project.org/book/1_2/05-Configuring-Symfony, but It wasn't implemented old sfYaml nor this new one. Zend Framworks implementation loops all constants, this is nicer, and easier when its enclosed by % signs.

Signed-off-by: Margus Sipria <margus@sipria.fi>
@fabpot
Copy link
Member

fabpot commented Mar 31, 2011

This is not part of the YAML specification and as such cannot be part of the core.

@fabpot fabpot closed this Mar 31, 2011
fabpot added a commit that referenced this pull request Jan 16, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[Yaml] Improve YAML boolean escaping

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

This PR ensures that PHP [values which would be interpreted as booleans][1] in older versions of the YAML spec are escaped with single quotes when dumped by the Dumper.

For example, dumping this:

```php
array(
    'country_code' => 'no',
    'speaks_norwegian' => 'y',
    'heating' => 'on',
)
```

Will produce this YAML:

```yaml
country_code: 'no'
speaks_norwegian: 'y'
heating: 'on'
```

[1]: http://yaml.org/type/bool.html

Commits
-------

8fa056b Inline private 'is quoting required' methods in Escaper
afe827a Merge pull request #2 from larowlan/patch-2
a0ec0fe Add comment as requested
1e0633e Merge pull request #1 from larowlan/patch-1
81a8090 Remove duplicate 'require'
3760e67 [Yaml] Improve YAML boolean escaping
fabpot added a commit that referenced this pull request Jan 16, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[Yaml] Improve YAML boolean escaping

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

This PR ensures that PHP [values which would be interpreted as booleans][1] in older versions of the YAML spec are escaped with single quotes when dumped by the Dumper.

For example, dumping this:

```php
array(
    'country_code' => 'no',
    'speaks_norwegian' => 'y',
    'heating' => 'on',
)
```

Will produce this YAML:

```yaml
country_code: 'no'
speaks_norwegian: 'y'
heating: 'on'
```

[1]: http://yaml.org/type/bool.html

Commits
-------

8fa056b Inline private 'is quoting required' methods in Escaper
afe827a Merge pull request #2 from larowlan/patch-2
a0ec0fe Add comment as requested
1e0633e Merge pull request #1 from larowlan/patch-1
81a8090 Remove duplicate 'require'
3760e67 [Yaml] Improve YAML boolean escaping
teohhanhui pushed a commit to teohhanhui/Yaml that referenced this pull request Aug 7, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[Yaml] Improve YAML boolean escaping

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

This PR ensures that PHP [values which would be interpreted as booleans][1] in older versions of the YAML spec are escaped with single quotes when dumped by the Dumper.

For example, dumping this:

```php
array(
    'country_code' => 'no',
    'speaks_norwegian' => 'y',
    'heating' => 'on',
)
```

Will produce this YAML:

```yaml
country_code: 'no'
speaks_norwegian: 'y'
heating: 'on'
```

[1]: http://yaml.org/type/bool.html

Commits
-------

8fa056b Inline private 'is quoting required' methods in Escaper
afe827a Merge pull request symfony#2 from larowlan/patch-2
a0ec0fe Add comment as requested
1e0633e Merge pull request symfony#1 from larowlan/patch-1
81a8090 Remove duplicate 'require'
3760e67 [Yaml] Improve YAML boolean escaping
ktomk added a commit to ktomk/yaml that referenced this pull request Sep 15, 2020
> PHP Fatal error:  Uncaught TypeError: abs(): Argument symfony#1 ($number) must
> be of type int|float, string given in Yaml/Parser.php:463
>
> #0 Yaml/Parser.php(463): abs('')  \
> symfony#1 ...

Fix is to move the int cast of the return value of the abs() function
to the parameter of it.

yaml spec is different here, it does "- 0" for the integer calculation
and no integer conversion when empty (the case here), this parse behavior
is kept unchanged.

in yaml this is "8.1.1.1. Block Indentation Indicator"

    [163] 	c-indentation-indicator(m) 	::=
       ns-dec-digit ⇒ m = ns-dec-digit - #x30
       /* Empty */  ⇒ m = auto-detect()


PHP: 8.0 beta 3
Log: https://travis-ci.org/github/ktomk/pipelines/jobs/727223470#L1898
Yaml-Spec: https://yaml.org/spec/1.2/spec.html#id2793979
ktomk added a commit to ktomk/yaml that referenced this pull request May 2, 2021
> PHP Deprecated:  trim(): Passing null to parameter symfony#1 ($string) of type
> string is deprecated in Yaml/Inline.php on line 49

(via ktomk/symfony-yaml)

PHP 8.1 profile.
symfony-splitter pushed a commit that referenced this pull request Apr 28, 2023
* 5.4:
  trim(): Argument #1 () must be of type string, bool given
  [Dumper] Trim leading newlines when checking if value begins with a space
  Fix the list of supported shells for completions in a phar
symfony-splitter pushed a commit that referenced this pull request Apr 28, 2023
* 6.2:
  Fix test class name
  trim(): Argument #1 () must be of type string, bool given
  Check if trace.curlCommand is defined in profiler
  [Dumper] Trim leading newlines when checking if value begins with a space
  [FrameworkBundle] Make service edges unique
  Fix the list of supported shells for completions in a phar
  Fix the usage of the zsh completion through the fpath discovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants