mustangostang / spyc

A simple YAML loader/dumper class for PHP
MIT License
701 stars 206 forks source link

Replaces "n" with bool(false) but not "y" with bool(true) #78

Open demonking opened 4 years ago

demonking commented 4 years ago

It's a wrong behaviour to cast such information to any kind of datatype. Symfony/yaml handles this without any problems

    name: canaccess
    field: can_access
    convert:
        translate:
            -
                pattern: j
                replacement: 1
            -
                pattern: n
                replacement: 0
Result : 

 ["convert"]=>
    array(1) {
      ["translate"]=>
      array(2) {
        [0]=>
        array(2) {
          ["pattern"]=>
          string(1) "j"
          ["replacement"]=>
          int(1)
        }
        [1]=>
        array(2) {
          ["pattern"]=>
          bool(false)
          ["replacement"]=>
          int(0)
        }
      }