Style guide for writing consistent PHP for WordPress projects.

Overview

Inpsyde PHP Coding Standards

PHP 7+ coding standards for Inpsyde WordPress projects.

PHP Quality Assurance


Installation

The code styles are enforced via the popular php_codesniffer and can be installed via Composer by the name inpsyde/php-coding-standards.

It means they can be installed by adding the entry to composer.json require-dev:

{
    "require-dev": {
        "inpsyde/php-coding-standards": "^1@dev"
    }
}

(the @dev suffix can be removed if the project minimum-stability is "dev", or as soon as the stable v1.0.0 of the standards will be released.)

or via command line with:

$ composer require inpsyde/php-coding-standards --dev

Usage

Basic usage

When the package is installed via Composer, and dependencies are updated, everything is ready and the coding standards can be checked via:

">
$ vendor/bin/phpcs --standard="Inpsyde" <path>

Where is at least one file or directory to check, e.g.:

$ vendor/bin/phpcs --standard="Inpsyde" ./src/ ./my-plugin.php

On Windows it would be something like:

$ ./vendor/bin/phpcs.bat --standard="Inpsyde" ./src/ ./my-plugin.php

There are many options that can be used to customise the behavior of the command, to get documentation use:

$ vendor/bin/phpcs --help

Configuration File

To do not have to pass all the arguments to the command line, and to also be able to do customization it is also possible to create a phpcs.xml.dist file that contains something like this:

My Project coding standard. ./src ./tests/src ">
xml version="1.0"?>
<ruleset name="MyProjectCodingStandard">

    <description>My Project coding standard.description>

    <file>./srcfile>
    <file>./tests/srcfile>

    <arg value="sp"/>
    <arg name="colors"/>

    <config name="testVersion" value="7.2-"/>
    <config name="text_domain" value="my-project"/>
    
    <rule ref="Inpsyde">
        <exclude name="WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize" />
    rule>
    
    <rule ref="Inpsyde.CodeQuality.Psr4">
        <properties>
            <property
                name="psr4"
                type="array"
                value="Inpsyde\MyProject=>src,Inpsyde\MyProject\Tests=>tests/src|tests/unit"/>
        properties>
    rule>
    
    <rule ref="Inpsyde.CodeQuality.ElementNameMinimalLength">
        <properties>
            <property name="additionalAllowedNames" type="array" value="c,me,my" />
        properties>
    rule>

ruleset>

Such a configuration allows to run the code style check with only:

$ vendor/bin/phpcs

Moreover, thanks to the text_domain setting, Code Sniffer will also check that all WP internationalization functions are called with the proper text domain.


Included rules

PSR-1, PSR-2, PSR-12

See https://www.php-fig.org/psr/psr-1, https://www.php-fig.org/psr/psr-2, https://www.php-fig.org/psr/psr-12

Neutron Standard

See https://github.com/Automattic/phpcs-neutron-standard

Almost all Neutron Standard rules are included.

WordPress Coding Standard

To ensure code quality, and compatibility with VIP, several WordPress Coding Standard rules have been "cherry picked" from WP coding standards.

See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.

PHPCompatibility

See https://github.com/wimg/PHPCompatibility.

It allows to analyse code for compatibility with higher and lower versions of PHP. The default target version is PHP 7.0+.

Target version can be changed via custom phpcs.xml.

Generic Rules

Some rules are also included from PHPCS itself. Those rules fall in the "Generic", "Squiz" and "PEAR" namespace. Some of them are included by other styles, mainly by PSR-1 and PSR-2.

Custom Rules

Some custom rules are also in use. They are:

Sniff name Description Has Config Auto-Fixable
ArgumentTypeDeclaration Enforce argument type declaration.
ConstantVisibility Force use of visibility for constants.
DisallowShortOpenTag Disallow short open PHP tag (short echo tag allowed).
ElementNameMinimalLength Use minimum 3 chars for names (with a few exclusions)
ForbiddenPublicProperty No public class properties
FunctionBodyStart Handle blank line at start of function body.
FunctionLength Max 50 lines per function/method, excluding blank lines and comments-only lines.
HookClosureReturn Ensure that actions callbacks do not return anything, while filter callbacks return something.
LineLength Max 100 chars per line
NestingLevel Max indent level of 3 inside functions
NoAccessors Discourage usage of getters and setters.
NoElse Discourage usage of else.
NoTopLevelDefine Discourage usage of define where const is preferable.
PropertyPerClassLimit Discourage usage of more than 10 properties per class.
Psr4 Check PSR-4 compliance
ReturnTypeDeclaration Enforce return type declaration
StaticClosure Points closures that can be static.
VariablesName Check variable (and properties) names

For notes and configuration see /inpsyde-custom-sniffs.md file in this repo.


Removing or Disabling Rules

Rules Tree

Sometimes it is necessary to don't follow some rules. To avoid error reporting is is possible to:

  • Removing rules for an entire project via configuration
  • Disabling rules from code, only is specific places

In both cases it is possible to remove or disable:

  • a whole standard
  • a standard subset
  • a single sniff
  • a single rules

The for things above are in hierarchical relationship: a standard is made of one or more subset, each subset contains one or more sniff and each sniff contains one or more rule.

Remove rules via configuration file

Rules can be removed for the entire project by using a custom phpcs.xml, with a syntax like this:

">
xml version="1.0"?>
<ruleset name="MyProjectCodingStandard">

	<rule ref="Inpsyde">
		<exclude name="PSR1.Classes.ClassDeclaration"/>
	rule>

ruleset>

In the example above, the sniff PSR1.Classes.ClassDeclaration (and all the rules it contains) has been removed.

Replacing PSR1.Classes.ClassDeclaration with just PSR1 had been possible to remove the whole standard, while replacing it with PSR1.Classes.ClassDeclaration.MultipleClasses only the single rule is removed.

Remove rules via code comments

If it is necessary to remove a rule/sniff/standard subset/standard only in specific place in the code, it is possible to use special comments that starts with:

// phpcs:disable

followed by the what you want to to remove.

For example: // phpcs:disable PSR1.Classes.ClassDeclaration.

From the point the comment is encountered to the end of the file, the requested rule/sniff/standard subset/standard is not checked anymore.

To re-enable it is necessary to use a similar syntax, but this time using phpcs:enable instead of phpcs:disable.

It worth noting:

  • phpcs:disable and phpcs:enable can be used without specifying the rule name, in this case the check for all rules are disabled/enabled.
  • Disabling / enabling comments could be embedded in doc block comments at file/class/method level. For example:
class Foo
{
    /**
     * @param mixed $a
     * @param mixed $b
     *
     * phpcs:disable NeutronStandard.Functions.TypeHint.NoArgumentType
     */
    public function test($a, $b)
    {
        // phpcs:enable
    }
}

IDE integration

PhpStorm

After having installed the package as explained above in the "Installation" section, open PhpStorm settings, and navigate to

Language & Frameworks -> PHP -> Quality Tools -> PHP_CodeSniffer

Choose "Local" in the "Configuration" dropdown.

Click the "..." button next to the dropdown, it will show a dialog where you need to specify the path for the Code Sniffer executable.

Open the file selection dialog, navigate to vendor/bin/ in your project and select phpcs (phpcs.bat on Windows).

Click the "Validate" button next to the path input field, if everything is fine a success message will be shown at the bottom of the window.

Navigate PhpStorm settings to:

Editor -> Inspections

Type codesniffer in the search field before the list of inspections, select PHP -> Quality Tools -> PHP_CodeSniffer validation and enable it using the checkbox in the list, press "Apply".

Select "PHP_CodeSniffer validation", press the refresh icon next to the "Coding standard" dropdown on the right and choose Inpsyde.

If you do not see Inpsyde here, you may need to specify phpcs.xml file by selecting "Custom" as standard and using the "..." button next to the dropdown.

Now PhpStorm integration is complete, and errors in the code style will be shown in the IDE editor allowing to detect them without running any commands at all.

Contribution

Running tests

To run the tests for this package you need to install its dependencies first:

$ composer install

After that you can run all PHPUnit tests like this:

$ vendor/bin/phpunit

The tests are organized in fixture files. If you want to run a single test use the filter argument:

$ vendor/bin/phpunit --filter function-length-no-blank-lines
Comments
  • LineLengthSniff returns

    LineLengthSniff returns "Line 0" instead of line number in the warning message

    1.0.0-beta.7 returns the "Line 0 exceeds 100 characters" warning message instead of the actual line number.

    For example this code that was located on line 86

    $script = (new Script(self::HANDLE_EDITOR, $assetUri . "$fileName.js", Asset::BLOCK_EDITOR_ASSETS))->withFilePath($assetDir . "$fileName.js")
    

    returns this message

    FILE: AssetProvider.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     86 | WARNING | Line 0 exceeds 100 characters; contains 142 characters.
    -----------------------------------------------------------------------------------------------------------------
    
    bug 
    opened by meszarosrob 8
  • Modernization

    Modernization

    This brach if merged will:

    • Modernize the codebase:

      • Move from PSR-2 or PSR-12
      • Use latest PHPCS
      • Use latest WPCS
      • Use latest VIP CS now in separate repo from WPCS
    • Cleanup:

      • Remove custom and 3rd party sniffs that are duplicated
      • Remove PHPCSAliases.php that's no more necessary
      • Remove arg and config from ruleset.xml

    Improve:

    • Make customization of ElementNameMinimalLength sniff
    • Improve detection of hook callback

    Overall, merging this PR will fix:

    • #21
    • #25
    • #26 (some outdated packages will be there because of PHPUnit 6 that we need due to PHP 7.0 support)
    • #29
    • #33

    So basically all open issues.

    Before merging this has to be tested in the real world, that is, the updated repo as to be used to check a few WP codebases.

    When merged we can release v0.15 which could be the 1.0-beta.

    opened by gmazzap 8
  • PHPCBF Breaks Syntax

    PHPCBF Breaks Syntax

    The Problem

    When running unit tests, I see over 30 errors saying that classes like Translationmanager\Exception\UnexpectedEntityException are not found. Further up in the output, I see raw PHP code for those classes, like so:

    .....E<?php# -*- coding: utf-8 -*-
    
    namespace Translationmanager\Exception;
    
    /**
     * Class InvalidPostException
     */
    class UnexpectedEntityException extends EntityException
    {
        /**
         * Create a new Exception for Unexpected Post Value Retrieved
         *
         * @param string $postType
         * @param string $message
         * @return UnexpectedEntityException
         */
        public static function forPostValue($postType, $message)
        {
            $message = $message ?: "Unexpected post value retrieved for post type {$postType}";
    
            return new self($message);
        }
    
        /**
         * Create a new Exception for Unexpected Term Value Retrieved
         *
         * @param mixed $value
         * @param string $message
         * @return UnexpectedEntityException
         */
        public static function forTermValue($value, $message)
        {
            $valueType = is_object($value) ? get_class($value) : gettype($value);
            $message = $message ?: "Unexpected term value retrieved. Should be WP_Term but got {$valueType}";
    
            return new self($message);
        }
    }
    

    Possible Cause

    The start of comment sequences // or # are too close to the opening PHP tag <?php. This makes the interpreter misinterpret the files included by autoloading as text instead of PHP.

    Suggested Solution

    Amend the rules to include a space between the starting PHP tag and the encoding declaration comment.

    Specs

    • PHP: 7.1;
    • PHPUnit: 7.5.20;
    • inpsyde/php-coding-standards: 38546e64d1f04fb69d7105bfe41ef9e46c6f8bfb.
    bug 
    opened by XedinUnknown 7
  • Installation via composer fails

    Installation via composer fails

    I tried to install the package via composer, but it failed with some errors:

    >composer require inpsyde/php-coding-standards --dev
    Using version ^0.13.4 for inpsyde/php-coding-standards
    ./composer.json has been created
    Running composer update inpsyde/php-coding-standards
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - dealerdirect/phpcodesniffer-composer-installer[v0.4.0, ..., v0.4.4] require composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
        - inpsyde/php-coding-standards 0.13.4 requires dealerdirect/phpcodesniffer-composer-installer ^0.4 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.4.0, ..., v0.4.4].
        - Root composer.json requires inpsyde/php-coding-standards ^0.13.4 -> satisfiable by inpsyde/php-coding-standards[0.13.4].
    
    You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.
    
    Installation failed, deleting ./composer.json.
    
    

    I'm using Windows 10, PHP 7.3.24, Composer 2.0.8

    I cloned the package from github repository.
    "composer install" have worked fine. It works normally in this way of installation.

    question 
    opened by SergeyBeloglazov 7
  • Return Type check is not valid

    Return Type check is not valid

    The Inpsyde sniff (https://github.com/inpsyde/php-coding-standards/blob/master/Inpsyde/Sniffs/CodeQuality/ReturnTypeDeclarationSniff.php#L175) for check id return type is existing works only for method, like

    public function get_media_strings(array $strings): array and not for functions, without a property visibility.

    However if it will fail if is a function, without class, only namespace usage, then will the sniff get an error message ' Return type is missing'.

    function get_media_strings(array $strings): array

    bildschirmfoto-20180828211236-1920x1080

    bug 
    opened by bueltge 6
  • PossiblyStaticClosure should sniff only inside classes?

    PossiblyStaticClosure should sniff only inside classes?

    Currently I get PossiblyStaticClosure warnings even in code outside of classes, such as here.

    I think it should not happen, in this context there is no way to access $this anyway, so no reason to add static.

    opened by AlexP11223 5
  • NoAccessors.NoGetter - don't check for native/psr interfaces

    NoAccessors.NoGetter - don't check for native/psr interfaces

    Sometimes it is required to implement get/set or whatevery methods which are maybe not allowed by coding standard but fixed by an interface.

    Following error occurs in version 0.7.x - release:

    Getters are discouraged. "Tell Don't Ask" principle should be applied if possible, and if getters are really needed consider naming methods after properties, e.g. name() instead of getName().(InpsydeCodingStandard.CodeQuality.NoAccessors.NoGetter)
    

    As code example we've following:

    <?php declare(strict_types=1); # -*- coding: utf-8 -*-
    
    class Foo implements IteratorAggregate
    {
    
    
        public function getIterator(): Traversable
        {
            // snip
        }
    }
    

    Link: http://php.net/manual/en/iteratoraggregate.getiterator.php


    Secondly it could be also possible to e.G. implement PSR-standard interfaces like PSR container which are having a get($id) method.

    bug 
    opened by Chrico 5
  • LineLength.TooLong - not for comments

    LineLength.TooLong - not for comments

    I'm getting following error message with the latest 0.7.x - release:

    Line exceeds 120 characters; contains 130 characters (InpsydeCodingStandard.CodeQuality.LineLength.TooLong)
    

    But this is for a comment which contains a link:

    /**
     * Returns the <noscript>-tag for GTM.
     *
     * @link https://developers.google.com/tag-manager/devguide#adding-data-layer-variables-for-devices-without-javascript-support
     *
     * @return string
     */
    

    This rule shouldn't test for comments.

    bug 
    opened by Chrico 5
  • Remove Codex files

    Remove Codex files

    If we should, do it use this repo, please remove the current files (https://github.com/inpsyde/Codex/tree/master/tools/CodeSniffer) on the codex repository so that we not have an redundant standards. Maybe we should leave a hint in the codex repo for that new ruleset.

    opened by bueltge 5
  • Considering iterable as proper return type declaration for generators

    Considering iterable as proper return type declaration for generators

    Inpsyde.CodeQuality.ReturnTypeDeclaration.NoGeneratorReturnType complains about the following:

    public function listSomething(): iterable {
         yield 1;
         yield 2;
    }
    

    I'm not sure if iterable suggests a rewinding of the returned list because that wouldn't be possible. If not, this construct should be allowed IMO.

    opened by dnaber-de 4
  • Giant leap forward

    Giant leap forward

    Please consider upgrading versions

    $ composer outdated
    dealerdirect/phpcodesniffer-composer-installer v0.4.4 v0.5.0 PHP_CodeSniffer Standards Composer Installer Plugin
    phpdocumentor/reflection-common                1.0.1  2.0.0  Common reflection classes used by phpdocumentor to reflect the code structure
    phpdocumentor/type-resolver                    0.4.0  1.0.0
    phpunit/php-code-coverage                      5.2.0  7.0.7  Library that provides collection, processing, and rendering functionality for PHP code coverage...
    phpunit/php-file-iterator                      1.4.5  2.0.2  FilterIterator implementation that filters files based on a list of suffixes.
    phpunit/php-timer                              1.0.9  2.1.2  Utility class for timing
    phpunit/php-token-stream                       2.0.2  3.1.0  Wrapper around PHP's tokenizer extension.
    phpunit/phpunit                                6.0.13 8.3.1  The PHP Unit Testing framework.
    phpunit/phpunit-mock-objects                   4.0.4  6.1.2  Mock Object library for PHPUnit
    Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
    sebastian/comparator                           2.0.0  3.0.2  Provides the functionality to compare PHP values for equality
    sebastian/diff                                 1.4.3  3.0.2  Diff implementation
    sebastian/environment                          2.0.0  4.2.2  Provides functionality to handle HHVM/PHP environments
    sebastian/global-state                         2.0.0  3.0.0  Snapshotting of global state
    sebastian/resource-operations                  1.0.0  2.0.1  Provides a list of PHP built-in functions that operate on resources
    wp-coding-standards/wpcs                       0.14.1 2.1.1  PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
    
    enhancement 
    opened by szepeviktor 4
  • [Feature Request]: Add a rule against unused imports

    [Feature Request]: Add a rule against unused imports

    Is your feature request related to a problem?

    After code refactoring or merging, we often have redundant namespace imports with the use keyword. This is a dead code that does nothing but pollution. It's easy to overlook these lines.

    Describe the desired solution

    Add a sniff raising warning or error on redundant namespace imports.

    Describe the alternatives that you have considered

    Require the code standard with this rule and just use it.

    Additional context

    No response

    Code of Conduct

    • [X] I agree to follow this project's Code of Conduct
    enhancement 
    opened by strangerkir 0
  • [Feature Request]: Bump squizlabs/php_codesniffer

    [Feature Request]: Bump squizlabs/php_codesniffer

    Is your feature request related to a problem?

    Can't update/install over PHPCS standards that require latest php_codesniffer version.

    Describe the desired solution

    Currently squizlabs/php_codesniffer is locked at ~3.6.0, but now suggests 3.* or latest is now 3.7.1.

    Describe the alternatives that you have considered

    ??

    Additional context

    No response

    Code of Conduct

    • [X] I agree to follow this project's Code of Conduct
    enhancement 
    opened by thefrosty 1
  • [Feature Request]: Add check for whitespace after type casting

    [Feature Request]: Add check for whitespace after type casting

    Is your feature request related to a problem?

    Currently, there is no rule that checks whether there is a space after the type casting. As a result, several spellings exist.

    Without a space:

    return (int)$lowStockThreshold;
    

    With spaces:

    return (string) max($lowStockThresholds);
    

    Describe the desired solution

    Add a rule that checks that there is a space after the type casting.

    Describe the alternatives that you have considered

    None.

    Additional context

    No response

    Code of Conduct

    • [X] I agree to follow this project's Code of Conduct
    enhancement 
    opened by tyrann0us 0
  • [Question] When using phpcbf there is a bug for the rule that leaves the first line with opening php tag

    [Question] When using phpcbf there is a bug for the rule that leaves the first line with opening php tag

    Describe the bug Not sure if this bug should be tackled in here

    Some auto fixing is not working as expected Notice the phpdeclare at the right after running phpcbf image

    To Reproduce Steps to reproduce the behavior: Have the following file with code:

    <?php declare(strict_types=1); // -*- coding: utf-8 -*-
    /*
     * This file is part of @package CCV\ElasticWPCustomizations
     *
     * (c) Inpsyde GmbH
     *
     * For the full copyright and license information, please view the LICENSE
     * file that was distributed with this source code.
     */
    
    namespace CCV\ElasticWPCustomizations\Tests\Unit\Index\Mapping\Settings;
    

    Expected behavior image

    System (please complete the following information):

    • OS: Ubuntu
    • PHP Version 7.4-fpm under docker container
    question 
    opened by luislard 0
  • Add check for Emacs UTF-8 file header

    Add check for Emacs UTF-8 file header

    Is your feature request related to a problem? Please describe. At Inpsyde, PHP files used to have the following file header:

    <?php # -*- coding: utf-8 -*-
    

    or

    <?php declare(strict_types=1); // -*- coding: utf-8 -*-
    

    As of 2021-06-25, there are more than 15.000 PHP files with this header. It originates from Emacs and including it was adapted by developers undiscussed for years.

    However, (nowadays) it doesn't make any sense to keep it. In fact, it is no longer used in most new packages and should be removed gradually from legacy packages too.

    Describe the solution you'd like

    • Add a coding standard check for the header that warns the user if the header is present.
    • Make sure that phpcbf deletes it.

    Describe alternatives you've considered None.

    Additional context None.

    enhancement 
    opened by tyrann0us 0
  • Warning or Error when PHP_INT_MAX or PHP_INT_MIN is used in add_action or add_filter

    Warning or Error when PHP_INT_MAX or PHP_INT_MIN is used in add_action or add_filter

    Is your feature request related to a problem? Please describe. This is more a question:

    Would it be a good idea to throw an error or a warning when the priority argument of add_action and add_filter is PHP_INT_MAX or PHP_INT_MIN?

    Describe the solution you'd like phpcs throwing a warning or an error.

    Describe alternatives you've considered

    Additional context Someone wrote "I do not like the usage of PHP_INT_MAX for the hook order, because it is not possible to remove them with another plugin. Yes, maybe not relevant in this case of custom plugin for a customer, but see it too often and have no chance to remove them silently."

    Also wrote "But good style in coding is not always a topic of rules and standards, more a process of learning. The value for php int max is always different and is dependent from the client, from the machine."

    enhancement 
    opened by luislard 1
Releases(1.0.0)
  • 1.0.0(Feb 28, 2022)

  • 1.0.0-beta.1(Apr 13, 2020)

    Added

    • PHPCompatibility checks
    • External VIP rules
    • Possibility to filter execution of tests

    Changed

    • Move to PSR-12
    • Move to WPCS v2
    • Move to PHPCS v3.3
    • Upgrade dealerdirect/phpcodesniffer-composer-installer to ^0.5
    • Extend type declaration exclusion for hooks static closures
    • Simplify customization of ElementNameMinimalLength
    • Allow blank line after method with single line declaration
    • Ignore in return type declaration check all methods that start with __
    • Remove PHPCSAliases class
    • Remove configuration values in provided ruleset.xml
    • Improved README and documentation
    Source code(tar.gz)
    Source code(zip)
  • 0.13.4(Feb 19, 2019)

    Fixed

    • Function with nullable type return and returning null (and nothing else) considered invalid.

    Changed

    • Replaced abandoned "wimg/php-compatibility" with "phpcompatibility/php-compatibility".
    Source code(tar.gz)
    Source code(zip)
  • 0.13.2(Jul 31, 2018)

  • 0.13.1(May 21, 2018)

  • 0.13.0(May 21, 2018)

  • 0.12.0(Apr 15, 2018)

    • Fix bug in Psr4Sniff when class has no namespace.
    • Allow @wp-hook ignore of return type for private and protected methods
    • Only check public accessors (by default)
    • Fix bug in checking return type (See #14)
    • Allow filters callbacks to return null on purpose
    Source code(tar.gz)
    Source code(zip)
  • 0.11.0(Mar 19, 2018)

    • Fix false positive in ReturnTypeDeclarationSniff with nullable types.
    • Relax check for missing return type when {aType}|null doc bloc is present.
    • Add is to the list of allowed short names.
    • Added FunctionBodyStartSniff to deal with blank lines on top of functions body.
    • Added VariablesNameSniff.
    • Improved PhpcsHelpers::variableIsProperty().
    • Improved failure handling in FixturesTest.
    • Use NeutronStandard by opting-in rules instead of opting-out
    • Properly handle Generators and return types.
    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Feb 26, 2018)

    • Renamed sniffs namespace (breaking change). Sniff are now referenced via Inpsyde.CodeQuality... instead of InpsydeCodingStandard.CodeQuality...
    • Add Psr4Sniff to check PSR-4 compliance of files that contain classes auto-loadable entities.
    • Minor tweaks to sniff.
    • Improved documentation for custom sniffs and their configuration.
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Feb 22, 2018)

  • 0.8.0(Feb 13, 2018)

    • Fix bug in NoAccessorsSniff and allow for a few method names related to PHP core interfaces.
    • Exclude ArrayAccess methods from ReturnTypeDeclarationSniff and ArgumentTypeDeclarationSniff.
    • Fix bug in LineLengthSniff which affected edge cases.
    • Changed default LineLengthSniff max length to 100, excluding leading indent.
    • Remove Variable Analysis, too much false positives
    Source code(tar.gz)
    Source code(zip)
  • 0.7.2(Feb 13, 2018)

  • 0.7.1(Feb 12, 2018)

  • 0.7.0(Feb 12, 2018)

    • Removed NeutronStandard.Conditions.DisallowConditionAssignWithoutConditional.
    • Removed NeutronStandard.MagicMethods.DisallowMagicGet.
    • Removed NeutronStandard.MagicMethods.DisallowMagicSet.
    • Made NeutronStandard.Whitespace.DisallowMultipleNewlines.MultipleNewlines a warning not error.
    • Added custom AssignmentInsideConditionSniff sniff.
    • Added custom NoTopLevelDefineSniff sniff.
    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Feb 12, 2018)

    • Missing return type waring from ReturnTypeDeclarationSniff skipped for hook callbacks.
    • Fixed a bug in return counting in helper class that affected few sniffs.
    • Add several "Generic" and "Squiz" rules.
    • Add DisallowShortOpenTagSniff that extends the generic sniff allowing short echo.
    • Remove NeutronStandard.Constants.DisallowDefine because of github.com/Automattic/phpcs-neutron-standard/issues/44
    • Renamed configuration properties for FunctionLengthSniff.
    • Add integration tests for custom sniffs.
    • Rename NoASetterSniff to NoAccessorsSniff and also warn for getters.
    Source code(tar.gz)
    Source code(zip)
  • 0.5.1(Feb 5, 2018)

  • 0.5.0(Feb 5, 2018)

    • Disabled NeutronStandard.Functions.TypeHint and replaced with custom sniffs
    • Added ArgumentTypeDeclarationSniff to replace NeutronStandard.Functions.TypeHint sniff for missing argument types. It does not check closures used as hook callbacks (because WP cannot be trusted on types).
    • Added ReturnTypeDeclarationSniff to replace NeutronStandard.Functions.TypeHint sniff for missing or wrong return type.
    • Added HookClosureReturnSniff to sniff closures added to filters and missing return values and closures added to action and having return values.
    Source code(tar.gz)
    Source code(zip)
  • 0.4.2(Feb 5, 2018)

    • Fix a bug in FunctionLengthSniff which only excludes first doc block
    • FunctionLengthSniff also excludes (by default) blank lines and single line comments
    • Introduce phpcs.xml
    • Small improvements to ruleset
    • Use own styles
    Source code(tar.gz)
    Source code(zip)
  • 0.4.1(Feb 1, 2018)

    • FunctionLengthSniff now excludes doc blocks lines from counting
    • New LineLengthSniff (that replaces "Generic" sniff included by "PSR2") and ignores long lines coming from translation functions first argument
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Feb 1, 2018)

  • 0.3.0(Jan 29, 2018)

Owner
Inpsyde GmbH
Inpsyde is counseling and implementation on the highest level. We create solutions with your goals kept in mind.
Inpsyde GmbH
A custom WordPress nav walker class to fully implement the Twitter Bootstrap 4.0+ navigation style (v3-branch available for Bootstrap 3) in a custom theme using the WordPress built in menu manager.

WP Bootstrap Navwalker This code in the main repo branch is undergoing a big shakeup to bring it in line with recent standards and to merge and test t

WP Bootstrap 3.3k Jan 5, 2023
WordPress & TypeScript. Simple starter template for WordPress projects

WordPress & TypeScript. Simple starter template for WordPress projects that want to use TypeScript in combination with @wordpress/scripts

Make it WorkPress 11 Sep 27, 2022
Developers tool for WordPress plugins: Wraps all your projects dependencies in your own namespace

Developers tool for WordPress plugins: Wraps all your projects dependencies in your own namespace, in order to prevent conflicts with other plugins loading the same dependencies in different versions.

Coen Jacobs 362 Dec 23, 2022
A PHP client for Wordpress websites that closely implement the XML-RPC WordPress API

Wordpress XML-RPC PHP Client A PHP client for Wordpress websites that closely implement the XML-RPC WordPress API Created by Hieu Le MIT licensed. Cur

Hieu Le 112 Nov 10, 2022
A curated list of Awesome WordPress Theme, Plugins and Framework development Resources and WordPress Communities.

Awesome WordPress A curated list of Awesome WordPress Theme, Plugins and Framework development Resources and WordPress Communities. Inspired by bayand

Dropndot Limited 91 Dec 26, 2022
The Pronamic WordPress Basecone plugin allows you to connect your WordPress installation to Basecone.

Pronamic WordPress Basecone The Pronamic WordPress Basecone plugin allows you to connect your WordPress installation to Basecone. Table of contents Au

Pronamic 1 Oct 19, 2021
A WordPress plugin to suspend WordPress sites automagically. Simple and lightweight, no annoying ads and fancy settings.

Suspend WP A WordPress plugin to suspend WordPress sites automagically. Simple and lightweight, no annoying ads and fancy settings. ?? Demo (coming so

Waren Gonzaga 3 Nov 15, 2021
Twenty Twenty-Two, the default WordPress theme that will launch with WordPress 5.9.

Twenty Twenty-Two Welcome to the development repository for the default theme that will launch with WordPress 5.9. About Twenty Twenty-Two is designed

null 414 Nov 28, 2022
Easy handle APlayer on WordPress. A shortcode for WordPress to using APlayer.

Description Easy handle APlayer on WordPress. A shortcode for WordPress to using APlayer. Support [audio] tag, compatible with AMP. Requirement WordPr

Karl Chen 24 Nov 3, 2022
WordPress plugin that lets you use Discourse as the community engine for a WordPress blog

WP Discourse Note: the wp-discourse plugin requires >= PHP-5.4.0. The WP Discourse plugin acts as an interface between your WordPress site and your Di

Discourse 497 Dec 10, 2022
Simple WordPress plugin to learn how to understand WordPress Crons and the Action Scheduler library.

Simple WordPress plugin to learn how to understand WordPress Crons and the Action Scheduler library. Import Jamendo playlists with tracks in WordPress posts.

Pierre Saikali 3 Dec 7, 2022
Add theming support to your Laravel 5.* projects

Laravel Theme Add theming support to your Laravel 5.* projects. Features Custom theme locations Support for theme inheritence with theme fallback Them

Karlo Mikus 70 Feb 5, 2022
A PHP Class for creating Wordpress Custom Post Types easily

N.B I've released an updated version of the project to a new repository, PostTypes. WP Custom Post Type Class v1.4 A single class to help you build mo

Joe Grainger 412 Nov 25, 2022
A library to allow the use of PHP attributes for WordPress hooks

WordPress Hook Attributes This library should be considered experimental and not production ready. Installation composer require boxuk/wp-hook-attribu

Box UK 9 Nov 23, 2022
Use WordPress backend with Laravel or any PHP application

A collection of Model classes that allows you to get data directly from a WordPress database. Corcel is a collection of PHP classes built on top of El

Corcel PHP 3.9k Dec 29, 2022
Use WordPress backend with Laravel or any PHP application

A collection of Model classes that allows you to get data directly from a WordPress database. Corcel is a collection of PHP classes built on top of El

Corcel PHP 3.9k Jan 7, 2023
A simple platform information plugin for WordPress. Shows you environment variables, PHP settings and more.

A simple platform information plugin for WordPress. Shows you environment variables, PHP settings and more.

New To Vaux 2 Sep 7, 2022
Awesome Enterprise - a shortcode based low code platform for PHP and WordPress.

Awesome Enterprise Framework Awesome Enterprise is a shortcode based low code platform for PHP and WordPress. You can set it up using composer compose

WPoets - Your WordPress Experts 10 Nov 17, 2022
Automattic 10.7k Jan 2, 2023