Skip to content

added some uses to make code prettier :) #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2017
Merged

added some uses to make code prettier :) #335

merged 1 commit into from
Jan 20, 2017

Conversation

pavelvondrasek
Copy link
Contributor

No description provided.

Copy link
Member

@dbu dbu left a comment

Choose a reason for hiding this comment

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

the build failure with 5.6 is not related to this PR. it is odd however, the package should be installable on php 5.6...

@@ -242,7 +251,7 @@ public function getNode($path)

if (false !== ($result = $this->caches['nodes']->fetch($cacheKey))) {
if ('ItemNotFoundException' === $result) {
throw new ItemNotFoundException(sprintf('Item "%s" not found in workspace "%s"', $path, $this->workspaceName));
throw new ItemNotFoundException("Item '$path' not found in workspace '$this->workspaceName'");
Copy link
Member

Choose a reason for hiding this comment

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

i prefer sprintf over string inlining. can you please revert this change?

and i thought $this->workspaceName would need to be in {} to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, although I like string inlining because it's shorter and I read article about string inlining for micro optimization: https://blog.blackfire.io/php-7-performance-improvements-encapsed-strings-optimization.html :-D :-D

I will revert this change :-)

@@ -467,12 +482,12 @@ public function getNodePathForIdentifier($uuid, $workspace = null)

$this->assertLoggedIn();

$cacheKey = "nodes by uuid: $uuid, ".$this->workspaceName;
$cacheKey = "nodes by uuid: $uuid, $this->workspaceName";
Copy link
Member

Choose a reason for hiding this comment

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

does this work without {}? can we switch this to sprintf as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that works in higher PHP version it's my fault that I have bad version setup in PHPStorm. :(

@dbu
Copy link
Member

dbu commented Jan 20, 2017 via email

@pavelvondrasek
Copy link
Contributor Author

Ok, I will revert inlining strings :)

@pavelvondrasek
Copy link
Contributor Author

David, I look here: https://3v4l.org/LRIDe according to this test I think that syntax without sprintf works in old unmaintained PHP version too :)

Can I let strings inlined in this PR?

@pavelvondrasek
Copy link
Contributor Author

pavelvondrasek commented Jan 20, 2017

https://3v4l.org/PTg1s

@dbu
Copy link
Member

dbu commented Jan 20, 2017

fair enough. and all those string operations are when throwing exceptions, which will be slow anyways, and is not the expected case, so i guess we don't care much about php 5 performance of those.

@dbu dbu merged commit 75bfb54 into jackalope:master Jan 20, 2017
@pavelvondrasek
Copy link
Contributor Author

Thank you for your feedback and merge! :)

I think that pros of inlined string is better readability (at least for me, I know that it's s subjective) :)

@pavelvondrasek
Copy link
Contributor Author

I think that now we must fix PHP 5.6 dependencies because it must work on PHP 5.6 :)

And what do you think to mark as skipped PHPCR\Tests\PhpcrUtils\CndParserTest:: testScannerErrorComment to fix tests in PHP7 until we find where is problem?

@dbu
Copy link
Member

dbu commented Jan 20, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants