ministryofjustice / justice-gov-uk

Justice UK website
https://www.justice.gov.uk/
MIT License
2 stars 0 forks source link

Format code with PSR #78

Open EarthlingDavey opened 6 months ago

EarthlingDavey commented 6 months ago

As @wilson1000-MoJ suggested in this review. https://github.com/ministryofjustice/justice-gov-uk/pull/77#discussion_r1512622834

It's important to use a standard for code readability, and minimise that chance of merge conflicts.

Let's revisit.

EarthlingDavey commented 6 months ago

@EmilyHazlehurst has raised an important point about using PHPDoc comments to describe functions. https://github.com/ministryofjustice/justice-gov-uk/pull/91#discussion_r1524881714

e.g.

/**
* Prevent all single posts, of any post type, from using the document(s) slug.
*
* @param bool $bad_slug Whether the slug is bad or not
* @param string $slug The document slug
* @return bool The sum of the two numbers.
*/

https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/

+1 from me. Let's have a team discussion.

EarthlingDavey commented 6 months ago

Adding to this, we could potentially:

EarthlingDavey commented 6 months ago

Further research PSR-4.

Implementation would mean adding autoloader section of composer.json. This will require build-fpm-composer has access to php source code in the Dockerfile.

Resources: