fomiash/psr40000

PSR 40.000 — galactic coding standard for PHP

dev-main 2024-02-18 10:31 UTC

This package is auto-updated.

Last update: 2024-09-18 11:38:19 UTC


README

PHP License: MIT

«A long time ago, in a galaxy far, far away…»

Programming standards have become so detailed that that they began to touch on almost all the nuances of naming and composing code. One of these was PSR 40.000, the last bastion of the Imperium, describing the interface for army FOBAR standard. After all, even arbitrary objects described in examples must have a statutory specification.

The use of these standards is indicated in the following cases:

🚫 Wrong:

<?php

class Foo
{
   // ... //
}

class Bar
{
   // ... //
}

class Baz
{
   // ... //
}

🎖️ Right:

<?php

use Fomiash\Psr40000\{FooInterface, BarInterface, BazInterface};

class Foo implements FooInterface
{
   // ... //
}

class Bar implements BarInterface
{
   // ... //
}

class Baz implements BazInterface
{
   // ... //
}

🚫 Wrong:

<?php

class Bar
{
   // ... //
}

class Foo
{
   // ... //
}

class Baz
{
   public function __construct(public Bar $bar, public Foo $foo) {}
}

🎖️ Right:

<?php

use Fomiash\Psr40000\{FooInterface, BarInterface, BazInterface};

class Foo implements FooInterface
{
   public function __construct(
    public BarInterface $bar,
    public BazInterface $baz) {}
}

class Bar implements BarInterface
{
   // ... //
}

class Baz implements BazInterface
{
   // ... //
}

Install using Guards Composer:

composer require fomiash/psr40000