{"action":"created","issue":{"url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/993","repository_url":"https://api.github.com/repos/pmmp/PocketMine-MP","labels_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/993/labels{/name}","comments_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/993/comments","events_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/993/events","html_url":"https://github.com/pmmp/PocketMine-MP/pull/993","id":233397922,"number":993,"title":"Strict type all the things","user":{"login":"dktapps","id":14214667,"avatar_url":"https://avatars1.githubusercontent.com/u/14214667?v=3","gravatar_id":"","url":"https://api.github.com/users/dktapps","html_url":"https://github.com/dktapps","followers_url":"https://api.github.com/users/dktapps/followers","following_url":"https://api.github.com/users/dktapps/following{/other_user}","gists_url":"https://api.github.com/users/dktapps/gists{/gist_id}","starred_url":"https://api.github.com/users/dktapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dktapps/subscriptions","organizations_url":"https://api.github.com/users/dktapps/orgs","repos_url":"https://api.github.com/users/dktapps/repos","events_url":"https://api.github.com/users/dktapps/events{/privacy}","received_events_url":"https://api.github.com/users/dktapps/received_events","type":"User","site_admin":false},"labels":[{"id":454785701,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/Category:%20Core","name":"Category: Core","color":"00aa55","default":false},{"id":454787972,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/PR:%20Contribution","name":"PR: Contribution","color":"bfdadc","default":false},{"id":489193560,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/PR:%20Optimization","name":"PR: Optimization","color":"bfdadc","default":false},{"id":454786550,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/Priority:%20High","name":"Priority: High","color":"d93f0b","default":false},{"id":456140772,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/Status:%20Insufficiently%20Tested","name":"Status: Insufficiently Tested","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-06-03T22:02:57Z","updated_at":"2017-06-06T13:30:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/993","html_url":"https://github.com/pmmp/PocketMine-MP/pull/993","diff_url":"https://github.com/pmmp/PocketMine-MP/pull/993.diff","patch_url":"https://github.com/pmmp/PocketMine-MP/pull/993.patch"},"body":"## Introduction\r\nI decided to bite the bullet on this one and just do it. Typehinting and improved documentation will follow.\r\n\r\nThis pull request makes strict types the standard throughout the PocketMine-MP source code.\r\n\r\n### Why?\r\nOne of the biggest weaknesses of previous versions of PHP is the tendecy to produce unexpected behaviour when something bad happens. Strict types help prevent this, as they disable type coercion for function arguments and return types, which prevents undefined/unexpected behaviour.\r\n\r\nYou can see already looking at the commits that enabling strict types already highlighted dozens of issues which were previously hidden and unknown, causing weird behaviour. This has helped fix a large number of hidden bugs.\r\n\r\n### Behavioural changes\r\nThe PocketMine-MP core code is now ALL subjected to strict-type checking rules.\r\n\r\n### API changes\r\nThere are no major API changes to note with this pull request, since strict type rules only apply per-file. However, do be aware that:\r\n- Function argument strictness is decided by the _caller_, not the callee. This means that in most cases you'll still be able to call core API methods without type-casts if you don't have strict types enabled in your plugin code, because the arguments will be coerced to match the signature if the caller does not have strict types enabled. I dislike this behaviour, and recommend you enable strict types in your plugins to help highlight issues when you do something stupid, however this is not a requirement.\r\n- Return type strictness is decided by the callee. This means that if you define an `int` return type and have strict types enabled, you may not return a float or string or anything else.\r\n- We will be type-hinting most function arguments and return types in the core code (where applicable) in the near future. This may break code that inherits from the core code which does not declare compatible types on overridden methods. Currently this should not be a problem, but here is a warning for the future.\r\n### Tests\r\nThe server is joinable, and basic functionality of the server has been verified; however this has not been tested in detail, and beyond a shadow of a doubt there will be many more crashes to see yet. \r\n\r\nHowever, I've always been a firm supporter of the idea that crash > unexpected behaviour. Crashes tell you when the developer has done something stupid, and the sooner and more loudly it crashes, the quicker and easier it is to fix."},"comment":{"url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/comments/306486506","html_url":"https://github.com/pmmp/PocketMine-MP/pull/993#issuecomment-306486506","issue_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/993","id":306486506,"user":{"login":"dktapps","id":14214667,"avatar_url":"https://avatars1.githubusercontent.com/u/14214667?v=3","gravatar_id":"","url":"https://api.github.com/users/dktapps","html_url":"https://github.com/dktapps","followers_url":"https://api.github.com/users/dktapps/followers","following_url":"https://api.github.com/users/dktapps/following{/other_user}","gists_url":"https://api.github.com/users/dktapps/gists{/gist_id}","starred_url":"https://api.github.com/users/dktapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dktapps/subscriptions","organizations_url":"https://api.github.com/users/dktapps/orgs","repos_url":"https://api.github.com/users/dktapps/repos","events_url":"https://api.github.com/users/dktapps/events{/privacy}","received_events_url":"https://api.github.com/users/dktapps/received_events","type":"User","site_admin":false},"created_at":"2017-06-06T13:30:31Z","updated_at":"2017-06-06T13:30:31Z","body":"I would like to get this merged ASAP. As far as I know there are no strict type checking violations in the core in its current state, but regardless if people could test & review this that would be great."}}
{"actor":{"display_login":"dktapps"}}