Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Bug Fixes and Improvements

Compare
Choose a tag to compare
released this 12 Aug 13:52
· 17 commits to master since this release
  • Improved documentation.
  • Fixed Extract buffering issues.
  • Fixed Extract when a phar contains an empty file.
  • Supporting the renaming of example.phar to just example in StubGenerator.
  • Added support for compacting PHP source while also preserving Doctrine annotations in docblocks.

Annotations

Previously, if you needed Doctrine annotations in your phar, you would be required to add each file with annotations as-is. This was not ideal since it meant that no compacting would be done. After having completed my Annotations library, I was able to add better annotations support to this library.

use Herrera\Annotations\Tokenizer;
use Herrera\Box\Box;
use Herrera\Box\Compactor\Php;

$compactor = new Php();
$compactor->setTokenizer(new Tokenizer());

$box = Box::create('my.phar');
$box->addCompactor($compactor);

With the Php compactor set with the Tokenizer instance, the following class:

/**
 * This is a test entity.
 *
 * @ORM\Entity()
 * @ORM\Table(name="Test")
 */
class Test
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Id()
     */
    private $id;

    /**
     * @ORM\JoinTable(
     *     name="exampleJoin",
     *     joinColumns={
     *          @ORM\JoinColumn(name="joinA", referencedColumnName="colA")
     *     },
     *     inverseJoinColumns={
     *          @ORM\JoinColumn(name="joinB", referencedColumnName="colB")
     *     }
     * )
     */
}

would be compacted like so:

<?php

use Doctrine\ORM\Mapping as ORM;

/**
@ORM\Entity()
@ORM\Table(name="Test")


*/
class Test
{
/**
@ORM\Column(type="integer")
@ORM\GeneratedValue(strategy="AUTO")
@ORM\Id()
*/
private $id;

/**
@ORM\JoinTable(name="exampleJoin",joinColumns={@ORM\JoinColumn(name="joinA",referencedColumnName="colA")},inverseJoinColumns={@ORM\JoinColumn(name="joinB",referencedColumnName="colB")})








*/
}

Mentions

I would also like to thank @clue for his help with the Extract class!