Skip to content

Instantly share code, notes, and snippets.

@nikic

nikic/kill_these Secret

Last active December 23, 2015 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikic/c504dd761e7eebfca7ca to your computer and use it in GitHub Desktop.
Save nikic/c504dd761e7eebfca7ca to your computer and use it in GitHub Desktop.
Things that I would like to explicitely discourage in our documentation
(with a nice threat of deprecation):
What: Alternative array syntax
Kill: $foo{'bar'}
Instead: $foo['bar']
What: PHP4-style property declaration
Kill: var $foo;
Instead: public $foo;
What: PHP4-style constructor
Kill: class Foo { function Foo() {} }
Instead: class Foo { function __construct() {} }
What: Weird string interpolation syntax (1)
Kill: "a ${foo} b"
Instead: "a $foo b"
What: Weird string interpolation syntax (2)
Kill: "a ${foo['bar']} b"
Instead: "a {$foo['bar']} b" or "a $foo[bar] b"
@morrisonlevi
Copy link

As pointed out by @bwoebi, there is also:

What: Frivolous case seperator
Kill: case "value";
Instead: case "value":

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment