I have saved some contents (PHPdoc block) to a file using file_put_contents
, but, when that file get read by another program, it does not read my phpdoc text. But when I save (add a space and remove it) the file in Netbeans IDE, the other program can read the phpdoc block without having to fix anything. What could be the cause and how to fix it.
There is no error in the generated text. I just saved the file using Netbeans and it worked, I did not modify anythinng.
The code:
$tableOrmAnnotation = "* @ORM\\Table(name=\"song\")";
$evntHandlerCode = "* @ORM\\EntityListeners({\"hghcgh\\gvhghgBundle\\EventListener\\SongUploadListener\"})";
$entityCnt = file_get_contents($entityFilePath);
$entityCnt = \str_replace($tableOrmAnnotation, $tableOrmAnnotation . "
" . $evntHandlerCode, $entityCnt);
\file_put_contents($entityFilePath, $entityCnt);
The generated text:
/**
* Song
*
* @ORM\Table(name="song")
* @ORM\EntityListeners({"hghcgh\gvhghgBundle\EventListener\SongUploadListener"})
* @ORM\Entity(repositoryClass="hghcgh\gvhghgBundle\Repository\SongRepository")
*/
class Song