Comments (7)
example?
from cakephp-codesniffer.
Two examples, because one of them can probably be done better.
The first is from the cakephp/Datasources project, the LdapSource.php. I have a pull awaiting approval.
/**
* If you want to pull everything from a netscape stype ldap server
* iPlanet, Redhat-DS, Project-389 etc you need to ask for specific
* attributes like so. Other wise the attributes listed below wont
* show up
*/
public function setNetscapeEnv() {
$this->OperationalAttributes = 'accountUnlockTime aci copiedFrom ' .
'copyingFrom createTimestamp creatorsName dncomp entrydn entryid ' .
'hasSubordinates ldapSchemas ldapSyntaxes modifiersName modifyTimestamp ' .
'nsAccountLock nsAIMStatusGraphic nsAIMStatusText nsBackendSuffix ' .
'nscpEntryDN nsds5ReplConflict nsICQStatusGraphic nsICQStatusText ' .
'nsIdleTimeout nsLookThroughLimit nsRole nsRoleDN nsSchemaCSN ' .
'nsSizeLimit nsTimeLimit nsUniqueId nsYIMStatusGraphic nsYIMStatusText ' .
'numSubordinates parentid passwordAllowChangeTime passwordExpirationTime ' .
'passwordExpWarned passwordGraceUserTime passwordHistory ' .
'passwordRetryCount pwdExpirationWarned pwdGraceUserTime pwdHistory ' .
'pwdpolicysubentry retryCountResetTime subschemaSubentry';
$this->SchemaFilter = '(objectClass=subschema)';
$this->SchemaAttributes = 'objectClasses attributeTypes ldapSyntaxes ' .
'matchingRules matchingRuleUse createTimestamp modifyTimestamp';
}
The second is from a unit test for the SoapSource of the same project (and same pull request). In this one I've only wrapped across two lines, because the content is not something I particularly care about. Though I'm sure anyone else having to read it might have a differing opinion. This one could be done better (perhaps store the anticipated result in an external file, and the do the comparison, but I digress).
/**
* Testing getting last request
*
* Calls an actual soap service
*
* @return void
*/
public function testGetRequest() {
$config = array(
'wsdl' => 'file://' . App::pluginPath('Datasources') . 'Test' . DS . 'File' . DS . 'GeoCoderPHP.wsdl'
);
$this->Soap = new SoapSource($config);
$result = $this->Soap->query('geocode', array('location' => '1600 Pennsylvania Av, Washington, DC'));
$this->assertEquals($result[0]->street, 'Pennsylvania');
$this->assertEquals($this->Soap->getRequest(),
'<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://rpc.geocoder.us/Geo/Coder/US/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:geocode><location xsi:type="xsd:string">1600 Pennsylvania Av, Washington, DC</location></ns1:geocode></SOAP-ENV:Body></SOAP-ENV:Envelope>' . "\n");
}
from cakephp-codesniffer.
I don't think there's anything currently in the standard for line widths. we could add this:
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="150"/>
</properties>
</rule>
I think 80 chars is nowadays too restrictive.
The above would warn at > 120, and reject at > 150. For me 150 is the width of a 1/2 width vim session (or approx 1000px). I.e. > 150 is the point where I'd see wrapping if I have 2 sessions side by side (which is how I write code: code|test).
But, those numbers are just suggestions - mark?
Regarding concatenation, I'm not sure - I don't recall ever having problems with the standard when concatenating long strings, though previously I didn't use this standard.
from cakephp-codesniffer.
How about recommendations for the period (.) placement?
I would suggest something similar to as shown. The period is last on the line, and the expected indenting on the next line is the same, or one more in. If that is something that would even need to be written in.
from cakephp-codesniffer.
I don't think there is anything for requiring or not requiring an indent with a trailing concat operator. I know it will complain if there is trailing whitespace after the .
from cakephp-codesniffer.
Perhaps if the rules for whitespace after the .
were modified to stop at the EOL marker, and not comment on the whitespace on the following lines, which it seems to do at the moment.
from cakephp-codesniffer.
I created two test files with the two examples you've indicated in this ticket - and they both pass the CakePHP code standard without any errors being raised](https://gist.github.com/2519831).
If you're getting errors, please create a test file (see tests/files) and a pull request.
from cakephp-codesniffer.
Related Issues (20)
- False positive in CakePHP.Commenting.FunctionComment.InvalidReturn HOT 2
- Do not allow to use underscore prefixes HOT 1
- Error SlevoodingStandard.Arrays.TrailingAmatCrrayComma HOT 10
- Add an empty line between opening tag and declare HOT 2
- Allow for new major Slevomat v7
- PhpStorm HOT 1
- 5.0: Require static return type hint for chaining methods HOT 1
- Collection generics HOT 2
- Union type render fails in some cases
- Union type require spaces ? HOT 3
- Constructor property promotion HOT 3
- Cake 5 CS HOT 1
- Files are not queued by phpcs when using this standard HOT 3
- update links
- can support for slevomat/coding-standard v6 be removed? HOT 5
- Version 4.7 shows this warning HOT 1
- Compare PHP native param types and phpdoc param types
- ECS Support HOT 4
- Cake5: Dynamic property error with PHP 8.2 due to our ruleset HOT 1
- Enum case casing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp-codesniffer.