Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Fix use of invariant() calls when the string is not constant #77

Closed
wants to merge 1 commit into from

Conversation

shaygalon
Copy link

Some of the invariant tests are using strings composed of a concatenation and not a simple string. Hack type check will barf on those. Fixed to set the format string to "%s" and the string a parameter to conform to hack type checking standard.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions.

Copy link
Contributor

@fredemmott fredemmott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar changes throughout

invariant(is_array($v), $k.' is not an array');
invariant(is_array($v),
'%s',
$k.' is not an array');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • '%s is not an array', $k would be nicer
  • indent, don't align:
invariant(
  is_array($v),
  '%s',
....

@@ -83,7 +83,7 @@ private static function RunWithOptionsAndEngine(
$php_engine->start();
Process::sleepSeconds($options->delayPhpStartup);
invariant(
$php_engine->isRunning(),
$php_engine->isRunning(), '%s',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline first

@@ -129,7 +129,7 @@ private static function RunWithOptionsAndEngine(

invariant(!$siege->isRunning(), 'Siege is still running :/');
invariant(
$php_engine->isRunning(),
$php_engine->isRunning(),'%s',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline - and if there wasn't one, you'd want a space

@fredemmott
Copy link
Contributor

#78 addressed this

@fredemmott fredemmott closed this Jan 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants