romaricdrigon / MetaYaml

A powerful schema validator!
MIT License
104 stars 21 forks source link

Enhance error reporting and clean code #20

Open OnkelTem opened 5 years ago

OnkelTem commented 5 years ago

It seems to me the bad part of this tool is error reporting as it rarely reports anything reasonable when validating schema for example. So I started to enhance this part. I'm not sure though what is the best way to do so due to architecture specifics: exceptions logic is mixed with real errors and it's very difficult to distinguish. I'm going to provide a PR today so that you @romaricdrigon could check it out.

P.S. While I was editing this message I got notification that you finally replied in my other issue lol

romaricdrigon commented 5 years ago

Hello again, That's great, thank you. I believe there are some limitations coming from the architecture, at some point I wanted to rewrite it but it didn't happen. I'm looking forward seeing your PR.

OnkelTem commented 5 years ago

Sorry for the delay.

This patch only adds some better error reporting via tracking the tree. It's not perfect yet, so it's better to check in a separate branch. I'm not a dub hand in githubbing, if your github-fu is better than mine —you can handle this :)

Also, I didn't do anything in "code cleaning" - or rather in proper code hinting (I'm getting more that PHP 350 warnings in PHPStorm) as this task it too difficult for now and requires separate analysis.

romaricdrigon commented 5 years ago

Thank you! The patch is pretty substantial, I will review it tomorrow. MetaYaml is stuck on PHP 5.3 for now, I will have a look if I can make things better and make it PHP7.