Remove the feeds module
This commit is contained in:
parent
acfd1cca8d
commit
0c98be96eb
851 changed files with 840 additions and 10348 deletions
|
@ -87,14 +87,5 @@
|
|||
"processed": "\n <p>A popular approach to writing clean code is to avoid the \"else\" keyword and, if possible, avoid nesting <code>if<\/code> statements within other <code>if<\/code> statements.\nIf I look at some code, I want to see as few indentation levels as possible, making the code easier to read and understand.<\/p>\n\n<h2 id=\"what-should-i-do-instead%3F\">What should I do instead?<\/h2>\n\n<p>Instead, you check for a condition; if that isn't met, you return early.\nFor example, here is some code I saw recently during a meetup talk:<\/p>\n\n<pre><code class=\"language-php\">$callingClass = $scope->getClassReflection()->getName();\n\nif ($callingClass === TextMessageQueueProcessor::class) {\n return [];\n}\n\n$type = $scope->getType($node->var);\n\nforeach ($type->getReferencedClasses() as $targetClass) {\n if ($targetClass === TextMessageSender::class) {\n return [\n RuleErrorBuilder::message(\n sprintf(\n \"Can not call %s from %s\",\n $targetClass,\n $callingClass\n )\n )->build()\n ];\n }\n}\n\nreturn [];\n<\/code><\/pre>\n\n<p>There are no <code>else<\/code> statements.<\/p>\n\n<p>If the calling class isn't of the required type, it returns immediately with no violations, and we continue, knowing the calling class must be what we need.<\/p>\n\n<p>If the target class is one where the code shouldn't be called from, it returns immediately with the violation.<\/p>\n\n<p>Finally, if no violations were found within the referenced classes, it returns an empty array.<\/p>\n\n<h2 id=\"here%27s-the-thing\">Here's the thing<\/h2>\n\n<p>The code always returns an array of rule violations but does so as soon as possible at each point.<\/p>\n\n<p>The code is clean and readable, and I can understand it, knowing once each condition is passed, I don't need to continue thinking about it.<\/p>\n\n<p>Whilst there are some situations to use <code>else<\/code>, most of the time I've found that I can use an early return instead.<\/p>\n\n ",
|
||||
"summary": null
|
||||
}
|
||||
],
|
||||
"feeds_item": [
|
||||
{
|
||||
"imported": "1970-01-01T00:32:50+00:00",
|
||||
"guid": null,
|
||||
"hash": "d2e8d39f68f4ae6ba0c9ffab688585b7",
|
||||
"target_type": "feeds_feed",
|
||||
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue