PHP code example of adhocore / phint

1. Go to this page and download the library: Download adhocore/phint library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adhocore / phint example snippets


namespace Abc;

/**
 * This is dummy class.
 *
 * It does nothing as of now.
 * Maybe you could fix it?
 */
class Dummy
{
    /**
     * Alpha beta.
     *
     * Example:
     *
     * <code>
     * $dummy = new Dummy;
     * $dummy->alpha('john', true);
     * // '...'
     * </code>
     *
     * @param string $name
     * @param bool   $flag
     *
     * @return string|null
     */
    public function alpha($name, $flag)
    {
        //
    }
}

use Abc\Dummy;
\

alpha(string $name, bool $flag): string|null
\

$dummy = new Dummy;
$dummy->alpha('john', true);
// '...'
\

use Ahc\Dummy;

alpha(string $name, bool $flag): string|null

$dummy = new Dummy;
$dummy->alpha('john', true);
// '...'



namespace Abc\Test;

use Abc\Dummy;
use PHPUnit\Framework\TestCase as TestCase;

/**
 * Auto generated by `phint test`.
 */
class DummyTest extends TestCase
{
    /**
     * @var Dummy
     */
    protected $dummy;

    public function setUp()
    {
        parent::setUp();

        $this->dummy = new Dummy;
    }

    public function testAlpha()
    {
        $actual = $this->dummy->alpha();

        // $this->assertSame('', $actual);
    }
}

[
  'namespace'   => 'Abc',
  'classFqcn'   => 'Abc\\Dummy',
  'classPath'   => '/home/user/projects/src/Dummy.php',
  'name'        => 'Dummy',
  'className'   => 'Dummy',
  'isTrait'     => false,
  'isAbstract'  => false,
  'isInterface' => false,
  'newable'     => true,
  'title'       => 'This is dummy class.',
  'texts'       => [
    'It does nothing as of now.',
    'Maybe you could fix it?',
  ],
  'methods' => [
    'alpha' => [
      'name'       => 'alpha',
      'inClass'    => 'Abc\\Dummy',
      'isStatic'   => false,
      'isFinal'    => false,
      'isPublic'   => true,
      'isAbstract' => false,
      'maybeMagic' => false,
      'title'      => 'Alpha beta.',
      'texts'      => [
        'Example:',
        '<code>',
        '$dummy = new Dummy;',
        '$dummy->alpha(\'john\', true);',
        '// \'...\'',
        '</code>',
      ],
      'return' => 'string|null',
      'params' => [
        'string $name',
        'bool $flag',
      ],
    ],
    // more methods ...
  ],
];