PHP Storm Formatting and PSR-2 Violations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * When the Exception message is too long for a single line, I split it up into pieces or | |
| * format it like below. Up until a recent PHP Storm update, that seemed to work. | |
| * | |
| * @param string $code | |
| * | |
| * @return string | |
| * @since 1.0.0 | |
| * @throws \CommonApi\Exception\UnexpectedValueException | |
| */ | |
| protected function getMessageTemplate($code) | |
| { | |
| if (isset($this->message_templates[ $code ])) { | |
| return $this->message_templates[ $code ]; | |
| } | |
| throw new UnexpectedValueException | |
| ('Fieldhandler Message getMessageTemplate Method: Do not have template: ' . $code); | |
| } | |
| /** | |
| * PHP Storm formats the message above like this example -- which creates a problem. | |
| * According to Scrutinizer PSR-2 testing, a "space before opening parenthesis of | |
| * function call (is) prohibited." | |
| * | |
| * Not sure how to deal with this other than to define a $message value and then | |
| * use that as the function input -- but -- it would be prefered if PHPStorm and | |
| * Scrutinizer interpretted PSR-2 in the same way. | |
| * | |
| * Have you had this problem? Ideas? | |
| * | |
| * @param string $code | |
| * | |
| * @return string | |
| * @since 1.0.0 | |
| * @throws \CommonApi\Exception\UnexpectedValueException | |
| */ | |
| protected function getMessageTemplate($code) | |
| { | |
| if (isset($this->message_templates[ $code ])) { | |
| return $this->message_templates[ $code ]; | |
| } | |
| throw new UnexpectedValueException | |
| ( | |
| 'Fieldhandler Message getMessageTemplate Method: Do not have template: ' . $code | |
| ); | |
| } |
pmjones
commented
May 8, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment