povils / phpmnd

PHP Magic Number Detector
MIT License
554 stars 46 forks source link

What is "12" in Printer\XML ? #128

Closed sasezaki closed 3 years ago

sasezaki commented 3 years ago

Hi. I have question for this line. https://github.com/povils/phpmnd/blob/8b874f11774157d180ae6b20c339a7a0e934ccf9/src/Printer/Xml.php#L31

Why 12 added ?

maks-rafalko commented 3 years ago

It's funny that the lib that fights against magic numbers has really unclear magic number :)

exussum12 commented 3 years ago

It looks like a bug and should not be there imo.

@MacFJA can you confirm ?

exussum12 commented 3 years ago

Theres 1 more magic number detected as well, I will clean that up later this week

https://github.com/povils/phpmnd/blob/master/src/Printer/Console.php#L48 Printer/Console.php:48 Magic number: 2

48| $output->writeln(str_repeat(' ', 2 * self::TAB) . $hint);

Looking at the class it should be taking input from the console itself rather than just deciding whats best

MacFJA commented 3 years ago

It looks like a bug and should not be there imo.

@MacFJA can you confirm ?

Yeah, I see absolutely no reason for this + 12 to be here

sidz commented 3 years ago

I found that part a bit weird as well and refactored it in my fork. https://github.com/sidz/phpmnd/blob/master/src/Printer/Xml.php

unfortunately didn't have a chance to release a new version yet.