{"id":789,"date":"2020-01-11T22:08:54","date_gmt":"2020-01-11T22:08:54","guid":{"rendered":"https:\/\/sdf-docs.mansystems.com\/docs\/acr-rules\/reliability\/only-variables-that-are-not-empty-should-be-returned-or-assigned\/"},"modified":"2020-03-20T08:44:58","modified_gmt":"2020-03-20T08:44:58","slug":"emptyvariablereturned","status":"publish","type":"docs","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/emptyvariablereturned","title":{"rendered":"Only variables that are not empty should be returned or assigned"},"content":{"rendered":"\n<p>This is likely a bug. If a certain object, variable or attribute is empty it should not be returned. Instead, return an explicit empty.<\/p>\n\n\n\n<p><strong>Noncompliant example:<\/strong><\/p>\n\n\n\n<p><code>if $Object = empty<br>then $Object\/Attribute<\/code> \/\/ guaranteed to be empty<code><br>else 'not found'<\/code><\/p>\n\n\n\n<p><strong>Compliant example:<\/strong><\/p>\n\n\n\n<p><code>if $Object = empty<br>then  'not found'  <br>else  $Object\/Attribute <\/code><\/p>\n","protected":false},"featured_media":0,"parent":97,"menu_order":19,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-789","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/789"}],"collection":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=789"}],"version-history":[{"count":3,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/789\/revisions"}],"predecessor-version":[{"id":792,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/789\/revisions\/792"}],"up":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/97"}],"next":[{"title":"REST\/Web service should have custom error handling","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/webservicenoerror","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/255"}],"prev":[{"title":"Only non-empty objects should be dereferenced","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/emptyobjectdereference","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/675"}],"wp:attachment":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=789"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}