{"action":"created","comment":{"url":"https://api.github.com/repos/zendframework/zf2/pulls/comments/44906676","id":44906676,"diff_hunk":"@@ -239,7 +318,7 @@ public function generate()\n                 );\n                 foreach ($rii as $curKey => $curValue) {\n                     if (!$curValue instanceof ValueGenerator) {\n-                        $curValue = new self($curValue);\n+                        $curValue = new self($curValue, self::TYPE_AUTO, self::OUTPUT_MULTIPLE_LINE, $this->getConstants());","path":"library/Zend/Code/Generator/ValueGenerator.php","position":123,"original_position":123,"commit_id":"44c66f3aaf2b7ea9bae4bb6a528c21481bec94dd","original_commit_id":"44c66f3aaf2b7ea9bae4bb6a528c21481bec94dd","user":{"login":"Maks3w","id":1301698,"avatar_url":"https://avatars.githubusercontent.com/u/1301698?v=3","gravatar_id":"","url":"https://api.github.com/users/Maks3w","html_url":"https://github.com/Maks3w","followers_url":"https://api.github.com/users/Maks3w/followers","following_url":"https://api.github.com/users/Maks3w/following{/other_user}","gists_url":"https://api.github.com/users/Maks3w/gists{/gist_id}","starred_url":"https://api.github.com/users/Maks3w/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maks3w/subscriptions","organizations_url":"https://api.github.com/users/Maks3w/orgs","repos_url":"https://api.github.com/users/Maks3w/repos","events_url":"https://api.github.com/users/Maks3w/events{/privacy}","received_events_url":"https://api.github.com/users/Maks3w/received_events","type":"User","site_admin":false},"body":"@3axap4eHko Did you use ArrayObject for this line?\r\n\r\nI don't understand the performance improvements you claim. Non return by reference methods implemented on StdLib\\ArrayObject are invoked.\r\n\r\nThe only thing I see the constants are shared by the instances created in this line, so the only need I see $this->constants must be provided as reference. Alternative solutions may\r\n\r\n* Use PHP native `ArrayObject`\r\n* Refactor getConstants for return by reference.","created_at":"2015-11-16T10:16:09Z","updated_at":"2015-11-16T10:16:09Z","html_url":"https://github.com/zendframework/zf2/pull/4238#discussion_r44906676","pull_request_url":"https://api.github.com/repos/zendframework/zf2/pulls/4238","_links":{"self":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/comments/44906676"},"html":{"href":"https://github.com/zendframework/zf2/pull/4238#discussion_r44906676"},"pull_request":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/4238"}}},"pull_request":{"url":"https://api.github.com/repos/zendframework/zf2/pulls/4238","id":5181269,"html_url":"https://github.com/zendframework/zf2/pull/4238","diff_url":"https://github.com/zendframework/zf2/pull/4238.diff","patch_url":"https://github.com/zendframework/zf2/pull/4238.patch","issue_url":"https://api.github.com/repos/zendframework/zf2/issues/4238","number":4238,"state":"closed","locked":false,"title":"ValueGenerator constant detection","user":{"login":"3axap4eHko","id":1630657,"avatar_url":"https://avatars.githubusercontent.com/u/1630657?v=3","gravatar_id":"","url":"https://api.github.com/users/3axap4eHko","html_url":"https://github.com/3axap4eHko","followers_url":"https://api.github.com/users/3axap4eHko/followers","following_url":"https://api.github.com/users/3axap4eHko/following{/other_user}","gists_url":"https://api.github.com/users/3axap4eHko/gists{/gist_id}","starred_url":"https://api.github.com/users/3axap4eHko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3axap4eHko/subscriptions","organizations_url":"https://api.github.com/users/3axap4eHko/orgs","repos_url":"https://api.github.com/users/3axap4eHko/repos","events_url":"https://api.github.com/users/3axap4eHko/events{/privacy}","received_events_url":"https://api.github.com/users/3axap4eHko/received_events","type":"User","site_admin":false},"body":"For example, we need to get a file like this:\r\n```\r\n<?php\r\nreturn array(\r\n    'module' => array(\r\n        'moduleDir' => __DIR__ . '/../module'\r\n    )\r\n);\r\n```\r\nbut we cant pass argument ```__DIR__```, because this constant will be parsed and replaced to value, and we must quote it '__DIR__' . And finally, after generation, we will not get this:\r\n```\r\n        'moduleDir' => __DIR__ . '/../module'\r\n```\r\ngenerated value will be like it:\r\n```\r\n        'moduleDir' => '__DIR__ . \\'/../module\\''\r\n```\r\nChanges:\r\nAdd ability to define environment constants by method\r\n```\r\npublic function initEnvironmentConstants();\r\n```\r\nAlso add ability to define custom constants by methods\r\n```\r\npublic function addConstant($constant);\r\npublic function deleteConstant($constant)\r\n```\r\nproperty ```$constants``` must be type of ```ArrayObject``` for memory saving when pass it as argument for recursive generation by reference.","created_at":"2013-04-16T08:49:35Z","updated_at":"2015-11-16T10:16:09Z","closed_at":"2013-04-21T18:32:55Z","merged_at":null,"merge_commit_sha":"29176eeb89e8bc69e4cadf2bb4759d3e06e81fd2","assignee":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/zendframework/zf2/milestones/14","html_url":"https://github.com/zendframework/zf2/milestones/2.2.0","labels_url":"https://api.github.com/repos/zendframework/zf2/milestones/14/labels","id":260386,"number":14,"title":"2.2.0","description":"","creator":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":163,"state":"closed","created_at":"2013-02-05T15:28:42Z","updated_at":"2013-05-13T17:53:53Z","due_on":"2013-05-16T07:00:00Z","closed_at":"2013-05-13T17:53:53Z"},"commits_url":"https://api.github.com/repos/zendframework/zf2/pulls/4238/commits","review_comments_url":"https://api.github.com/repos/zendframework/zf2/pulls/4238/comments","review_comment_url":"https://api.github.com/repos/zendframework/zf2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendframework/zf2/issues/4238/comments","statuses_url":"https://api.github.com/repos/zendframework/zf2/statuses/44c66f3aaf2b7ea9bae4bb6a528c21481bec94dd","head":{"label":"3axap4eHko:constant","ref":"constant","sha":"44c66f3aaf2b7ea9bae4bb6a528c21481bec94dd","user":{"login":"3axap4eHko","id":1630657,"avatar_url":"https://avatars.githubusercontent.com/u/1630657?v=3","gravatar_id":"","url":"https://api.github.com/users/3axap4eHko","html_url":"https://github.com/3axap4eHko","followers_url":"https://api.github.com/users/3axap4eHko/followers","following_url":"https://api.github.com/users/3axap4eHko/following{/other_user}","gists_url":"https://api.github.com/users/3axap4eHko/gists{/gist_id}","starred_url":"https://api.github.com/users/3axap4eHko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3axap4eHko/subscriptions","organizations_url":"https://api.github.com/users/3axap4eHko/orgs","repos_url":"https://api.github.com/users/3axap4eHko/repos","events_url":"https://api.github.com/users/3axap4eHko/events{/privacy}","received_events_url":"https://api.github.com/users/3axap4eHko/received_events","type":"User","site_admin":false},"repo":null},"base":{"label":"zendframework:master","ref":"master","sha":"40a7c59143c373a76b716642ce53126822e3d7a0","user":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"repo":{"id":702550,"name":"zf2","full_name":"zendframework/zf2","owner":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendframework/zf2","description":"Official Zend Framework 2 git repository","fork":false,"url":"https://api.github.com/repos/zendframework/zf2","forks_url":"https://api.github.com/repos/zendframework/zf2/forks","keys_url":"https://api.github.com/repos/zendframework/zf2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendframework/zf2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendframework/zf2/teams","hooks_url":"https://api.github.com/repos/zendframework/zf2/hooks","issue_events_url":"https://api.github.com/repos/zendframework/zf2/issues/events{/number}","events_url":"https://api.github.com/repos/zendframework/zf2/events","assignees_url":"https://api.github.com/repos/zendframework/zf2/assignees{/user}","branches_url":"https://api.github.com/repos/zendframework/zf2/branches{/branch}","tags_url":"https://api.github.com/repos/zendframework/zf2/tags","blobs_url":"https://api.github.com/repos/zendframework/zf2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendframework/zf2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendframework/zf2/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendframework/zf2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendframework/zf2/statuses/{sha}","languages_url":"https://api.github.com/repos/zendframework/zf2/languages","stargazers_url":"https://api.github.com/repos/zendframework/zf2/stargazers","contributors_url":"https://api.github.com/repos/zendframework/zf2/contributors","subscribers_url":"https://api.github.com/repos/zendframework/zf2/subscribers","subscription_url":"https://api.github.com/repos/zendframework/zf2/subscription","commits_url":"https://api.github.com/repos/zendframework/zf2/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendframework/zf2/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendframework/zf2/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendframework/zf2/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendframework/zf2/contents/{+path}","compare_url":"https://api.github.com/repos/zendframework/zf2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendframework/zf2/merges","archive_url":"https://api.github.com/repos/zendframework/zf2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendframework/zf2/downloads","issues_url":"https://api.github.com/repos/zendframework/zf2/issues{/number}","pulls_url":"https://api.github.com/repos/zendframework/zf2/pulls{/number}","milestones_url":"https://api.github.com/repos/zendframework/zf2/milestones{/number}","notifications_url":"https://api.github.com/repos/zendframework/zf2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendframework/zf2/labels{/name}","releases_url":"https://api.github.com/repos/zendframework/zf2/releases{/id}","created_at":"2010-06-04T02:42:05Z","updated_at":"2015-11-15T17:52:03Z","pushed_at":"2015-09-15T17:16:02Z","git_url":"git://github.com/zendframework/zf2.git","ssh_url":"git@github.com:zendframework/zf2.git","clone_url":"https://github.com/zendframework/zf2.git","svn_url":"https://github.com/zendframework/zf2","homepage":"http://framework.zend.com/","size":230337,"stargazers_count":5265,"watchers_count":5265,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3222,"mirror_url":null,"open_issues_count":461,"forks":3222,"open_issues":461,"watchers":5265,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/4238"},"html":{"href":"https://github.com/zendframework/zf2/pull/4238"},"issue":{"href":"https://api.github.com/repos/zendframework/zf2/issues/4238"},"comments":{"href":"https://api.github.com/repos/zendframework/zf2/issues/4238/comments"},"review_comments":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/4238/comments"},"review_comment":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/4238/commits"},"statuses":{"href":"https://api.github.com/repos/zendframework/zf2/statuses/44c66f3aaf2b7ea9bae4bb6a528c21481bec94dd"}}}}