phpopen-sourcephpcs

PHPCS requires a license but my code is closed source


After doing some digging online there doesn't seem to be an immediate answer to this.

I am writing code for a closed source application and when running PHPCS its informing me that an @license tag is required in order to conform to PSR standards.

I cannot apply an open source license to this code because the application is closed source proprietary code.

Does applying an @license tag with "No License" suffice to cover this requirement? Or is there a standard closed source license I should use?


Solution

  • Rather than applying a meaningless @license tag to every file, I'd instead recommend adjusting your config file to just ignore that particular sniff.

    You can get the full name of the offending sniff with the -s command line option:

    % vendor/bin/phpcs -s
    ------------------------------------------------------------------
      18 | ERROR   | Missing @license tag in class comment
         |         | (PEAR.Commenting.ClassComment.MissingLicenseTag)
    

    Then add that to an exclude line in your phpcs.xml:

    <?xml version="1.0"?>
    <ruleset name="MyProject">
        <rule ref="PEAR">
            <exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag"/>
        </rule>
        <file>src</file>
    </ruleset>